[−][src]Struct cargo_edit::Manifest
A Cargo manifest
Fields
data: Document
Manifest contents as TOML data
Methods
impl Manifest
[src]
pub 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.
pub fn open(path: &Option<PathBuf>) -> Result<Manifest>
[src]
Open the Cargo.toml
for a path (or the process' cwd
)
pub fn get_table<'a>(
&'a mut self,
table_path: &[String]
) -> Result<&'a mut Item>
[src]
&'a mut self,
table_path: &[String]
) -> Result<&'a mut Item>
Get the specified table from the manifest.
pub 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
.
pub fn write_to_file(&self, file: &mut File) -> Result<()>
[src]
Overwrite a file with TOML data.
pub 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.
pub fn update_table_entry(
&mut self,
table_path: &[String],
dep: &Dependency,
dry_run: bool
) -> Result<()>
[src]
&mut self,
table_path: &[String],
dep: &Dependency,
dry_run: bool
) -> Result<()>
Update an entry in Cargo.toml.
pub 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());
pub fn add_deps(&mut self, table: &[String], deps: &[Dependency]) -> Result<()>
[src]
Add multiple dependencies to manifest
Trait Implementations
impl Clone for Manifest
[src]
fn clone(&self) -> Manifest
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Manifest
[src]
impl FromStr for Manifest
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Erased for T
impl<'a, T> TryFrom<&'a str> for T where
T: FromStr,
T: FromStr,
type Err = <T as FromStr>::Err
fn try_from(string: &'a str) -> Result<T, <T as TryFrom<&'a str>>::Err>
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,