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