pub struct CargoToml {
    pub name: Option<String>,
    pub authors: Option<Vec<String>>,
    /* private fields */
}
Expand description

Main builder struct

This is the builder that all other methods are called on. You can use ::builder(), ::new(), or ::default() to get an initialized instance

Example

extern crate cargo_toml_builder;
use cargo_toml_builder::prelude::*;
let cargo_toml = CargoToml::builder()
                    .name("my-project")
                    .author("Me <me@me.com>")
                    .build()?;

assert_eq!(cargo_toml.to_string(), r#"
[package]
name = "my-project"
version = "0.1.0"
authors = ["Me <me@me.com>"]

[dependencies]
"#);

Fields

name: Option<String>

The name that will be used for this Cargo.toml

authors: Option<Vec<String>>

The list of authors that will be used for this Cargo.toml

Implementations

Construct a new instance

Example
extern crate cargo_toml_builder;
use cargo_toml_builder::CargoToml;
let cargo_toml = CargoToml::new();

Construct a new instance

Example
extern crate cargo_toml_builder;
use cargo_toml_builder::CargoToml;
let cargo_toml = CargoToml::builder();

Sets the package.name of the project

Example
extern crate cargo_toml_builder;
use cargo_toml_builder::CargoToml;
let cargo_toml = CargoToml::new()
                    .name("my-rust-project")
                    .build()?;
/*
[package]
name = "my-rust-project"
*/

Add an author to the package.authors property

Note: This will append an entry to the underlying Vec, it will not affect any other authors that have been set

Example
extern crate cargo_toml_builder;
use cargo_toml_builder::prelude::*;
let cargo_toml = CargoToml::new()
                    .author("Me <me@me.com>")
                    .build()?;
/*
[package]
authors = ["Me <me@me.com>"]
*/

Set the list of authors for the package.authors property

Note: This will replace any existing list of authors

Example
extern crate cargo_toml_builder;
use cargo_toml_builder::prelude::*;
let cargo_toml = CargoToml::new()
                    .authors(&[
                        "Me <me@me.com>".into(),
                        "You <you@you.com>".into()
                    ])
                    .build()?;
/*
[package]
authors = ["Me <me@me.com>", "You <you@you.com>"]
*/

Sets the package.version of the project

Example
extern crate cargo_toml_builder;
use cargo_toml_builder::prelude::*;
let cargo_toml = CargoToml::new()
                        .version("1.1.0")
                        .build()?;
/*
[package]
version = "1.1.0"
*/

Sets the package.build property of the project

TODO: currently impossible to generate build = false

Example
extern crate cargo_toml_builder;
use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .build_script("./my-build-script.rs")
                    .build()?;
/*
[package]
build = "./my-build-script"
*/

Sets the package.documentation property of the project

Example
extern crate cargo_toml_builder;
use cargo_toml_builder::prelude::*;
let cargo_toml = CargoToml::new()
                    .documentation("https://docs.rs/my-project")
                    .build()?;
/*
[package]
documentation = "https://docs.rs/my-project"
*/

Adds an exclusion pattern to the package.exclude property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .exclude("build/**/*.o")
                    .build()?;
/*
[package]
exclude = ["build/**/*.o"]
*/

Sets the list of exclusion patterns for the package.exclude property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .excludes(&[
                        "build/**/*.o".into(),
                        "doc/**/*.html".into(),
                    ])
                    .build()?;
/*
[package]
exclude = ["build/**/*.o", "doc/**/*.html"]
*/

Adds an inclusion pattern to the package.include property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .include("src/**/*")
                    .build()?;
/*
[package]
include = ["src/**/*"]
*/

Sets the inclusion patterns for the package.include property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .includes(&[
                        "src/**/*".into(),
                        "Cargo.toml".into(),
                    ])
                    .build()?;
/*
[package]
include = ["src/**/*.html, "Cargo.toml"]
*/

Sets the package.publish property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .publish(false)
                    .build()?;
/*
[package]
publish = false
*/

Sets the package.workspace property

(this is the workspace = "/path/to/workspace" property, not be be confused with the [workspace] table that can also be added to the document)

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .workspace_root("/path/to/workspace/root")
                    .build()?;
/*
[package]
workspace = "/path/to/workspace/root"
*/

Sets the package.description property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .description("This is my new Rust project")
                    .build()?;
/*
[package]
description = "This is my new Rust project"
*/

Sets the package.homepage property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .homepage("https://my.domain/")
                    .build()?;
/*
[package]
homepage = "https://my.domain/"
*/

Sets the package.repository property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .repository("https://gitlab.com/me/my-project")
                    .build()?;
/*
[package]
repository = "https://gitlab.com/me/my-project"
*/

Sets the package.readme property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .readme("README.adoc")
                    .build()?;
/*
[package]
readme = "README.adoc"
*/

Adds a keyword to the package.keywords property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .keyword("async")
                    .build()?;
/*
[package]
keywords = ["async"]
*/

Sets the list of keywords for the package.keywords property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .keywords(&[
                        "async".into(),
                        "networking".into(),
                    ])
                    .build()?;
/*
[package]
keywords = ["async", "networking"]
*/

Adds a category to the package.categories property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .category("filesystem")
                    .build()?;
/*
[package]
categories = ["filesystem"]
*/

Sets the list of categories for the package.categories property

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .categories(&[
                        "filesystem".into(),
                        "testing".into(),
                    ])
                    .build()?;
/*
[package]
categories = ["filesystem", "testing"]
*/

Adds a license to the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .license(License::Mit)
                    .build()?;
/*
[package]
license = "MIT"
*/

Sets a list of licenses for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .licenses(&[
                        License::Mit,
                        License::Apache2,
                    ])
                    .build()?;
/*
[package]
license = "MIT/Apache-2.0"
*/

Sets the location for the license file of the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .license_file("LICENSE")
                    .build()?;
/*
[package]
license-file = "LICENSE"
*/

Sets the badges.appveyor table for the project

You can import the “Appveyor” struct from cargo_toml_builder::types, but this method will take anything that implements Into<Appveyor>, which String and &str do. So if all you want is to add the repo, you can just pass some kind of string to this method and it should Just Work.

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::Appveyor;

let appveyor_badge = Appveyor::new("https://gitlab.com/me/my-project");
let cargo_toml = CargoToml::new()
                    .appveyor(appveyor_badge)
// or this will also work, and result in the same output:
//                  .appveyor("https://gitlab.com/me/my-project")
                    .build()?;
/*
[badges]
appveyor = { repository = "https://gitlab.com/me/my-project" }
*/

Sets the badges.circle-ci table for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::CircleCi;

let circe_ci_badge = CircleCi::new("https://gitlab.com/me/my-project");
let cargo_toml = CargoToml::new()
                    .circle_ci(circe_ci_badge)
                    .build()?;
/*
[badges]
circle-ci = { repository = "https://gitlab.com/me/my-project" }
*/

Sets the badges.gitlab table for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::Gitlab;

let gitlab_badge = Gitlab::new("https://gitlab.com/me/my-project");
let cargo_toml = CargoToml::new()
                    .gitlab(gitlab_badge)
                    .build()?;
/*
[badges]
gitlab = { repository = "https://gitlab.com/me/my-project" }
*/

Sets the badges.travis-ci table for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::TravisCi;

let travis_ci_badge = TravisCi::new("https://gitlab.com/me/my-project");
let cargo_toml = CargoToml::new()
                    .travis_ci(travis_ci_badge)
                    .build()?;
/*
[badges]
travis-ci = { repository = "https://gitlab.com/me/my-project" }
*/

Sets the badges.codecov table for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::Codecov;

let codecov_badge = Codecov::new("https://gitlab.com/me/my-project");
let cargo_toml = CargoToml::new()
                    .codecov(codecov_badge)
                    .build()?;
/*
[badges]
codecov = { repository = "https://gitlab.com/me/my-project" }
*/

Sets the badges.coveralls table for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::Coveralls;

let coveralls_badge = Coveralls::new("https://gitlab.com/me/my-project");
let cargo_toml = CargoToml::new()
                    .coveralls(coveralls_badge)
                    .build()?;
/*
[badges]
coveralls = { repository = "https://gitlab.com/me/my-project" }
*/

Sets the badges.is-it-maintained-issue-resolution table for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::Coveralls;

let cargo_toml = CargoToml::new()
                    .is_it_maintained_time("https://gitlab.com/me/my-project")
                    .build()?;
/*
[badges]
is-it-maintained-issue-resolution = { repository = "https://gitlab.com/me/my-project" }
*/

Sets the badges.is-it-maintained-open-issues table for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::Coveralls;

let cargo_toml = CargoToml::new()
                    .is_it_maintained_issues("https://gitlab.com/me/my-project")
                    .build()?;
/*
[badges]
is-it-maintained-open-issues = { repository = "https://gitlab.com/me/my-project" }
*/

Sets the badges.maintenance table for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::MaintenanceStatus;

let cargo_toml = CargoToml::new()
                    .maintenance(MaintenanceStatus::AsIs)
                    .build()?;
/*
[badges]
maintenance = { status = "as-is" }
*/

Adds a dependency to the dependencies table

The Dependency struct is imported through the prelude, but you can also pass anything to this that implements Into<Dependency> which String and &str do. If you pass a string to this method, it will add a regular crate dependency, with version "*". You can use the extension methods from DependencyExt to use a string to construct a Dependency object.

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .dependency("env_logger".version("0.5.6"))
                    .build()?;
/*
[dependencies]
env_logger = "0.5.6"
*/

Set the dependencies table for the project

Note: This will replace any dependencies current attached to the object

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .dependencies(&[
                        "env_logger".version("0.5.6"),
                        "tokio".version("0.2"),
                    ])
                    .build()?;
/*
[dependencies]
env_logger = "0.5.6"
tokio = "0.2"
*/

Add a dev-dependencies entry to the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .dev_dependency("hamcrest".version("0.1.5"))
                    .build()?;
/*
[dev-dependencies]
hamcrest = "0.1.5"
*/

Set the list of dev-dependencies for the project

Note: This will replace any dev-dependencies currently attached to the object

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .dev_dependencies(&[
                        "hamcrest".version("0.1.5"),
                        "my-test-lib".path("../my-test-lib")
                    ])
                    .build()?;
/*
[dev-dependencies]
hamcrest = "0.1.5"
my-test-lib = { path = "../my-test-lib" }
*/

Add an entry to the build-dependencies table for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .build_dependency("gcc".version("0.3.54"))
                    .build()?;
/*
[build-dependencies]
gcc = "0.3.54"
*/

Set the list of build-dependencies for the project

Note: this will replace any build dependencies currently attached to the object

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .build_dependencies(&[
                        "gcc".version("0.3.54"),
                        "cmake".version("0.1.29"),
                    ])
                    .build()?;
/*
[build-dependencies]
gcc = "0.3.54"
cmake = "0.1.29"
*/

Add a dependency to a target

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .target_dependency("cfg(unix)", "openssl".version("1.0.1"))
                    .build()?;
/*
[target."cfg(unix)".dependencies]
openssl = "1.0.1"
*/

Set the dependency list for a target

Note: This will replace any dependencies current attached to the target

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .target_dependencies("cfg(unix)", &[
                        "openssl".version("1.0.1"),
                        "libc".version("0.2.40"),
                    ])
                    .build()?;
/*
[target."cfg(unix)".dependencies]
openssl = "1.0.1"
libc = "0.2.40"
*/

Set the properties of the dev profile

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::{Profile, PanicStrategy};

let profile = Profile::new().panic(PanicStrategy::Abort).build();
let cargo_toml = CargoToml::new()
                    .profile_dev(profile)
                    .build()?;
/*
[profile.dev]
panic = "abort"
*/

Set the properties of the release profile

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::{Profile, PanicStrategy};

let profile = Profile::new().panic(PanicStrategy::Abort).build();
let cargo_toml = CargoToml::new()
                    .profile_release(profile)
                    .build()?;
/*
[profile.release]
panic = "abort"
*/

Set the properties of the test profile

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::{Profile, PanicStrategy};

let profile = Profile::new().panic(PanicStrategy::Abort).build();
let cargo_toml = CargoToml::new()
                    .profile_test(profile)
                    .build()?;
/*
[profile.test]
panic = "abort"
*/

Set the properties of the bench profile

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::{Profile, PanicStrategy};

let profile = Profile::new().panic(PanicStrategy::Abort).build();
let cargo_toml = CargoToml::new()
                    .profile_bench(profile)
                    .build()?;
/*
[profile.bench]
panic = "abort"
*/

Set the properties of the doc profile

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::{Profile, PanicStrategy};

let profile = Profile::new().panic(PanicStrategy::Abort).build();
let cargo_toml = CargoToml::new()
                    .profile_doc(profile)
                    .build()?;
/*
[profile.doc]
panic = "abort"
*/

Add a feature to the project

The user can attach dependencies, and the labels for other features, to a Feature object. If a Dependency is added, it will automatically be added to the [dependencies] section of the document with the optional = true option added. If you need different behavior, add the name of the dependency using the .feature builder method and add the dependency to the correct section manually.

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let nightly = Feature::new("nightly").dependency("clippy".version("0.0.191")).build();
let cargo_toml = CargoToml::new()
                    .feature(nightly)
                    .build()?;
/*
[features]
nightly = ['clippy']

[dependencies]
clippy = { version = "0.0.191", optional = true }
*/

Or, to add a feature dependency to, say, [dev-dependencies]:

extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let nightly = Feature::new("nightly").feature("clippy").build();
let cargo_toml = CargoToml::new()
                    .feature(nightly)
                    .dev_dependency("clippy".version("0.0.191").optional(true))
                    .build()?;
/*
[features]
nightly = ['clippy']

[dev-dependencies]
clippy = { version = "0.0.191", optional = true }
*/

Set the workspace config table for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::Workspace;

let workspace = Workspace::new().member("/path/to/member1").build();
let cargo_toml = CargoToml::new()
                    .workspace(workspace)
                    .build()?;
/*
[workspace]
members = ["/path/to/member1"]
*/

Set a [lib] target for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let target = LibTarget::new().name("my-lib").path("src/my-lib.rs").build();
let cargo_toml = CargoToml::new()
                    .lib(target)
                    .build()?;
/*
[lib]
name = "my-lib"
path = "src/my-lib.rs"
*/

Add a [[bin]] target for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let target = BinTarget::new().name("my-bin").path("src/bin/my-bin.rs").build();
let cargo_toml = CargoToml::new()
                    .bin(target)
                    .build()?;
/*
[dependencies]
<name> = <value>
*/

Set the [[bin]] targets for the project

Note: This will replace any bin targets currently attached to the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
let cargo_toml = CargoToml::new()
                    .bins(&[
                        BinTarget::new().name("my-bin-1").path("src/bin/my-bin-1.rs").build(),
                        BinTarget::new().name("my-bin-2").path("src/bin/my-bin-2.rs").build(),
                    ])
                    .build()?;
/*
[dependencies]
<name> = <value>
*/

Add a [bench] target for the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let target = BenchTarget::new().name("my-benchmark").path("bench/my-benchmark.rs").build();
let cargo_toml = CargoToml::new()
                    .bench(target)
                    .build()?;
/*
[dependencies]
<name> = <value>
*/

Set the list of [[bench]] targets for the project

Note: This will replace any bench targets currently attached to the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .benches(&[
                        BenchTarget::new().name("my-benchmark-1").path("bench/my-benchmark-1.rs").build(),
                        BenchTarget::new().name("my-benchmark-2").path("bench/my-benchmark-2.rs").build(),
                    ])
                    .build()?;

/*
[[bench]]
name = "my-benchmark-1"
path = "bench/my-benchmark-1.rs"

[[bench]]
name = "my-benchmark-2"
path = "bench/my-benchmark-2.rs"
*/

Add a [[test]] target to the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let target = TestTarget::new().name("my-test").path("tests/my-test.rs").build();
let cargo_toml = CargoToml::new()
                    .test(target)
                    .build()?;
/*
[[test]]
name = "my-test"
path = "tests/my-test.rs"
*/

Set the [[test]] targets for the project

Note: This will replace any test targets currently attached to the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .tests(&[
                        TestTarget::new().name("my-test-1").path("tests/my-test-1.rs").build(),
                        TestTarget::new().name("my-test-2").path("tests/my-test-2.rs").build(),
                    ])
                    .build()?;
/*
[[test]]
name = "my-test-1"
path = "tests/my-test-1.rs"

[[test]]
name = "my-test-2"
path = "tests/my-test-2.rs"
*/

Add an [[example]] target to the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let target = ExampleTarget::new().name("my-example").path("examples/my-example.rs").build();
let cargo_toml = CargoToml::new()
                    .example(target)
                    .build()?;
/*
[[example]]
name = "my-example"
path = "examples/my-example.rs"
*/

Set the list of [[example]] targets for the project Note: This will replace any [[example]] targets currently attached to the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .examples(&[
                        ExampleTarget::new().name("my-example-1").path("examples/my-example-1.rs").build(),
                        ExampleTarget::new().name("my-example-2").path("examples/my-example-2.rs").build(),
                    ])
                    .build()?;
/*
[[example]]
name = "my-example-1"
path = "examples/my-example-1.rs"

[[example]]
name = "my-example-2"
path = "examples/my-example-2.rs"
*/
Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::PatchSet;
let patchset = PatchSet::new("crates-io")
                        .patch("env_logger".repo("https://gitlab.com/me/env_logger.git"))
                        .build();
let cargo_toml = CargoToml::new()
                    .patch(patchset)
                    .build()?;
/*
[patch.crates-io]
env_logger = { git = "https://gitlab.com/me/env_logger.git" }
*/

Set the list of patch sets for the project

Note: This will replace any patch sets currently attached to the object

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
use cargo_toml_builder::types::PatchSet;
let cargo_toml = CargoToml::new()
                    .patches(&[
                        PatchSet::new("crates-io")
                                 .patch("env_logger".repo("https://gitlab.com/me/env_logger.git"))
                                 .build(),
                        PatchSet::new("https://github.com/example/baz")
                                 .patch("baz".repo("https://github.com/example/patched-baz"))
                                 .build(),
                    ])
                    .build()?;
/*
[patch.crates-io]
env_logger = { git = "https://gitlab.com/me/env_logger.git" }

[patch."https://github.com/example/baz"]
baz = { git = "https://github.com/example/patched-baz" }
*/

Add a [replace] entry to the project

Example
extern crate cargo_toml_builder;

use cargo_toml_builder::prelude::*;
let cargo_toml = CargoToml::new()
                    .replace("foo:0.1.0".repo("https://github.com/example/foo"))
                    .build()?;
/*
[replace]
"foo:0.1.0" = { git = "https://github.com/example/foo" }
*/

Build a toml_edit::Document object from this builder

Example
extern crate cargo_toml_builder;
use cargo_toml_builder::prelude::*;

let cargo_toml = CargoToml::new()
                    .name("my-project")
                    .author("Me <me@me.com>")
                    .build()?;
/*
[package]
name = "my-project"
version = "0.1.0"
authors = ["Me <me@me.com>"]

[dependencies]
*/

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.