pub enum Dependency {
Simple(String),
Inherited(InheritedDependencyDetail),
Detailed(Box<DependencyDetail>),
}
Expand description
Dependency definition. Note that this struct doesn’t carry it’s key/name, which you need to read from its section.
It can be simple version number, or detailed settings, or inherited.
Variants§
Simple(String)
Version requirement (e.g. ^1.5
)
Inherited(InheritedDependencyDetail)
Incomplete data
Detailed(Box<DependencyDetail>)
{ version = "^1.5", features = ["a", "b"] }
etc.
Implementations§
Source§impl Dependency
impl Dependency
Sourcepub fn detail(&self) -> Option<&DependencyDetail>
pub fn detail(&self) -> Option<&DependencyDetail>
Get object with special dependency settings if it’s not just a version number.
Returns None
if it’s inherited and the value is not available
Sourcepub fn detail_mut(&mut self) -> &mut DependencyDetail
pub fn detail_mut(&mut self) -> &mut DependencyDetail
Panics if inherited value is not available
Sourcepub fn try_detail_mut(&mut self) -> Result<&mut DependencyDetail, Error>
pub fn try_detail_mut(&mut self) -> Result<&mut DependencyDetail, Error>
Returns error if inherited value is not available
Makes it detailed otherwise
Sourcepub fn req_features(&self) -> &[String]
pub fn req_features(&self) -> &[String]
Enable extra features for this dep, in addition to the default
features controlled via default_features
.
Sourcepub fn optional(&self) -> bool
pub fn optional(&self) -> bool
Is it optional. Note that optional deps can be used as features, unless features use dep:
/?
syntax for them.
See the [features
] module for more info.
Sourcepub fn package(&self) -> Option<&str>
pub fn package(&self) -> Option<&str>
Some
if it overrides the package name.
If None
, use the dependency name as the package name.
Sourcepub fn is_crates_io(&self) -> bool
pub fn is_crates_io(&self) -> bool
true
if it’s an usual crates.io dependency,
false
if git/path/alternative registry
Trait Implementations§
Source§impl Clone for Dependency
impl Clone for Dependency
Source§fn clone(&self) -> Dependency
fn clone(&self) -> Dependency
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more