[−][src]Struct cargo_edit::Manifest
A Cargo manifest
Fields
data: Document
Manifest contents as TOML data
Implementations
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 update_table_named_entry(
&mut self,
table_path: &[String],
item_name: &str,
dep: &Dependency,
dry_run: bool
) -> Result<()>
[src]
&mut self,
table_path: &[String],
item_name: &str,
dep: &Dependency,
dry_run: bool
) -> Result<()>
Update an entry with a specified name 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
pub fn find_dep<'a>(
table: &'a mut Item,
dep_name: &'a str
) -> Option<(String, &'a Item)>
[src]
table: &'a mut Item,
dep_name: &'a str
) -> Option<(String, &'a Item)>
Find a dependency by name (matching on package name for renamed deps)
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Manifest
impl Send for Manifest
impl Sync for Manifest
impl Unpin for Manifest
impl UnwindSafe for Manifest
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> 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>,