Struct forc_pkg::manifest::ManifestFile
source · [−]pub struct ManifestFile { /* private fields */ }
Expand description
A Manifest that was deserialized from a file at a particular path.
Implementations
sourceimpl ManifestFile
impl ManifestFile
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 Manifest
.
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 Manifest::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 Manifest
.
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 Manifest
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.
Methods from Deref<Target = Manifest>
pub const DEFAULT_ENTRY_FILE_NAME: &'static str = "main.sw"
sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate the Manifest
.
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 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.
Trait Implementations
sourceimpl Clone for ManifestFile
impl Clone for ManifestFile
sourcefn clone(&self) -> ManifestFile
fn clone(&self) -> ManifestFile
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more