pub struct InstallTracker {
    v1: CrateListingV1,
    v2: CrateListingV2,
    v1_lock: FileLock,
    v2_lock: FileLock,
}
Expand description

On-disk tracking for which package installed which binary.

v1 is an older style, v2 is a new style that tracks more information, and is both backwards and forwards compatible. Cargo keeps both files in sync, updating both v1 and v2 at the same time. Additionally, if it detects changes in v1 that are not in v2 (such as when an older version of Cargo is used), it will automatically propagate those changes to v2.

This maintains a filesystem lock, preventing other instances of Cargo from modifying at the same time. Drop the value to unlock.

It is intended that v1 should be retained for a while during a longish transition period, and then v1 can be removed.

Fields§

§v1: CrateListingV1§v2: CrateListingV2§v1_lock: FileLock§v2_lock: FileLock

Implementations§

Create an InstallTracker from information on disk.

Checks if the given package should be built, and checks if executables already exist in the destination directory.

Returns a tuple (freshness, map). freshness indicates if the package should be built (Dirty) or if it is already up-to-date (Fresh) and should be skipped. The map maps binary names to the PackageId that installed it (which is None if not known).

If there are no duplicates, then it will be considered Dirty (i.e., it is OK to build/install).

force=true will always be considered Dirty (i.e., it will always be rebuilt/reinstalled).

Returns an error if there is a duplicate and --force is not used.

Check if any executables are already installed.

Returns a map of duplicates, the key is the executable name and the value is the PackageId that is already installed. The PackageId is None if it is an untracked executable.

Mark that a package was installed.

Save tracking information to disk.

Iterator of all installed binaries. Items are (pkg_id, bins) where bins is the set of binaries that package installed.

Set of binaries installed by a particular package. Returns None if the package is not installed.

Remove a package from the tracker.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 136 bytes