Skip to main content

MetadataExt

Trait MetadataExt 

Source
pub trait MetadataExt {
    // Required method
    fn get_value(&self, key: &str) -> Option<&Value>;

    // Provided methods
    fn get_typed<'a, T: Deserialize<'a>>(
        &'a self,
        key: MetadataKey<T>,
    ) -> Result<Option<T>> { ... }
    fn require_typed<'a, T: Deserialize<'a>>(
        &'a self,
        key: MetadataKey<T>,
    ) -> Result<T> { ... }
}
Expand description

Helper functions for reading LockedApp metadata

Required Methods§

Source

fn get_value(&self, key: &str) -> Option<&Value>

Get a value from a metadata map

Provided Methods§

Source

fn get_typed<'a, T: Deserialize<'a>>( &'a self, key: MetadataKey<T>, ) -> Result<Option<T>>

Get a typed value from a metadata map

Source

fn require_typed<'a, T: Deserialize<'a>>( &'a self, key: MetadataKey<T>, ) -> Result<T>

Get a required value from a metadata map, returning an error if it is not present

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§