Struct cargo::core::dependency::Dependency [−][src]
Information about a dependency requested by a Cargo manifest. Cheap to copy.
Implementations
impl Dependency
[src]
pub fn parse(
name: impl Into<InternedString>,
version: Option<&str>,
source_id: SourceId,
inside: PackageId,
config: &Config
) -> CargoResult<Dependency>
[src]
name: impl Into<InternedString>,
version: Option<&str>,
source_id: SourceId,
inside: PackageId,
config: &Config
) -> CargoResult<Dependency>
Attempt to create a Dependency
from an entry in the manifest.
pub fn parse_no_deprecated(
name: impl Into<InternedString>,
version: Option<&str>,
source_id: SourceId
) -> CargoResult<Dependency>
[src]
name: impl Into<InternedString>,
version: Option<&str>,
source_id: SourceId
) -> CargoResult<Dependency>
Attempt to create a Dependency
from an entry in the manifest.
pub fn new_override(name: InternedString, source_id: SourceId) -> Dependency
[src]
pub fn version_req(&self) -> &VersionReq
[src]
pub fn name_in_toml(&self) -> InternedString
[src]
This is the name of this Dependency
as listed in Cargo.toml
.
Or in other words, this is what shows up in the [dependencies]
section
on the left hand side. This is not the name of the package that’s
being depended on as the dependency can be renamed. For that use
package_name
below.
Both of the dependencies below return foo
for name_in_toml
:
[dependencies]
foo = "0.1"
and …
[dependencies]
foo = { version = "0.1", package = 'bar' }
pub fn package_name(&self) -> InternedString
[src]
The name of the package that this Dependency
depends on.
Usually this is what’s written on the left hand side of a dependencies
section, but it can also be renamed via the package
key.
Both of the dependencies below return foo
for package_name
:
[dependencies]
foo = "0.1"
and …
[dependencies]
bar = { version = "0.1", package = 'foo' }
pub fn source_id(&self) -> SourceId
[src]
pub fn registry_id(&self) -> Option<SourceId>
[src]
pub fn set_registry_id(&mut self, registry_id: SourceId) -> &mut Dependency
[src]
pub fn kind(&self) -> Kind
[src]
pub fn is_public(&self) -> bool
[src]
pub fn set_public(&mut self, public: bool) -> &mut Dependency
[src]
Sets whether the dependency is public.
pub fn specified_req(&self) -> bool
[src]
pub fn platform(&self) -> Option<&Platform>
[src]
If none, this dependencies must be built for all platforms. If some, it must only be built for the specified platform.
pub fn explicit_name_in_toml(&self) -> Option<InternedString>
[src]
The renamed name of this dependency, if any.
If the package
key is used in Cargo.toml
then this returns the same
value as name_in_toml
.
pub fn set_kind(&mut self, kind: Kind) -> &mut Dependency
[src]
pub fn set_features(
&mut self,
features: impl IntoIterator<Item = impl Into<InternedString>>
) -> &mut Dependency
[src]
&mut self,
features: impl IntoIterator<Item = impl Into<InternedString>>
) -> &mut Dependency
Sets the list of features requested for the package.
pub fn set_default_features(
&mut self,
default_features: bool
) -> &mut Dependency
[src]
&mut self,
default_features: bool
) -> &mut Dependency
Sets whether the dependency requests default features of the package.
pub fn set_optional(&mut self, optional: bool) -> &mut Dependency
[src]
Sets whether the dependency is optional.
pub fn set_source_id(&mut self, id: SourceId) -> &mut Dependency
[src]
Sets the source ID for this dependency.
pub fn set_version_req(&mut self, req: VersionReq) -> &mut Dependency
[src]
Sets the version requirement for this dependency.
pub fn set_platform(&mut self, platform: Option<Platform>) -> &mut Dependency
[src]
pub fn set_explicit_name_in_toml(
&mut self,
name: impl Into<InternedString>
) -> &mut Dependency
[src]
&mut self,
name: impl Into<InternedString>
) -> &mut Dependency
pub fn lock_to(&mut self, id: PackageId) -> &mut Dependency
[src]
Locks this dependency to depending on the specified package ID.
pub fn is_locked(&self) -> bool
[src]
Returns true
if this is a “locked” dependency, basically whether it has
an exact version req.
pub fn is_transitive(&self) -> bool
[src]
Returns false
if the dependency is only used to build the local package.
pub fn is_build(&self) -> bool
[src]
pub fn is_optional(&self) -> bool
[src]
pub fn uses_default_features(&self) -> bool
[src]
Returns true
if the default features of the dependency are requested.
pub fn features(&self) -> &[InternedString]
[src]
Returns the list of features that are requested by the dependency.
pub fn matches(&self, sum: &Summary) -> bool
[src]
Returns true
if the package (sum
) can fulfill this dependency request.
pub fn matches_ignoring_source(&self, id: PackageId) -> bool
[src]
Returns true
if the package (id
) can fulfill this dependency request.
pub fn matches_id(&self, id: PackageId) -> bool
[src]
Returns true
if the package (id
) can fulfill this dependency request.
pub fn map_source(
self,
to_replace: SourceId,
replace_with: SourceId
) -> Dependency
[src]
self,
to_replace: SourceId,
replace_with: SourceId
) -> Dependency
Trait Implementations
impl Clone for Dependency
[src]
fn clone(&self) -> Dependency
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Dependency
[src]
impl Eq for Dependency
[src]
impl Hash for Dependency
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Dependency
[src]
fn cmp(&self, other: &Dependency) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Dependency> for Dependency
[src]
fn eq(&self, other: &Dependency) -> bool
[src]
fn ne(&self, other: &Dependency) -> bool
[src]
impl PartialOrd<Dependency> for Dependency
[src]
fn partial_cmp(&self, other: &Dependency) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for Dependency
[src]
impl StructuralEq for Dependency
[src]
impl StructuralPartialEq for Dependency
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Dependency
impl !Send for Dependency
impl !Sync for Dependency
impl Unpin for Dependency
impl UnwindSafe for Dependency
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,