pub struct App<'a> { /* private fields */ }
Expand description
An App
holds loaded configuration for a Spin application.
Implementations§
source§impl<'a> App<'a>
impl<'a> App<'a>
sourcepub fn get_metadata<'this, T: Deserialize<'this>>(
&'this self,
key: &str
) -> Result<Option<T>>
pub fn get_metadata<'this, T: Deserialize<'this>>(
&'this self,
key: &str
) -> Result<Option<T>>
Deserializes typed metadata for this app.
Returns Ok(None)
if there is no metadata for the given key
and an
Err
only if there is a value for the key
but the typed
deserialization failed.
sourcepub fn require_metadata<'this, T: Deserialize<'this>>(
&'this self,
key: &str
) -> Result<T>
pub fn require_metadata<'this, T: Deserialize<'this>>(
&'this self,
key: &str
) -> Result<T>
Deserializes typed metadata for this app.
Like App::get_metadata
, but returns an error if there is
no metadata for the given key
.
sourcepub fn variables(&self) -> impl Iterator<Item = (&String, &Variable)>
pub fn variables(&self) -> impl Iterator<Item = (&String, &Variable)>
Returns an iterator of custom config Variable
s defined for this app.
sourcepub fn components(&self) -> impl Iterator<Item = AppComponent<'_>>
pub fn components(&self) -> impl Iterator<Item = AppComponent<'_>>
Returns an iterator of AppComponent
s defined for this app.
sourcepub fn get_component(&self, component_id: &str) -> Option<AppComponent<'_>>
pub fn get_component(&self, component_id: &str) -> Option<AppComponent<'_>>
Returns the AppComponent
with the given component_id
, or None
if it doesn’t exist.
sourcepub fn triggers(&self) -> impl Iterator<Item = AppTrigger<'_>>
pub fn triggers(&self) -> impl Iterator<Item = AppTrigger<'_>>
Returns an iterator of AppTrigger
s defined for this app.
sourcepub fn triggers_with_type(
&'a self,
trigger_type: &'a str
) -> impl Iterator<Item = AppTrigger<'_>>
pub fn triggers_with_type(
&'a self,
trigger_type: &'a str
) -> impl Iterator<Item = AppTrigger<'_>>
Returns an iterator of AppTrigger
s defined for this app with
the given trigger_type
.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for App<'a>
impl<'a> Send for App<'a>
impl<'a> Sync for App<'a>
impl<'a> Unpin for App<'a>
impl<'a> !UnwindSafe for App<'a>
Blanket Implementations§
§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self
file descriptor.