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, sway_git_tag: &str) -> Result<Self>
pub fn from_file(path: PathBuf, sway_git_tag: &str) -> 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 sway_git_tag
is used to specify the pinned commit at which
we fetch std
.
sourcepub fn from_dir(manifest_dir: &Path, sway_git_tag: &str) -> Result<Self>
pub fn from_dir(manifest_dir: &Path, sway_git_tag: &str) -> 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 dir(&self) -> &Path
pub fn dir(&self) -> &Path
The path to the directory containing the Forc.toml
from which this manfiest was loaded.
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.
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_type: TreeType) -> Result<()>
pub fn check_program_type(&self, expected_type: TreeType) -> Result<()>
Given the current directory and expected program type, determines whether the correct program type is present.
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 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 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.
Trait Implementations
sourceimpl Debug for ManifestFile
impl Debug for ManifestFile
Auto Trait Implementations
impl RefUnwindSafe for ManifestFile
impl Send for ManifestFile
impl Sync for ManifestFile
impl Unpin for ManifestFile
impl UnwindSafe for ManifestFile
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more