pub struct App<'a, L = AppLoader> { /* private fields */ }
Expand description
An App
holds loaded configuration for a Spin application.
Note: The L
param is an implementation detail to support the
App::inert
constructor.
Implementations§
source§impl<'a, L> App<'a, L>
impl<'a, L> App<'a, L>
sourcepub fn get_metadata<'this, T: Deserialize<'this>>(
&'this self,
key: MetadataKey<T>
) -> Result<Option<T>>
pub fn get_metadata<'this, T: Deserialize<'this>>( &'this self, key: MetadataKey<T> ) -> 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: MetadataKey<T>
) -> Result<T>
pub fn require_metadata<'this, T: Deserialize<'this>>( &'this self, key: MetadataKey<T> ) -> 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<'_, L>>
pub fn components(&self) -> impl Iterator<Item = AppComponent<'_, L>>
Returns an iterator of AppComponent
s defined for this app.
sourcepub fn get_component(&self, component_id: &str) -> Option<AppComponent<'_, L>>
pub fn get_component(&self, component_id: &str) -> Option<AppComponent<'_, L>>
Returns the AppComponent
with the given component_id
, or None
if it doesn’t exist.
sourcepub fn triggers(&self) -> impl Iterator<Item = AppTrigger<'_, L>>
pub fn triggers(&self) -> impl Iterator<Item = AppTrigger<'_, L>>
Returns an iterator of AppTrigger
s defined for this app.
sourcepub fn get_trigger_metadata<'this, T: Deserialize<'this> + Default>(
&'this self,
trigger_type: &'a str
) -> Result<Option<T>>
pub fn get_trigger_metadata<'this, T: Deserialize<'this> + Default>( &'this self, trigger_type: &'a str ) -> Result<Option<T>>
Returns the trigger metadata for a specific trigger type.
sourcepub fn triggers_with_type(
&'a self,
trigger_type: &'a str
) -> impl Iterator<Item = AppTrigger<'_, L>>
pub fn triggers_with_type( &'a self, trigger_type: &'a str ) -> impl Iterator<Item = AppTrigger<'_, L>>
Returns an iterator of AppTrigger
s defined for this app with
the given trigger_type
.
Trait Implementations§
Auto Trait Implementations§
impl<'a, L> RefUnwindSafe for App<'a, L>where
L: RefUnwindSafe,
impl<'a, L> Send for App<'a, L>where
L: Sync,
impl<'a, L> Sync for App<'a, L>where
L: Sync,
impl<'a, L> Unpin for App<'a, L>
impl<'a, L> UnwindSafe for App<'a, L>where
L: RefUnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§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,
self
file descriptor.