Struct cargo_lock::package::SourceId
source · pub struct SourceId { /* private fields */ }Expand description
Unique identifier for a source of packages.
Implementations§
source§impl SourceId
impl SourceId
sourcepub fn from_url(string: &str) -> Result<Self>
pub fn from_url(string: &str) -> Result<Self>
Parses a source URL and returns the corresponding ID.
Example
use cargo_lock::SourceId;
SourceId::from_url("git+https://github.com/alexcrichton/\
libssh2-static-sys#80e71a3021618eb05\
656c58fb7c5ef5f12bc747f");sourcepub fn for_path(path: &Path) -> Result<Self>
pub fn for_path(path: &Path) -> Result<Self>
Creates a SourceId from a filesystem path.
path: an absolute path.
sourcepub fn for_git(url: &Url, reference: GitReference) -> Result<Self>
pub fn for_git(url: &Url, reference: GitReference) -> Result<Self>
Creates a SourceId from a Git reference.
sourcepub fn for_registry(url: &Url) -> Result<Self>
pub fn for_registry(url: &Url) -> Result<Self>
Creates a SourceId from a remote registry URL.
sourcepub fn for_local_registry(path: &Path) -> Result<Self>
pub fn for_local_registry(path: &Path) -> Result<Self>
Creates a SourceId from a local registry path.
sourcepub fn for_directory(path: &Path) -> Result<Self>
pub fn for_directory(path: &Path) -> Result<Self>
Creates a SourceId from a directory path.
sourcepub fn kind(&self) -> &SourceKind
pub fn kind(&self) -> &SourceKind
Get the kind of source.
sourcepub fn display_index(&self) -> String
pub fn display_index(&self) -> String
Human-friendly description of an index
sourcepub fn display_registry_name(&self) -> String
pub fn display_registry_name(&self) -> String
Human-friendly description of a registry name
sourcepub fn is_registry(&self) -> bool
pub fn is_registry(&self) -> bool
Returns true if this source is from a registry (either local or not).
sourcepub fn is_remote_registry(&self) -> bool
pub fn is_remote_registry(&self) -> bool
Returns true if this source is a “remote” registry.
“remote” may also mean a file URL to a git index, so it is not
necessarily “remote”. This just means it is not local-registry.
sourcepub fn git_reference(&self) -> Option<&GitReference>
pub fn git_reference(&self) -> Option<&GitReference>
Gets the Git reference if this is a git source, otherwise None.
sourcepub fn with_precise(&self, v: Option<String>) -> Self
pub fn with_precise(&self, v: Option<String>) -> Self
Creates a new SourceId from this source with the given precise.
sourcepub fn is_default_registry(&self) -> bool
pub fn is_default_registry(&self) -> bool
Returns true if the remote registry is the standard https://crates.io.
Trait Implementations§
source§impl<'de> Deserialize<'de> for SourceId
impl<'de> Deserialize<'de> for SourceId
source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
source§impl Ord for SourceId
impl Ord for SourceId
source§impl PartialEq<SourceId> for SourceId
impl PartialEq<SourceId> for SourceId
source§impl PartialOrd<SourceId> for SourceId
impl PartialOrd<SourceId> for SourceId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Eq for SourceId
impl StructuralEq for SourceId
impl StructuralPartialEq for SourceId
Auto Trait Implementations§
impl RefUnwindSafe for SourceId
impl Send for SourceId
impl Sync for SourceId
impl Unpin for SourceId
impl UnwindSafe for SourceId
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.