Struct cargo::core::PackageIdSpec [−][src]
pub struct PackageIdSpec { /* fields omitted */ }
Expand description
Some or all of the data required to identify a package:
- the package name (a
String
, required) - the package version (a
Version
, optional) - the package source (a
Url
, optional)
If any of the optional fields are omitted, then the package ID may be ambiguous, there may be more than one package/version/url combo that will match. However, often just the name is sufficient to uniquely define a package ID.
Implementations
Parses a spec string and returns a PackageIdSpec
if the string was valid.
Examples
Some examples of valid strings
use cargo::core::PackageIdSpec; let specs = vec![ "https://crates.io/foo", "https://crates.io/foo#1.2.3", "https://crates.io/foo#bar:1.2.3", "foo", "foo:1.2.3", ]; for spec in specs { assert!(PackageIdSpec::parse(spec).is_ok()); }
pub fn query_str<I>(spec: &str, i: I) -> CargoResult<PackageId> where
I: IntoIterator<Item = PackageId>,
[src]
pub fn query_str<I>(spec: &str, i: I) -> CargoResult<PackageId> where
I: IntoIterator<Item = PackageId>,
[src]Roughly equivalent to PackageIdSpec::parse(spec)?.query(i)
Convert a PackageId
to a PackageIdSpec
, which will have both the Version
and Url
fields filled in.
Checks whether the given PackageId
matches the PackageIdSpec
.
pub fn query<I>(&self, i: I) -> CargoResult<PackageId> where
I: IntoIterator<Item = PackageId>,
[src]
pub fn query<I>(&self, i: I) -> CargoResult<PackageId> where
I: IntoIterator<Item = PackageId>,
[src]Checks a list of PackageId
s to find 1 that matches this PackageIdSpec
. If 0, 2, or
more are found, then this returns an error.
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for PackageIdSpec
impl Send for PackageIdSpec
impl Sync for PackageIdSpec
impl Unpin for PackageIdSpec
impl UnwindSafe for PackageIdSpec
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V