#[non_exhaustive]
pub struct Dependency { pub name: String, pub optional: Option<bool>, pub features: Option<IndexSet<String>>, pub default_features: Option<bool>, pub inherited_features: Option<IndexSet<String>>, pub source: Option<Source>, pub registry: Option<String>, pub rename: Option<String>, }
Expand description

A dependency handled by Cargo.

None means the field will be blank in TOML.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

The name of the dependency (as it is set in its Cargo.toml and known to crates.io).

§optional: Option<bool>

Whether the dependency is opted-in with a feature flag.

§features: Option<IndexSet<String>>

List of features to add (or None to keep features unchanged).

§default_features: Option<bool>

Whether default features are enabled.

§inherited_features: Option<IndexSet<String>>

List of features inherited from a workspace dependency.

§source: Option<Source>

Where the dependency comes from.

§registry: Option<String>

Non-default registry.

§rename: Option<String>

If the dependency is renamed, this is the new name for the dependency as a string. None if it is not renamed.

Implementations§

Create a new dependency with a name.

Set dependency to a given version.

Remove the existing version requirement.

Set whether the dependency is optional.

Set features as an array of string (does some basic parsing).

Set features as an array of string (does some basic parsing).

Set the value of default-features for the dependency.

Set the alias for the dependency.

Set the value of registry for the dependency.

Set features as an array of string (does some basic parsing).

Get the dependency source.

Get version of dependency.

Get registry of the dependency.

Get the alias for the dependency (if any).

Whether default features are activated.

Get whether the dep is optional.

Get the SourceID for this dependency.

Query to find this dependency.

Create a dependency from a TOML table entry.

Get the dependency name as defined in the manifest, that is, either the alias (rename field if Some), or the official package name (name field).

Convert dependency to TOML.

Returns a tuple with the dependency’s name and either the version as a String or the path/git repository as an InlineTable. (If the dependency is set as optional or default-features is set to false, an InlineTable is returned in any case.)

Panic

Panics if the path is relative

Modify existing entry to match this dependency.

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
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
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.

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
Converts the given value to a String. 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: 352 bytes