pub struct PackageManifestFile { /* private fields */ }
Expand description

A PackageManifest that was deserialized from a file at a particular path.

Implementations§

source§

impl PackageManifestFile

source

pub fn from_file(path: PathBuf) -> Result<Self>

Given a path to a Forc.toml, read it and construct a PackageManifest.

This also validates the manifest, returning an Err in the case that invalid names, fields were used.

If core and std are unspecified, std will be added to the dependencies table implicitly. In this case, the git tag associated with the version of this crate is used to specify the pinned commit at which we fetch std.

source

pub fn resolve_patches( &self ) -> Result<impl Iterator<Item = (String, BTreeMap<String, Dependency>)>>

Returns an iterator over patches defined in underlying PackageManifest if this is a standalone package.

If this package is a member of a workspace, patches are fetched from the workspace manifest file.

source

pub fn resolve_patch( &self, patch_name: &str ) -> Result<Option<BTreeMap<String, Dependency>>>

Retrieve the listed patches for the given name from underlying PackageManifest if this is a standalone package.

If this package is a member of a workspace, patch is fetched from the workspace manifest file.

source

pub fn from_dir(manifest_dir: &Path) -> Result<Self>

Read the manifest from the Forc.toml in the directory specified by the given path or any of its parent directories.

This is short for PackageManifest::from_file, but takes care of constructing the path to the file.

source

pub fn validate(&self) -> Result<()>

Validate the PackageManifestFile.

This checks:

  1. Validity of the underlying PackageManifest.
  2. Existence of the entry file.
source

pub fn path(&self) -> &Path

The path to the Forc.toml from which this manifest was loaded.

This will always be a canonical path.

source

pub fn dir(&self) -> &Path

The path to the directory containing the Forc.toml from which this manfiest was loaded.

This will always be a canonical path.

source

pub fn entry_path(&self) -> PathBuf

Given the directory in which the file associated with this PackageManifest resides, produce the path to the entry file as specified in the manifest.

This will always be a canonical path.

source

pub fn entry_string(&self) -> Result<Arc<str>>

Produces the string of the entry point file.

source

pub fn program_type(&self) -> Result<TreeType>

Parse and return the associated project’s program type.

source

pub fn check_program_type(&self, expected_types: Vec<TreeType>) -> Result<()>

Given the current directory and expected program type, determines whether the correct program type is present.

source

pub fn build_profile(&self, profile_name: &str) -> Option<&BuildProfile>

Access the build profile associated with the given profile name.

source

pub fn dep_path(&self, dep_name: &str) -> Option<PathBuf>

Given the name of a path dependency, returns the full canonical Path to the dependency.

source

pub fn workspace(&self) -> Result<Option<WorkspaceManifestFile>>

Returns the workspace manifest file if this PackageManifestFile is one of the members.

source

pub fn lock_path(&self) -> Result<PathBuf>

Returns the location of the lock file for PackageManifestFile. Checks if this PackageManifestFile corresponds to a workspace member and if that is the case returns the workspace level lock file’s location.

This will always be a canonical path.

source

pub fn project_name(&self) -> &str

Returns an immutable reference to the project name that this manifest file describes.

Methods from Deref<Target = PackageManifest>§

source

pub const DEFAULT_ENTRY_FILE_NAME: &'static str = "main.sw"

source

pub fn validate(&self) -> Result<()>

Validate the PackageManifest.

This checks the project and organization names against a set of reserved/restricted keywords and patterns.

source

pub fn deps(&self) -> impl Iterator<Item = (&String, &Dependency)>

Produce an iterator yielding all listed dependencies.

source

pub fn build_profiles(&self) -> impl Iterator<Item = (&String, &BuildProfile)>

Produce an iterator yielding all listed build profiles.

source

pub fn contract_deps( &self ) -> impl Iterator<Item = (&String, &ContractDependency)>

Produce an iterator yielding all listed contract dependencies

source

pub fn deps_detailed( &self ) -> impl Iterator<Item = (&String, &DependencyDetails)>

Produce an iterator yielding all Detailed dependencies.

source

pub fn patches( &self ) -> impl Iterator<Item = (&String, &BTreeMap<String, Dependency>)>

Produce an iterator yielding all listed patches.

source

pub fn patch(&self, patch_name: &str) -> Option<&BTreeMap<String, Dependency>>

Retrieve the listed patches for the given name.

source

pub fn dep(&self, dep_name: &str) -> Option<&Dependency>

Retrieve a reference to the dependency with the given name.

source

pub fn dep_detailed(&self, dep_name: &str) -> Option<&DependencyDetails>

Retrieve a reference to the dependency with the given name.

source

pub fn contract_dep( &self, contract_dep_name: &str ) -> Option<&ContractDependency>

Retrieve a reference to the contract dependency with the given name.

source

pub fn contract_dependency_detailed( &self, contract_dep_name: &str ) -> Option<&DependencyDetails>

Retrieve a reference to the contract dependency with the given name.

Trait Implementations§

source§

impl Clone for PackageManifestFile

source§

fn clone(&self) -> PackageManifestFile

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 PackageManifestFile

source§

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

Formats the value using the given formatter. Read more
source§

impl Deref for PackageManifestFile

§

type Target = PackageManifest

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl PartialEq<PackageManifestFile> for PackageManifestFile

source§

fn eq(&self, other: &PackageManifestFile) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for PackageManifestFile

source§

impl StructuralEq for PackageManifestFile

source§

impl StructuralPartialEq for PackageManifestFile

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyDebug for Twhere T: Any + Debug,

§

fn as_any_ref(&self) -> &(dyn Any + 'static)

Returns a reference to the underlying type as Any.
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send + 'static>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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 Twhere 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> Same<T> for T

§

type Output = T

Should always be Self
§

impl<T> StorageAsMut for T

§

fn storage<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,

§

fn storage_as_mut<Type>(&mut self) -> StorageMut<'_, Self, Type>where Type: Mappable,

§

impl<T> StorageAsRef for T

§

fn storage<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,

§

fn storage_as_ref<Type>(&self) -> StorageRef<'_, Self, Type>where Type: Mappable,

source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

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