pub struct PackageManifest {
    pub project: Project,
    pub network: Option<Network>,
    pub dependencies: Option<BTreeMap<String, Dependency>>,
    pub patch: Option<BTreeMap<String, BTreeMap<String, Dependency>>>,
    pub build_target: Option<BTreeMap<String, BuildTarget>>,
    pub contract_dependencies: Option<BTreeMap<String, ContractDependency>>,
    /* private fields */
}
Expand description

A direct mapping to a Forc.toml.

Fields§

§project: Project§network: Option<Network>§dependencies: Option<BTreeMap<String, Dependency>>§patch: Option<BTreeMap<String, BTreeMap<String, Dependency>>>§build_target: Option<BTreeMap<String, BuildTarget>>§contract_dependencies: Option<BTreeMap<String, ContractDependency>>

Implementations§

source§

impl PackageManifest

source

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

source

pub fn from_file(path: &Path) -> 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 validate(&self) -> Result<()>

Validate the PackageManifest.

This checks:

  1. The project and organization names against a set of reserved/restricted keywords and patterns.
  2. The validity of the details provided. Makes sure that there are no mismatching detail declarations (to prevent mixing details specific to certain types).
source

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

Given a directory to a forc project containing a Forc.toml, read the manifest.

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

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 PackageManifest

source§

fn clone(&self) -> PackageManifest

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 PackageManifest

source§

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

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

impl<'de> Deserialize<'de> for PackageManifest

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq<PackageManifest> for PackageManifest

source§

fn eq(&self, other: &PackageManifest) -> 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 Serialize for PackageManifest

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for PackageManifest

source§

impl StructuralEq for PackageManifest

source§

impl StructuralPartialEq for PackageManifest

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, 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, Global>) -> Rc<dyn Any, Global>

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, Global>) -> Arc<dyn Any + Sync + Send, Global>

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,