pub struct CargoTomlContents {
pub path: PathBuf,
pub toml_value: Value,
pub prepend_auto_generated_comment: bool,
}
Expand description
Contains an in-memory representation of a Cargo.toml file.
Implementation notes:
- Currently contains a raw toml tree, but in principle it could also work with a cargo_toml::Manifest.
- It keeps an ordered representation, thanks to the
toml
preserve_order
feature.
Fields§
§path: PathBuf
§toml_value: Value
§prepend_auto_generated_comment: bool
Implementations§
Source§impl CargoTomlContents
impl CargoTomlContents
pub fn parse_string(raw_str: &str, path: &Path) -> Self
pub fn load_from_file<P: AsRef<Path>>(path: P) -> Self
pub fn new() -> Self
pub fn save_to_file<P: AsRef<Path>>(&self, path: P)
pub fn package_name(&self) -> String
pub fn package_edition(&self) -> String
Sourcepub fn dependency_raw_value(
&self,
crate_name: &str,
) -> Option<DependencyRawValue>
pub fn dependency_raw_value( &self, crate_name: &str, ) -> Option<DependencyRawValue>
Interprets the dependency value and organizes values in a struct.
pub fn insert_dependency_raw_value( &mut self, crate_name: &str, raw_value: DependencyRawValue, )
Sourcepub fn change_package_name(&mut self, new_package_name: String)
pub fn change_package_name(&mut self, new_package_name: String)
Assumes that a package section already exists.
pub fn dependencies_table(&self) -> Option<&Table>
pub fn dependency(&self, dep_name: &str) -> Option<&Value>
pub fn has_dependencies(&self) -> bool
pub fn dependencies_mut(&mut self) -> &mut Table
pub fn has_dev_dependencies(&self) -> bool
pub fn dev_dependencies_mut(&mut self) -> &mut Table
pub fn add_crate_type(&mut self, crate_type: &str)
pub fn add_package_info( &mut self, name: &String, version: String, current_edition: String, publish: bool, )
pub fn add_contract_variant_profile( &mut self, contract_profile: &ContractVariantProfile, )
pub fn add_workspace(&mut self, members: &[&str])
pub fn local_dependency_paths(&self, ignore_deps: &[&str]) -> Vec<String>
pub fn change_features_for_parent_crate_dep( &mut self, features: &[String], default_features: Option<bool>, )
pub fn to_string_pretty(&self) -> String
Trait Implementations§
Source§impl Clone for CargoTomlContents
impl Clone for CargoTomlContents
Source§fn clone(&self) -> CargoTomlContents
fn clone(&self) -> CargoTomlContents
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for CargoTomlContents
impl RefUnwindSafe for CargoTomlContents
impl Send for CargoTomlContents
impl Sync for CargoTomlContents
impl Unpin for CargoTomlContents
impl UnwindSafe for CargoTomlContents
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more