pub struct LocalRegistry<'cfg> {
index_path: Filesystem,
root: Filesystem,
src_path: Filesystem,
config: &'cfg Config,
updated: bool,
quiet: bool,
}
Expand description
A local registry is a registry that lives on the filesystem as a set of
.crate
files with an index
directory in the same format as a remote
registry.
This type is primarily accessed through the RegistryData
trait.
When a local registry is requested for a package, it simply looks into what
its index has under the index
directory. When LocalRegistry::download
is called, a local registry verifies the checksum of the requested .crate
tarball and then unpacks it to $CARGO_HOME/.registry/src
.
Note that there is a third-party subcommand
cargo-local-registry
, which happened to be developed by a former Cargo team member when local registry was introduced. The tool is to ease the burden of maintaining local registries. However, in general the Cargo team avoids recommending any specific third-party crate. Just FYI.
Filesystem hierarchy
Here is an example layout of a local registry on a local filesystem:
[registry root]/
├── index/ # registry index
│ ├── an/
│ │ └── yh/
│ │ └── anyhow
│ ├── ru/
│ │ └── st/
│ │ ├── rustls
│ │ └── rustls-ffi
│ └── se/
│ └── mv/
│ └── semver
├── anyhow-1.0.71.crate # pre-downloaded crate tarballs
├── rustls-0.20.8.crate
├── rustls-ffi-0.8.2.crate
└── semver-1.0.17.crate
For general concepts of registries, see the module-level documentation.
Fields§
§index_path: Filesystem
Path to the registry index.
root: Filesystem
Root path of this local registry.
src_path: Filesystem
Path where this local registry extract .crate
tarballs to.
config: &'cfg Config
§updated: bool
Whether this source has updated all package information it may contain.
quiet: bool
Disables status messages.
Implementations§
source§impl<'cfg> LocalRegistry<'cfg>
impl<'cfg> LocalRegistry<'cfg>
Trait Implementations§
source§impl<'cfg> RegistryData for LocalRegistry<'cfg>
impl<'cfg> RegistryData for LocalRegistry<'cfg>
source§fn index_path(&self) -> &Filesystem
fn index_path(&self) -> &Filesystem
source§fn assert_index_locked<'a>(&self, path: &'a Filesystem) -> &'a Path
fn assert_index_locked<'a>(&self, path: &'a Filesystem) -> &'a Path
source§fn load(
&mut self,
root: &Path,
path: &Path,
_index_version: Option<&str>
) -> Poll<CargoResult<LoadResponse>>
fn load( &mut self, root: &Path, path: &Path, _index_version: Option<&str> ) -> Poll<CargoResult<LoadResponse>>
source§fn config(&mut self) -> Poll<CargoResult<Option<RegistryConfig>>>
fn config(&mut self) -> Poll<CargoResult<Option<RegistryConfig>>>
config.json
file and returns it. Read moresource§fn block_until_ready(&mut self) -> CargoResult<()>
fn block_until_ready(&mut self) -> CargoResult<()>
source§fn invalidate_cache(&mut self)
fn invalidate_cache(&mut self)
source§fn set_quiet(&mut self, _quiet: bool)
fn set_quiet(&mut self, _quiet: bool)
source§fn is_updated(&self) -> bool
fn is_updated(&self) -> bool
source§fn download(&mut self, pkg: PackageId, checksum: &str) -> CargoResult<MaybeLock>
fn download(&mut self, pkg: PackageId, checksum: &str) -> CargoResult<MaybeLock>
.crate
file. Read moresource§fn finish_download(
&mut self,
_pkg: PackageId,
_checksum: &str,
_data: &[u8]
) -> CargoResult<File>
fn finish_download( &mut self, _pkg: PackageId, _checksum: &str, _data: &[u8] ) -> CargoResult<File>
.crate
file to disk. Read moresource§fn is_crate_downloaded(&self, _pkg: PackageId) -> bool
fn is_crate_downloaded(&self, _pkg: PackageId) -> bool
.crate
file is already downloaded.Auto Trait Implementations§
impl<'cfg> !RefUnwindSafe for LocalRegistry<'cfg>
impl<'cfg> !Send for LocalRegistry<'cfg>
impl<'cfg> !Sync for LocalRegistry<'cfg>
impl<'cfg> Unpin for LocalRegistry<'cfg>
impl<'cfg> !UnwindSafe for LocalRegistry<'cfg>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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