[][src]Struct cargo_edit::Dependency

pub struct Dependency {
    pub name: String,
    // some fields omitted
}

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)

Methods

impl Dependency[src]

pub fn new(name: &str) -> Dependency[src]

Create a new dependency with a name

pub fn set_version(self, version: &str) -> Dependency[src]

Set dependency to a given version

pub fn set_git(self, repo: &str) -> Dependency[src]

Set dependency to a given repository

pub fn set_path(self, path: &str) -> Dependency[src]

Set dependency to a given path

pub fn set_optional(self, opt: bool) -> Dependency[src]

Set whether the dependency is optional

pub fn set_default_features(self, default_features: bool) -> Dependency[src]

Set the value of default-features for the dependency

pub fn version(&self) -> Option<&str>[src]

Get version of dependency

pub fn to_toml(&self) -> (String, Item)[src]

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.)

Trait Implementations

impl Default for Dependency[src]

impl Clone for Dependency[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<Dependency> for Dependency[src]

impl Eq for Dependency[src]

impl Hash for Dependency[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for Dependency[src]

Auto Trait Implementations

impl Send for Dependency

impl Sync for Dependency

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Erased for T

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err