Struct LockedApp
pub struct LockedApp {
pub spin_lock_version: FixedVersionBackwardCompatible<1>,
pub must_understand: Vec<MustUnderstand>,
pub metadata: Map<String, Value>,
pub host_requirements: Map<String, Value>,
pub variables: BTreeMap<String, Variable>,
pub triggers: Vec<LockedTrigger>,
pub components: Vec<LockedComponent>,
}
Expand description
A LockedApp represents a “fully resolved” Spin application.
Fields§
§spin_lock_version: FixedVersionBackwardCompatible<1>
Locked schema version
must_understand: Vec<MustUnderstand>
Identifies fields in the LockedApp that the host must process if present.
metadata: Map<String, Value>
Application metadata
host_requirements: Map<String, Value>
Host requirements
variables: BTreeMap<String, Variable>
Custom config variables
triggers: Vec<LockedTrigger>
Application triggers
components: Vec<LockedComponent>
Application components
Implementations§
§impl LockedApp
impl LockedApp
pub fn from_json(contents: &[u8]) -> Result<LockedApp, Error>
pub fn from_json(contents: &[u8]) -> Result<LockedApp, Error>
Deserializes a LockedApp
from the given JSON data.
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 LockedApp::get_metadata
, but returns an error if there is
no metadata for the given key
.
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§
§impl<'de> Deserialize<'de> for LockedApp
impl<'de> Deserialize<'de> for LockedApp
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LockedApp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LockedApp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for LockedApp
impl Serialize for LockedApp
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Auto Trait Implementations§
impl Freeze for LockedApp
impl RefUnwindSafe for LockedApp
impl Send for LockedApp
impl Sync for LockedApp
impl Unpin for LockedApp
impl UnwindSafe for LockedApp
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> 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 more