Manifest

Struct Manifest 

Source
pub struct Manifest { /* private fields */ }
Expand description

Create, amend and save a copy of the specified Cargo.toml.

Implementations§

Source§

impl Manifest

Source

pub fn new(manifest_path: ManifestPath) -> Result<Manifest>

Create new Manifest for the given manifest path.

The path must be to a Cargo.toml.

Source

pub fn with_replaced_lib_to_bin(&mut self) -> Result<&mut Self>

Replaces the [lib] target by a single [bin] target using the same file and name.

Source

pub fn with_added_crate_type(&mut self, crate_type: &str) -> Result<&mut Self>

Add a value to the [lib] crate-types = [] section.

If the value already exists, does nothing.

Source

pub fn profile_optimization_passes(&mut self) -> Option<OptimizationPasses>

Extract optimization-passes from [package.metadata.contract]

Source

pub fn with_profile_release_defaults( &mut self, defaults: Profile, ) -> Result<&mut Self>

Set preferred defaults for the [profile.release] section

§Note

Existing user defined settings for this section are preserved. Only if a setting is not defined is the preferred default set.

Source

pub fn with_empty_workspace(&mut self) -> &mut Self

Set [workspace] section to an empty table. When building a contract project any workspace members are not copied to the temporary workspace, so need to be removed.

Additionally, where no workspace is already specified, this can in some cases reduce the size of the contract.

Source

pub fn with_removed_crate_type(&mut self, crate_type: &str) -> Result<&mut Self>

Remove a value from the [lib] crate-types = [] section

If the value does not exist, does nothing.

Source

pub fn with_metadata_package(&mut self) -> Result<&mut Self>

Adds a metadata package to the manifest workspace for generating metadata

Source

pub fn with_dylint(&mut self) -> Result<&mut Self>

Source

pub fn with_merged_workspace_dependencies( &mut self, crate_metadata: &CrateMetadata, ) -> Result<&mut Self>

Merge the workspace dependencies with the crate dependencies.

Source

pub fn rewrite_relative_paths(&mut self) -> Result<()>

Replace relative paths with absolute paths with the working directory.

Enables the use of a temporary amended copy of the manifest.

§Rewrites
  • [lib]/path
  • [dependencies]
Source

pub fn write(&self, manifest_path: &ManifestPath) -> Result<()>

Writes the amended manifest to the given path.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,