Struct cargo_edit::Manifest
[−]
[src]
pub struct Manifest { pub data: Document, }
A Cargo Manifest
Fields
data: Document
Manifest contents as TOML data
Methods
impl Manifest
[src]
fn find_file(path: &Option<PathBuf>) -> Result<File>
[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.
fn open(path: &Option<PathBuf>) -> Result<Manifest>
[src]
Open the Cargo.toml
for a path (or the process' cwd
)
fn get_table<'a>(&'a mut self, table_path: &[String]) -> Result<&'a mut Item>
[src]
Get the specified table from the manifest.
fn get_sections(&self) -> Vec<(Vec<String>, Item)>
[src]
Get all sections in the manifest that exist and might contain dependencies.
The returned items are always Table
or InlineTable
.
fn write_to_file(&self, file: &mut File) -> Result<()>
[src]
Overwrite a file with TOML data.
fn insert_into_table(
&mut self,
table_path: &[String],
dep: &Dependency
) -> Result<()>
[src]
&mut self,
table_path: &[String],
dep: &Dependency
) -> Result<()>
Add entry to a Cargo.toml.
fn update_table_entry(
&mut self,
table_path: &[String],
dep: &Dependency
) -> Result<()>
[src]
&mut self,
table_path: &[String],
dep: &Dependency
) -> Result<()>
Update an entry in Cargo.toml.
fn remove_from_table(&mut self, table: &str, name: &str) -> Result<()>
[src]
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());
fn add_deps(&mut self, table: &[String], deps: &[Dependency]) -> Result<()>
[src]
Add multiple dependencies to manifest
Trait Implementations
impl Debug for Manifest
[src]
impl Clone for Manifest
[src]
fn clone(&self) -> Manifest
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more