pub struct Manifest { /* private fields */ }Expand description
Create, amend and save a copy of the specified Cargo.toml.
Implementations§
Source§impl Manifest
impl Manifest
Sourcepub fn new(manifest_path: ManifestPath) -> Result<Manifest>
pub fn new(manifest_path: ManifestPath) -> Result<Manifest>
Create new Manifest for the given manifest path.
The path must be to a Cargo.toml.
Sourcepub fn with_replaced_lib_to_bin(&mut self) -> Result<&mut Self>
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.
Sourcepub fn with_added_crate_type(&mut self, crate_type: &str) -> Result<&mut Self>
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.
Sourcepub fn profile_optimization_passes(&mut self) -> Option<OptimizationPasses>
pub fn profile_optimization_passes(&mut self) -> Option<OptimizationPasses>
Extract optimization-passes from [package.metadata.contract]
Sourcepub fn with_profile_release_defaults(
&mut self,
defaults: Profile,
) -> Result<&mut Self>
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.
Sourcepub fn with_empty_workspace(&mut self) -> &mut Self
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.
Sourcepub fn with_removed_crate_type(&mut self, crate_type: &str) -> Result<&mut Self>
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.
Sourcepub fn with_metadata_package(&mut self) -> Result<&mut Self>
pub fn with_metadata_package(&mut self) -> Result<&mut Self>
Adds a metadata package to the manifest workspace for generating metadata
pub fn with_dylint(&mut self) -> Result<&mut Self>
Sourcepub fn with_merged_workspace_dependencies(
&mut self,
crate_metadata: &CrateMetadata,
) -> Result<&mut Self>
pub fn with_merged_workspace_dependencies( &mut self, crate_metadata: &CrateMetadata, ) -> Result<&mut Self>
Merge the workspace dependencies with the crate dependencies.
Sourcepub fn rewrite_relative_paths(&mut self) -> Result<()>
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]
Sourcepub fn write(&self, manifest_path: &ManifestPath) -> Result<()>
pub fn write(&self, manifest_path: &ManifestPath) -> Result<()>
Writes the amended manifest to the given path.
Auto Trait Implementations§
impl Freeze for Manifest
impl RefUnwindSafe for Manifest
impl Send for Manifest
impl Sync for Manifest
impl Unpin for Manifest
impl UnwindSafe for Manifest
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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