[][src]Struct cargo_toml_builder::types::Dependency

pub struct Dependency { /* fields omitted */ }

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]

impl Clone for 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]

impl From<String> for Dependency[src]

impl<'a> From<&'a Dependency> for Dependency[src]

impl<'a> From<&'a mut Dependency> for Dependency[src]

impl From<Dependency> for InlineTable[src]

impl<'a> From<&'a Dependency> for InlineTable[src]

impl<'a> From<&'a Dependency> for 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]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto 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> Borrow for T where
    T: ?Sized
[src]

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

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