multiversx_sc_meta_lib::cargo_toml

Struct CargoTomlContents

Source
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

Source

pub fn parse_string(raw_str: &str, path: &Path) -> Self

Source

pub fn load_from_file<P: AsRef<Path>>(path: P) -> Self

Source

pub fn new() -> Self

Source

pub fn save_to_file<P: AsRef<Path>>(&self, path: P)

Source

pub fn package_name(&self) -> String

Source

pub fn package_edition(&self) -> String

Source

pub fn dependency_raw_value( &self, crate_name: &str, ) -> Option<DependencyRawValue>

Interprets the dependency value and organizes values in a struct.

Source

pub fn insert_dependency_raw_value( &mut self, crate_name: &str, raw_value: DependencyRawValue, )

Source

pub fn change_package_name(&mut self, new_package_name: String)

Assumes that a package section already exists.

Source

pub fn dependencies_table(&self) -> Option<&Table>

Source

pub fn dependency(&self, dep_name: &str) -> Option<&Value>

Source

pub fn has_dependencies(&self) -> bool

Source

pub fn dependencies_mut(&mut self) -> &mut Table

Source

pub fn has_dev_dependencies(&self) -> bool

Source

pub fn change_author(&mut self, authors: String) -> bool

Source

pub fn dev_dependencies_mut(&mut self) -> &mut Table

Source

pub fn add_crate_type(&mut self, crate_type: &str)

Source

pub fn add_package_info( &mut self, name: &String, version: String, current_edition: String, publish: bool, )

Source

pub fn add_contract_variant_profile( &mut self, contract_profile: &ContractVariantProfile, )

Source

pub fn add_workspace(&mut self, members: &[&str])

Source

pub fn local_dependency_paths(&self, ignore_deps: &[&str]) -> Vec<String>

Source

pub fn change_features_for_parent_crate_dep( &mut self, features: &[String], default_features: Option<bool>, )

Source

pub fn to_string_pretty(&self) -> String

Trait Implementations§

Source§

impl Clone for CargoTomlContents

Source§

fn clone(&self) -> CargoTomlContents

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CargoTomlContents

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.