pub struct Dependency {
pub name: String,
pub required_version: String,
pub features: Vec<String>,
pub optional: bool,
pub default_features: bool,
pub target: Option<String>,
pub kind: Option<DependencyKind>,
pub package: Option<String>,
}Expand description
A single dependency of a specific crate version
Fields§
§name: StringThe crate name
required_version: StringThe version the parent crate requires of this dependency
features: Vec<String>All cargo features configured by the parent crate
optional: boolTrue if this is an optional dependency
default_features: boolTrue if default features are enabled
target: Option<String>The name of the build target
kind: Option<DependencyKind>The kind of dependency, usually ‘normal’ or ‘dev’
package: Option<String>The package this crate is contained in
Implementations§
Source§impl Dependency
impl Dependency
Sourcepub fn required_version(&self) -> VersionReq
pub fn required_version(&self) -> VersionReq
Parse and return this dependency’s semantic version requirement as semver::VersionReq.
§Panics
Panics if self.required_version is not a valid SemVer requirement.
Cargo and crates.io enforce SemVer compliance for dependencies when a crate is published or updated. Nevertheless, our index contains a small number of releases whose dependency requirements are not valid SemVer (currently 14 out of ~1.8M).
Trait Implementations§
Source§impl Clone for Dependency
impl Clone for Dependency
Source§fn clone(&self) -> Dependency
fn clone(&self) -> Dependency
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Dependency
impl Debug for Dependency
Source§impl<'de> Deserialize<'de> for Dependency
impl<'de> Deserialize<'de> for Dependency
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for Dependency
impl Hash for Dependency
Source§impl Ord for Dependency
impl Ord for Dependency
Source§fn cmp(&self, other: &Dependency) -> Ordering
fn cmp(&self, other: &Dependency) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Dependency
impl PartialEq for Dependency
Source§impl PartialOrd for Dependency
impl PartialOrd for Dependency
Source§impl Serialize for Dependency
impl Serialize for Dependency
impl Eq for Dependency
impl StructuralPartialEq for Dependency
Auto Trait Implementations§
impl Freeze for Dependency
impl RefUnwindSafe for Dependency
impl Send for Dependency
impl Sync for Dependency
impl Unpin for Dependency
impl UnwindSafe for Dependency
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.