oci_wasm

Struct WasmConfig

source
pub struct WasmConfig {
    pub created: DateTime<Utc>,
    pub author: Option<String>,
    pub architecture: String,
    pub os: String,
    pub layer_digests: Vec<String>,
    pub component: Option<Component>,
}
Expand description

The config type struct for application/wasm

Fields§

§created: DateTime<Utc>

The time when the config was created.

§author: Option<String>

The optional name of the author of the config.

§architecture: String

The architecture of the artifact. This is always wasm.

§os: String

The OS name of the artifact. Possible options: wasip1, wasip2. For plain wasm, this should be wasip1 as this must match a GOOS value and it doesn’t have one for plain Wasm

Eventually this will go away when we hit a 1.0 but we need it for now

§layer_digests: Vec<String>

This field contains a list of digests of each of the layers from the manifest in the same order as they are listed in the manfiest. This exists because we need to have a unique list here so that the hash of the config (used as the ID) is unique every time (https://github.com/opencontainers/image-spec/pull/1173)

§component: Option<Component>

Information about the component in the manifest. This is required when the os field is wasip2

Implementations§

source§

impl WasmConfig

source

pub async fn from_component( path: impl AsRef<Path>, author: Option<String>, ) -> Result<(Self, ImageLayer)>

A helper for loading a component from a file and returning the proper config and ImageLayer. The returned config will have the created time set to now and all other fields set for a component.

source

pub fn from_raw_component( raw: Vec<u8>, author: Option<String>, ) -> Result<(Self, ImageLayer)>

Same as WasmConfig::from_component but for raw component bytes

source

pub async fn from_module( path: impl AsRef<Path>, author: Option<String>, ) -> Result<(Self, ImageLayer)>

A helper for loading a plain wasm module and returning the proper config and ImageLayer. The returned config will have the created time set to now and all other fields set for a plain wasm module.

source

pub fn from_raw_module( raw: Vec<u8>, author: Option<String>, ) -> Result<(Self, ImageLayer)>

Same as WasmConfig::from_module but for raw module bytes

source

pub fn with_annotations( &self, annotations: BTreeMap<String, String>, ) -> AnnotatedWasmConfig<'_>

Adds annotations to this WasmConfig.

Trait Implementations§

source§

impl Debug for WasmConfig

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for WasmConfig

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for WasmConfig

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl ToConfig for WasmConfig

source§

fn to_config(&self) -> Result<Config>

Generate a Config for this WasmConfig

source§

impl TryFrom<&[u8]> for WasmConfig

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<&str> for WasmConfig

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<String> for WasmConfig

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: String) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Vec<u8>> for WasmConfig

source§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: Vec<u8>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromBase64 for T
where T: for<'de> Deserialize<'de>,

source§

fn from_base64<Input>(raw: &Input) -> Result<T, Error>
where Input: AsRef<[u8]> + ?Sized,

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<C> SignWithKey<String> for C
where C: ToBase64,

source§

impl<T> ToBase64 for T
where T: Serialize,

source§

fn to_base64(&self) -> Result<Cow<'_, str>, Error>

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T