[−][src]Struct cargo_toml_builder::types::Dependency
Represents a single dependency
Methods
impl Dependency
[src]
pub fn repo(label: &str, repo: &str) -> Dependency
[src]
Constructs a Depedency
that points to a git repo
Example
extern crate cargo_toml_builder; use cargo_toml_builder::prelude::*; let dep = Dependency::repo("foo", "https://github.com/foo/bar"); // translates to: // [dependencies] // foo = { git = "https://github.com/foo/bar" }
pub fn version(label: &str, version: &str) -> Dependency
[src]
Constructs a Depedency
that specifies a semver version
Example
extern crate cargo_toml_builder; use cargo_toml_builder::prelude::*; let dep = Dependency::version("foo", "0.1.0"); // translates to: // [dependencies] // foo = "0.1.0"
pub fn path(label: &str, path: &str) -> Dependency
[src]
Constructs a Depedency
that points to a path
Example
extern crate cargo_toml_builder; use cargo_toml_builder::prelude::*; let dep = Dependency::path("foo", "/path/to/foo"); // translates to: // [dependencies] // foo = { path = "/path/to/foo" }
pub fn rev(label: &str, repo: &str, rev: &str) -> Dependency
[src]
Constructs a Depedency
that points to a specific revision of a repository
Example
extern crate cargo_toml_builder; use cargo_toml_builder::prelude::*; let dep = Dependency::rev("foo", "https://github.com/foo/bar", "0a14cbe3928"); // translates to: // [dependencies] // foo = { git = "https://github.com/foo/bar", rev = "0a14cbe3928" }
pub fn tag(label: &str, repo: &str, tag: &str) -> Dependency
[src]
Constructs a Depedency
that points to a specific tag of a repository
Example
extern crate cargo_toml_builder; use cargo_toml_builder::prelude::*; let dep = Dependency::tag("foo", "https://github.com/foo/bar", "v1.0.0"); // translates to: // [dependencies] // foo = { git = "https://github.com/foo/bar", tag = "v1.0.0" }
pub fn branch(label: &str, repo: &str, branch: &str) -> Dependency
[src]
Constructs a Depedency
that points to a specific branch of a repository
Example
extern crate cargo_toml_builder; use cargo_toml_builder::prelude::*; let dep = Dependency::branch("foo", "https://github.com/foo/bar", "some-branch"); // translates to: // [dependencies] // foo = { git = "https://github.com/foo/bar", branch = "some-branch" }
pub fn build(&self) -> Self
[src]
If the builder pattern has been used to construct this Dependency
, this takes ownership
pub fn optional(&mut self, optional: bool) -> &mut Self
[src]
Mark this dependency as "optional = true"
Example
extern crate cargo_toml_builder; use cargo_toml_builder::prelude::*; let dep = Dependency::version("foo", "0.1.0") .optional(true) .build(); // translates to: // [dependencies] // foo = { version = "0.1.0", optional = true }
pub fn default_features(&mut self, default_features: bool) -> &mut Self
[src]
Specify whether this dependency is using the default features or not
Example
extern crate cargo_toml_builder; use cargo_toml_builder::prelude::*; let dep = Dependency::version("foo", "0.1.0") .default_features(false) .build(); // translates to: // [dependencies] // foo = { version = "0.1.0", default-features = false }
Trait Implementations
impl PartialEq<Dependency> for Dependency
[src]
fn eq(&self, other: &Dependency) -> bool
[src]
fn ne(&self, other: &Dependency) -> bool
[src]
impl Clone for Dependency
[src]
fn clone(&self) -> Dependency
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> From<&'a str> for Dependency
[src]
fn from(s: &'a str) -> Dependency
[src]
impl From<String> for Dependency
[src]
fn from(s: String) -> Dependency
[src]
impl<'a> From<&'a Dependency> for Dependency
[src]
fn from(d: &Dependency) -> Dependency
[src]
impl<'a> From<&'a mut Dependency> for Dependency
[src]
fn from(d: &'a mut Dependency) -> Dependency
[src]
impl From<Dependency> for InlineTable
[src]
fn from(d: Dependency) -> InlineTable
[src]
impl<'a> From<&'a Dependency> for InlineTable
[src]
fn from(dep: &'a Dependency) -> InlineTable
[src]
impl<'a> From<&'a Dependency> for Table
[src]
fn from(dep: &'a Dependency) -> Table
[src]
impl Debug for Dependency
[src]
Auto Trait Implementations
impl Send for Dependency
impl Sync for Dependency
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,