pub struct AppComponent<'a> {
pub app: &'a App,
pub locked: &'a LockedComponent,
}
Expand description
An AppComponent
holds configuration for a Spin application component.
Fields§
§app: &'a App
The app this component belongs to.
locked: &'a LockedComponent
The locked component.
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 component or module source.
Sourcepub fn environment(&self) -> impl IntoIterator<Item = (&str, &str)>
pub fn environment(&self) -> impl IntoIterator<Item = (&str, &str)>
Returns an iterator of environment variable (key, value) pairs.
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: MetadataKey<T>,
) -> Result<Option<T>>
pub fn get_metadata<T: Deserialize<'a>>( &self, key: MetadataKey<T>, ) -> 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: MetadataKey<T>,
) -> Result<T>
pub fn require_metadata<'this, T: Deserialize<'this>>( &'this self, key: MetadataKey<T>, ) -> 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
.
Auto Trait Implementations§
impl<'a> Freeze for AppComponent<'a>
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§
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more