pub struct RegistryIndex<'cfg> {
    source_id: SourceId,
    path: Filesystem,
    summaries_cache: HashMap<InternedString, Summaries>,
    config: &'cfg Config,
}
Expand description

Manager for handling the on-disk index.

Note that local and remote registries store the index differently. Local is a simple on-disk tree of files of the raw index. Remote registries are stored as a raw git repository. The different means of access are handled via the RegistryData trait abstraction.

This transparently handles caching of the index in a more efficient format.

Fields§

§source_id: SourceId§path: Filesystem

Root directory of the index for the registry.

§summaries_cache: HashMap<InternedString, Summaries>

Cache of summary data.

This is keyed off the package name. The Summaries value handles loading the summary data. It keeps an optimized on-disk representation of the JSON files, which is created in an as-needed fashion. If it hasn’t been cached already, it uses RegistryData::load to access to JSON files from the index, and the creates the optimized on-disk summary cache.

§config: &'cfg Config

Config reference for convenience.

Implementations§

Returns the hash listed for a specified PackageId.

Load a list of summaries for name package in this registry which match req

This function will semantically parse the on-disk index, match all versions, and then return an iterator over all summaries which matched. Internally there’s quite a few layer of caching to amortize this cost though since this method is called quite a lot on null builds in Cargo.

Clears the in-memory summaries cache.

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: 88 bytes