Struct App
pub struct App { /* private fields */ }
Expand description
An App
holds loaded configuration for a Spin application.
Implementations§
§impl App
impl App
pub fn new(id: impl Into<String>, locked: LockedApp) -> App
pub fn new(id: impl Into<String>, locked: LockedApp) -> App
Returns a new app for the given runtime-specific identifier and locked app.
pub fn get_metadata<'this, T>(
&'this self,
key: MetadataKey<T>,
) -> Result<Option<T>, Error>where
T: Deserialize<'this>,
pub fn get_metadata<'this, T>(
&'this self,
key: MetadataKey<T>,
) -> Result<Option<T>, Error>where
T: Deserialize<'this>,
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.
pub fn require_metadata<'this, T>(
&'this self,
key: MetadataKey<T>,
) -> Result<T, Error>where
T: Deserialize<'this>,
pub fn require_metadata<'this, T>(
&'this self,
key: MetadataKey<T>,
) -> Result<T, Error>where
T: Deserialize<'this>,
Deserializes typed metadata for this app.
Like App::get_metadata
, but returns an error if there is
no metadata for the given key
.
pub 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.
pub 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.
pub 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.
pub 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.
pub fn get_trigger_metadata<'this, T>(
&'this self,
trigger_type: &str,
) -> Result<Option<T>, Error>where
T: Deserialize<'this>,
pub fn get_trigger_metadata<'this, T>(
&'this self,
trigger_type: &str,
) -> Result<Option<T>, Error>where
T: Deserialize<'this>,
Returns the trigger metadata for a specific trigger type.
pub fn triggers_with_type<'a>(
&'a self,
trigger_type: &'a str,
) -> impl Iterator<Item = AppTrigger<'a>>
pub fn triggers_with_type<'a>( &'a self, trigger_type: &'a str, ) -> impl Iterator<Item = AppTrigger<'a>>
Returns an iterator of [AppTrigger
]s defined for this app with
the given trigger_type
.
pub fn trigger_configs<'a, T>(
&'a self,
trigger_type: &'a str,
) -> Result<impl IntoIterator<Item = (&'a str, T)>, Error>where
T: Deserialize<'a>,
pub fn trigger_configs<'a, T>(
&'a self,
trigger_type: &'a str,
) -> Result<impl IntoIterator<Item = (&'a str, T)>, Error>where
T: Deserialize<'a>,
Returns an iterator of trigger IDs and deserialized trigger configs for
the given trigger_type
.
pub fn ensure_needs_only(&self, supported: &[&str]) -> Result<(), String>
pub fn ensure_needs_only(&self, supported: &[&str]) -> Result<(), String>
Checks that the application does not have any host requirements outside the supported set. The error case returns a comma-separated list of unmet requirements.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for App
impl RefUnwindSafe for App
impl Send for App
impl Sync for App
impl Unpin for App
impl UnwindSafe for App
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§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.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self
file descriptor. Read moreSource§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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request