Struct forc_pkg::manifest::PackageManifestFile
source · pub struct PackageManifestFile { /* private fields */ }
Expand description
A PackageManifest that was deserialized from a file at a particular path.
Implementations§
source§impl PackageManifestFile
impl PackageManifestFile
sourcepub fn from_file(path: PathBuf) -> Result<Self>
pub fn from_file(path: PathBuf) -> 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 from_dir(manifest_dir: &Path) -> Result<Self>
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.
sourcepub fn validate(&self, path: &Path) -> Result<()>
pub fn validate(&self, path: &Path) -> Result<()>
Validate the PackageManifest
.
This checks the project and organization names against a set of reserved/restricted keywords and patterns, and if a given entry point exists.
sourcepub fn path(&self) -> &Path
pub fn path(&self) -> &Path
The path to the Forc.toml
from which this manifest was loaded.
This will always be a canonical path.
sourcepub fn dir(&self) -> &Path
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.
sourcepub fn entry_path(&self) -> PathBuf
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.
sourcepub fn entry_string(&self) -> Result<Arc<str>>
pub fn entry_string(&self) -> Result<Arc<str>>
Produces the string of the entry point file.
sourcepub fn program_type(&self) -> Result<TreeType>
pub fn program_type(&self) -> Result<TreeType>
Parse and return the associated project’s program type.
sourcepub fn check_program_type(&self, expected_types: Vec<TreeType>) -> Result<()>
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.
sourcepub fn build_profile(&self, profile_name: &str) -> Option<&BuildProfile>
pub fn build_profile(&self, profile_name: &str) -> Option<&BuildProfile>
Access the build profile associated with the given profile name.
sourcepub fn dep_path(&self, dep_name: &str) -> Option<PathBuf>
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.
sourcepub fn config_time_constants(&self) -> BTreeMap<String, ConfigTimeConstant>
pub fn config_time_constants(&self) -> BTreeMap<String, ConfigTimeConstant>
Getter for the config time constants on the manifest.
sourcepub fn workspace(&self) -> Result<Option<WorkspaceManifestFile>>
pub fn workspace(&self) -> Result<Option<WorkspaceManifestFile>>
Returns the workspace manifest file if this PackageManifestFile
is one of the members.
Methods from Deref<Target = PackageManifest>§
pub const DEFAULT_ENTRY_FILE_NAME: &'static str = "main.sw"
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 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 PackageManifestFile
impl Clone for PackageManifestFile
source§fn clone(&self) -> PackageManifestFile
fn clone(&self) -> PackageManifestFile
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more