Struct cargo_edit::Dependency
[−]
[src]
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]
fn new(name: &str) -> Dependency
Create a new dependency with a name
fn set_version(self, version: &str) -> Dependency
Set dependency to a given version
fn set_git(self, repo: &str) -> Dependency
Set dependency to a given repository
fn set_path(self, path: &str) -> Dependency
Set dependency to a given path
fn set_optional(self, opt: bool) -> Dependency
Set whether the dependency is optional
fn version(&self) -> Option<&str>
Get version of dependency
fn to_toml(&self) -> (String, Value)
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 a Table. (If the dependency is set as optional, a Table is
returned in any case.)
Trait Implementations
impl Debug for Dependency[src]
impl Hash for Dependency[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more
impl PartialEq for Dependency[src]
fn eq(&self, __arg_0: &Dependency) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Dependency) -> bool
This method tests for !=.
impl Eq for Dependency[src]
impl Clone for Dependency[src]
fn clone(&self) -> Dependency
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl Default for Dependency[src]
fn default() -> Dependency
Returns the "default value" for a type. Read more