pub struct Dependency {
    inner: Rc<Inner>,
}
Expand description

Information about a dependency requested by a Cargo manifest. Cheap to copy.

Fields§

§inner: Rc<Inner>

Implementations§

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.

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.

Locks this dependency to depending on the specified package ID.

Locks this dependency to a specified version.

Mainly used in dependency patching like [patch] or [replace], which doesn’t need to lock the entire dependency to a specific PackageId.

Returns true if this is a “locked” dependency. Basically a locked dependency has an exact version req, but not vice versa.

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.

Dependencies are potential rust libs if they are not artifacts or they are an artifact which allows to be seen as library. Previously, every dependency was potentially seen as library.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 8 bytes