pub enum IndexUrl<'iu> {
CratesIoSparse,
CratesIoGit,
NonCratesIo(Cow<'iu, str>),
Local(Cow<'iu, Path>),
}
Expand description
A remote index url
Variants§
CratesIoSparse
The canonical crates.io HTTP sparse index.
CratesIoGit
The canonical crates.io git index.
NonCratesIo(Cow<'iu, str>)
A non-crates.io index.
This variant uses the url to determine the index kind (sparse or git) by
inspecting the url’s scheme. This is because sparse indices are required
to have the sparse+
scheme modifier
Local(Cow<'iu, Path>)
Implementations§
Source§impl<'iu> IndexUrl<'iu>
impl<'iu> IndexUrl<'iu>
Sourcepub fn crates_io(
config_root: Option<PathBuf>,
cargo_home: Option<&Path>,
cargo_version: Option<&str>,
) -> Result<Self, Error>
pub fn crates_io( config_root: Option<PathBuf>, cargo_home: Option<&Path>, cargo_version: Option<&str>, ) -> Result<Self, Error>
Gets the IndexUrl
for crates.io, depending on the local environment.
- Determines if the crates.io registry has been replaced
- Determines if the protocol was explicitly configured by the user
- Otherwise, detects the version of cargo (see
crate::utils::cargo_version
), and uses that to determine the appropriate default
Sourcepub fn for_registry_name(
config_root: Option<PathBuf>,
cargo_home: Option<&Path>,
registry_name: &str,
) -> Result<Self, Error>
pub fn for_registry_name( config_root: Option<PathBuf>, cargo_home: Option<&Path>, registry_name: &str, ) -> Result<Self, Error>
Creates an IndexUrl
for the specified registry name
- Checks if
CARGO_REGISTRIES_<name>_INDEX
is set - Checks if the source for the registry has been replaced
- Uses the value of
registries.<name>.index
otherwise
Trait Implementations§
Auto Trait Implementations§
impl<'iu> Freeze for IndexUrl<'iu>
impl<'iu> RefUnwindSafe for IndexUrl<'iu>
impl<'iu> Send for IndexUrl<'iu>
impl<'iu> Sync for IndexUrl<'iu>
impl<'iu> Unpin for IndexUrl<'iu>
impl<'iu> UnwindSafe for IndexUrl<'iu>
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
Mutably borrows from an owned value. Read more
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more