Struct cargo_edit::Manifest [] [src]

pub struct Manifest {
    pub data: Table,
}

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.

Look for a Cargo.lock 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' working directory is used as a starting point.

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

Open the Cargo.lock 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.

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;

    let mut manifest = Manifest { data: toml::value::Table::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.is_empty());

Add multiple dependencies to manifest

Trait Implementations

impl Debug for Manifest
[src]

Formats the value using the given formatter.

impl Clone for Manifest
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Manifest
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl FromStr for Manifest
[src]

The associated error which can be returned from parsing.

Read manifest data from string