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 constants: Option<BTreeMap<String, ConfigTimeConstant>>,
    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>>>§constants: Option<BTreeMap<String, ConfigTimeConstant>>§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 the project and organization names against a set of reserved/restricted keywords and patterns.

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 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 patch(&self, patch_name: &str) -> Option<&BTreeMap<String, Dependency>>

Retrieve the listed patches for 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 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

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

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · 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>,

const: unstable · 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<'a, T> StorageAsMut for T

§

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

§

impl<'a, T> StorageAsRef for T

§

fn storage<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.
const: unstable · 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.
const: unstable · 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>,