Struct tame_index::krate::IndexDependency
source · 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§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