Struct forc_pkg::manifest::PackageManifest
source · 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>>
A list of configuration-time constants.
build_target: Option<BTreeMap<String, BuildTarget>>
§contract_dependencies: Option<BTreeMap<String, ContractDependency>>
Implementations§
source§impl PackageManifest
impl PackageManifest
pub const DEFAULT_ENTRY_FILE_NAME: &'static str = "main.sw"
sourcepub fn from_file(path: &Path) -> Result<Self>
pub fn from_file(path: &Path) -> Result<Self>
Given a path to a Forc.toml
, read it and construct a PackageManifest
.
This also validate
s 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
.
sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate the PackageManifest
.
This checks the project and organization names against a set of reserved/restricted keywords and patterns.
sourcepub fn from_dir(dir: &Path) -> Result<Self>
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.
sourcepub fn deps(&self) -> impl Iterator<Item = (&String, &Dependency)>
pub fn deps(&self) -> impl Iterator<Item = (&String, &Dependency)>
Produce an iterator yielding all listed dependencies.
sourcepub fn build_profiles(&self) -> impl Iterator<Item = (&String, &BuildProfile)>
pub fn build_profiles(&self) -> impl Iterator<Item = (&String, &BuildProfile)>
Produce an iterator yielding all listed build profiles.
sourcepub fn contract_deps(
&self
) -> impl Iterator<Item = (&String, &ContractDependency)>
pub fn contract_deps(
&self
) -> impl Iterator<Item = (&String, &ContractDependency)>
Produce an iterator yielding all listed contract dependencies
sourcepub fn deps_detailed(
&self
) -> impl Iterator<Item = (&String, &DependencyDetails)>
pub fn deps_detailed(
&self
) -> impl Iterator<Item = (&String, &DependencyDetails)>
Produce an iterator yielding all Detailed
dependencies.
sourcepub fn patches(
&self
) -> impl Iterator<Item = (&String, &BTreeMap<String, Dependency>)>
pub fn patches(
&self
) -> impl Iterator<Item = (&String, &BTreeMap<String, Dependency>)>
Produce an iterator yielding all listed patches.
sourcepub fn dep(&self, dep_name: &str) -> Option<&Dependency>
pub fn dep(&self, dep_name: &str) -> Option<&Dependency>
Retrieve a reference to the dependency with the given name.
sourcepub fn dep_detailed(&self, dep_name: &str) -> Option<&DependencyDetails>
pub fn dep_detailed(&self, dep_name: &str) -> Option<&DependencyDetails>
Retrieve a reference to the dependency with the given name.
sourcepub fn patch(&self, patch_name: &str) -> Option<&BTreeMap<String, Dependency>>
pub fn patch(&self, patch_name: &str) -> Option<&BTreeMap<String, Dependency>>
Retrieve the listed patches for the given name.
sourcepub fn contract_dep(
&self,
contract_dep_name: &str
) -> Option<&ContractDependency>
pub fn contract_dep(
&self,
contract_dep_name: &str
) -> Option<&ContractDependency>
Retrieve a reference to the contract dependency with the given name.
sourcepub fn contract_dependency_detailed(
&self,
contract_dep_name: &str
) -> Option<&DependencyDetails>
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
impl Clone for PackageManifest
source§fn clone(&self) -> PackageManifest
fn clone(&self) -> PackageManifest
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more