pub struct Dependency {
    pub name: String,
    pub features: Option<Vec<String>>,
    pub available_features: BTreeMap<String, Vec<String>>,
    /* private fields */
}
Expand description

A dependency handled by Cargo

Fields

name: String

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

features: Option<Vec<String>>

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

available_features: BTreeMap<String, Vec<String>>

Features that are exposed by the dependency

Implementations

Create a new dependency with a name

Set dependency to a given version

Remove the existing version requirement

Set the available features of the dependency to a given vec

Set dependency to a given repository

Set dependency to a given path

Panic

Panics if the path is relative

Set whether the dependency is optional

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

Get version of dependency

Get the path of the dependency

Get registry of the dependency

Get the git repo of the dependency

Get the alias for the dependency (if any)

Whether default features are activated

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

Returns the “default value” for a type. 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 returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. 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.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.