Struct crates_index::SparseIndex
source · pub struct SparseIndex { /* private fields */ }Expand description
Wrapper around managing a sparse HTTP index, re-using Cargo’s local disk caches.
Currently it only uses local Cargo cache, and does not access the network in any way.
Implementations§
source§impl Index
impl Index
sourcepub fn from_url(url: &str) -> Result<Self, Error>
pub fn from_url(url: &str) -> Result<Self, Error>
Creates a view over the sparse HTTP index from a provided URL, opening the same location on disk that Cargo uses for that registry index’s metadata and cache.
Note this function takes the CARGO_HOME environment variable into account
sourcepub fn new_cargo_default() -> Result<Self, Error>
pub fn new_cargo_default() -> Result<Self, Error>
Creates an index for the default crates.io registry, using the same disk location as Cargo itself.
This is the recommended way to access the crates.io sparse index.
Note this function takes the CARGO_HOME environment variable into account
sourcepub fn with_path(
cargo_home: impl AsRef<Path>,
url: impl AsRef<str>
) -> Result<Self, Error>
pub fn with_path( cargo_home: impl AsRef<Path>, url: impl AsRef<str> ) -> Result<Self, Error>
Creates a view over the sparse HTTP index from the provided URL, rooted at the specified location
sourcepub fn at_path(path: PathBuf, url: String) -> Self
pub fn at_path(path: PathBuf, url: String) -> Self
Creates a view over the sparse HTTP index at the exact specified path
sourcepub fn index_config(&self) -> Result<IndexConfig, Error>
pub fn index_config(&self) -> Result<IndexConfig, Error>
Get the global configuration of the index.