Struct spin_app::AppComponent
source · pub struct AppComponent<'a> {
pub app: &'a App<'a>,
/* private fields */
}
Expand description
An AppComponent
holds configuration for a Spin application component.
Fields§
§app: &'a App<'a>
The app this component belongs to.
Implementations§
source§impl<'a> AppComponent<'a>
impl<'a> AppComponent<'a>
sourcepub fn source(&self) -> &LockedComponentSource
pub fn source(&self) -> &LockedComponentSource
Returns this component’s Wasm module source.
sourcepub fn files(&self) -> Iter<'_, ContentPath>
pub fn files(&self) -> Iter<'_, ContentPath>
Returns an iterator of ContentPath
s for this component’s configured
“directory mounts”.
sourcepub fn get_metadata<T: Deserialize<'a>>(&self, key: &str) -> Result<Option<T>>
pub fn get_metadata<T: Deserialize<'a>>(&self, key: &str) -> Result<Option<T>>
Deserializes typed metadata for this component.
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 component.
Like AppComponent::get_metadata
, but returns an error if there is
no metadata for the given key
.
sourcepub fn config(&self) -> impl Iterator<Item = (&String, &String)>
pub fn config(&self) -> impl Iterator<Item = (&String, &String)>
Returns an iterator of custom config values for this component.
sourcepub async fn load_module<T: Send + Sync>(
&self,
engine: &Engine<T>
) -> Result<Module>
pub async fn load_module<T: Send + Sync>(
&self,
engine: &Engine<T>
) -> Result<Module>
Loads and returns the [spin_core::Module
] for this component.
sourcepub async fn apply_store_config(&self, builder: &mut StoreBuilder) -> Result<()>
pub async fn apply_store_config(&self, builder: &mut StoreBuilder) -> Result<()>
Updates the given StoreBuilder
with configuration for this component.
In particular, the WASI ‘env’ and “preloaded dirs” are set up, and any
DynamicHostComponent
s associated with the source AppLoader
are
configured.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for AppComponent<'a>
impl<'a> Send for AppComponent<'a>
impl<'a> Sync for AppComponent<'a>
impl<'a> Unpin for AppComponent<'a>
impl<'a> !UnwindSafe for AppComponent<'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,
self
file descriptor.