pub trait DependencyExt: Display {
    fn version(&self, version: &str) -> Dependency { ... }
    fn repo(&self, repo: &str) -> Dependency { ... }
    fn optional(&self, version: &str) -> Dependency { ... }
    fn path(&self, path: &str) -> Dependency { ... }
}
Expand description

Adds some methods to create Dependency objects from objects that impl Display

Provided Methods

Constructs a Dependency using self.to_string() as the name, and version as the semver version

Example
extern crate cargo_toml_builder;
 
use cargo_toml_builder::prelude::*;
let dep = "foo".version("0.1.0");
let expected = Dependency::version("foo", "0.1.0");
assert_eq!(dep, expected);

Constructs a Dependency using self.to_string() as the name, and repo as the git repository

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
let dep = "foo".repo("https://github.com/bar/foo");
let expected = Dependency::repo("foo", "https://github.com/bar/foo");
assert_eq!(dep, expected);

Constructs an optional dependency using self.to_string() as the name, and version as the semver version

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
let dep = "foo".optional("0.1.0");
let expected = Dependency::version("foo", "0.1.0")
                          .optional(true)
                          .build();
assert_eq!(dep, expected);

Constructs a Dependency using self.to_string() as the name and path as the path

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
let dep = "foo".path("/path/to/foo");
let expected = Dependency::path("foo", "/path/to/foo");
assert_eq!(dep, expected);

Implementors