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 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.
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
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
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
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more