pub struct IndexDependency {
pub name: SmolStr,
pub req: SmolStr,
pub features: Box<Box<[String]>>,
pub optional: bool,
pub default_features: bool,
pub target: Option<Box<SmolStr>>,
pub kind: Option<DependencyKind>,
pub package: Option<Box<SmolStr>>,
}
Expand description
A single dependency of a specific crate version
Fields§
§name: SmolStr
Dependency’s arbitrary nickname (it may be an alias). Use Self::crate_name
for actual crate name.
req: SmolStr
The version requirement, as a string
features: Box<Box<[String]>>
Double indirection to remove size from this struct, since the features are rarely set
optional: bool
If it is an optional dependency
default_features: bool
True if the default features are enabled
target: Option<Box<SmolStr>>
Cfg expression applied to the dependency
kind: Option<DependencyKind>
The kind of the dependency
package: Option<Box<SmolStr>>
The name of the actual crate, if it was renamed in the crate’s manifest
Implementations§
Source§impl IndexDependency
impl IndexDependency
Sourcepub fn version_requirement(&self) -> VersionReq
pub fn version_requirement(&self) -> VersionReq
Gets the version requirement for the dependency as a semver::VersionReq
Sourcepub fn features(&self) -> &[String]
pub fn features(&self) -> &[String]
Features unconditionally enabled when using this dependency, in addition
to Self::has_default_features
and features enabled through the
parent crate’s feature list.
Sourcepub fn is_optional(&self) -> bool
pub fn is_optional(&self) -> bool
If it’s optional, it implies a feature of its Self::name
, and
can be enabled through the parent crate’s features.
Sourcepub fn has_default_features(&self) -> bool
pub fn has_default_features(&self) -> bool
If true
(default), enable default
feature of this dependency
Sourcepub fn target(&self) -> Option<&str>
pub fn target(&self) -> Option<&str>
This dependency is only used when compiling for this cfg
expression
Sourcepub fn kind(&self) -> DependencyKind
pub fn kind(&self) -> DependencyKind
The kind of the dependency
Sourcepub fn package(&self) -> Option<&str>
pub fn package(&self) -> Option<&str>
Set if dependency’s crate name is different from the name
(alias)
Sourcepub fn crate_name(&self) -> &str
pub fn crate_name(&self) -> &str
Returns the name of the crate providing the dependency.
This is equivalent to name()
unless self.package()
is not None
, in which case it’s equal to self.package()
.
Basically, you can define a dependency in your Cargo.toml
like this:
serde_lib = { version = "1", package = "serde" }
…which means that it uses the crate serde
but imports
it under the name serde_lib
.
Trait Implementations§
Source§impl Clone for IndexDependency
impl Clone for IndexDependency
Source§fn clone(&self) -> IndexDependency
fn clone(&self) -> IndexDependency
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for IndexDependency
impl Debug for IndexDependency
Source§impl<'de> Deserialize<'de> for IndexDependency
impl<'de> Deserialize<'de> for IndexDependency
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>,
Source§impl Hash for IndexDependency
impl Hash for IndexDependency
Source§impl PartialEq for IndexDependency
impl PartialEq for IndexDependency
Source§impl Serialize for IndexDependency
impl Serialize for IndexDependency
impl Eq for IndexDependency
impl StructuralPartialEq for IndexDependency
Auto Trait Implementations§
impl Freeze for IndexDependency
impl RefUnwindSafe for IndexDependency
impl Send for IndexDependency
impl Sync for IndexDependency
impl Unpin for IndexDependency
impl UnwindSafe for IndexDependency
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<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
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more