pub struct Manifest {
pub project: Project,
pub network: Option<Network>,
pub dependencies: Option<BTreeMap<String, Dependency>>,
pub build_profile: Option<BTreeMap<String, BuildConfig>>,
}
Expand description
A direct mapping to a Forc.toml
.
Fields
project: Project
network: Option<Network>
dependencies: Option<BTreeMap<String, Dependency>>
build_profile: Option<BTreeMap<String, BuildConfig>>
Implementations
sourceimpl Manifest
impl Manifest
pub const DEFAULT_ENTRY_FILE_NAME: &'static str = "main.sw"
sourcepub fn from_file(path: &Path, sway_git_tag: &str) -> Result<Self>
pub fn from_file(path: &Path, 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 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 from_dir(dir: &Path, sway_git_tag: &str) -> Result<Self>
pub fn from_dir(dir: &Path, sway_git_tag: &str) -> Result<Self>
Given a directory to a forc project containing a Forc.toml
, read the manifest.
This is short for Manifest::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, &BuildConfig)>
pub fn build_profiles(&self) -> impl Iterator<Item = (&String, &BuildConfig)>
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 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<'de> Deserialize<'de> for Manifest
impl<'de> Deserialize<'de> for Manifest
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Manifest
impl Send for Manifest
impl Sync for Manifest
impl Unpin for Manifest
impl UnwindSafe for Manifest
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