Struct cargo_lock::SourceId
source · [−]pub struct SourceId { /* private fields */ }
Expand description
Unique identifier for a source of packages.
Implementations
sourceimpl 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 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
sourceimpl<'de> Deserialize<'de> for SourceId
impl<'de> Deserialize<'de> for SourceId
sourcefn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Ord for SourceId
impl Ord for SourceId
sourceimpl PartialOrd<SourceId> for SourceId
impl PartialOrd<SourceId> for SourceId
sourcefn partial_cmp(&self, other: &SourceId) -> Option<Ordering>
fn partial_cmp(&self, other: &SourceId) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more