Struct cargo::core::dependency::Dependency [−][src]
pub struct Dependency { /* fields omitted */ }
Expand description
Information about a dependency requested by a Cargo manifest. Cheap to copy.
Implementations
pub fn parse(
name: impl Into<InternedString>,
version: Option<&str>,
source_id: SourceId,
inside: PackageId,
config: &Config
) -> CargoResult<Dependency>
[src]
pub fn parse(
name: impl Into<InternedString>,
version: Option<&str>,
source_id: SourceId,
inside: PackageId,
config: &Config
) -> CargoResult<Dependency>
[src]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]
pub fn parse_no_deprecated(
name: impl Into<InternedString>,
version: Option<&str>,
source_id: SourceId
) -> CargoResult<Dependency>
[src]Attempt to create a Dependency
from an entry in the manifest.
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' }
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' }
Sets whether the dependency is public.
If none, this dependencies must be built for all platforms. If some, it must only be built for the specified platform.
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_features(
&mut self,
features: impl IntoIterator<Item = impl Into<InternedString>>
) -> &mut Dependency
[src]
pub fn set_features(
&mut self,
features: impl IntoIterator<Item = impl Into<InternedString>>
) -> &mut Dependency
[src]Sets the list of features requested for the package.
Sets whether the dependency requests default features of the package.
Sets whether the dependency is optional.
Sets the source ID for this dependency.
Sets the version requirement for this dependency.
pub fn set_explicit_name_in_toml(
&mut self,
name: impl Into<InternedString>
) -> &mut Dependency
[src]Locks this dependency to depending on the specified package ID.
Returns true
if this is a “locked” dependency, basically whether it has
an exact version req.
Returns false
if the dependency is only used to build the local package.
Returns true
if the default features of the dependency are requested.
Returns the list of features that are requested by the dependency.
Returns true
if the package (sum
) can fulfill this dependency request.
Returns true
if the package (id
) can fulfill this dependency request.
Returns true
if the package (id
) can fulfill this dependency request.
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
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
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V