Struct cargo_edit::Manifest[][src]

pub struct Manifest {
    pub data: Document,
}

A Cargo manifest

Fields

Manifest contents as TOML data

Methods

impl Manifest
[src]

Look for a Cargo.toml file

Starts at the given path an goes into its parent directories until the manifest file is found. If no path is given, the process's working directory is used as a starting point.

Open the Cargo.toml for a path (or the process' cwd)

Get the specified table from the manifest.

Get all sections in the manifest that exist and might contain dependencies. The returned items are always Table or InlineTable.

Overwrite a file with TOML data.

Add entry to a Cargo.toml.

Update an entry in Cargo.toml.

Remove entry from a Cargo.toml.

Examples

    use cargo_edit::{Dependency, Manifest};
    use toml_edit;

    let mut manifest = Manifest { data: toml_edit::Document::new() };
    let dep = Dependency::new("cargo-edit").set_version("0.1.0");
    let _ = manifest.insert_into_table(&vec!["dependencies".to_owned()], &dep);
    assert!(manifest.remove_from_table("dependencies", &dep.name).is_ok());
    assert!(manifest.remove_from_table("dependencies", &dep.name).is_err());
    assert!(manifest.data["dependencies"].is_none());

Add multiple dependencies to manifest

Trait Implementations

impl Debug for Manifest
[src]

Formats the value using the given formatter. Read more

impl Clone for Manifest
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl FromStr for Manifest
[src]

The associated error which can be returned from parsing.

Read manifest data from string

Auto Trait Implementations

impl Send for Manifest

impl Sync for Manifest