ComponentType

Trait ComponentType 

Source
pub unsafe trait ComponentType { }
Available on crate feature component-model only.
Expand description

A trait representing types which can be passed to and read from components with the canonical ABI.

This trait is implemented for Rust types which can be communicated to components. The Func::typed and TypedFunc Rust items are the main consumers of this trait.

Supported Rust types include:

Component Model TypeRust Type
{s,u}{8,16,32,64}{i,u}{8,16,32,64}
f{32,64}f{32,64}
boolbool
charchar
tuple<A, B>(A, B)
option<T>Option<T>
resultResult<(), ()>
result<T>Result<T, ()>
result<_, E>Result<(), E>
result<T, E>Result<T, E>
stringString, &str, or WasmStr
list<T>Vec<T>, &[T], or WasmList
own<T>, borrow<T>Resource<T> or ResourceAny
record#[derive(ComponentType)]
variant#[derive(ComponentType)]
enum#[derive(ComponentType)]
flagsflags!

Rust standard library pointers such as &T, Box<T>, Rc<T>, and Arc<T> additionally represent whatever type T represents in the component model. Note that types such as record, variant, enum, and flags are generated by the embedder at compile time. These macros derive implementation of this trait for custom types to map to custom types in the component model. Note that for record, variant, enum, and flags those types are often generated by the bindgen! macro from WIT definitions.

Types that implement ComponentType are used for Params and Return in TypedFunc and Func::typed.

The contents of this trait are hidden as it’s intended to be an implementation detail of Wasmtime. The contents of this trait are not covered by Wasmtime’s stability guarantees.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ComponentType for bool

Available on crate feature runtime only.
Source§

impl ComponentType for char

Available on crate feature runtime only.
Source§

impl ComponentType for f32

Available on crate feature runtime only.
Source§

impl ComponentType for f64

Available on crate feature runtime only.
Source§

impl ComponentType for i8

Available on crate feature runtime only.
Source§

impl ComponentType for i16

Available on crate feature runtime only.
Source§

impl ComponentType for i32

Available on crate feature runtime only.
Source§

impl ComponentType for i64

Available on crate feature runtime only.
Source§

impl ComponentType for str

Available on crate feature runtime only.
Source§

impl ComponentType for u8

Available on crate feature runtime only.
Source§

impl ComponentType for u16

Available on crate feature runtime only.
Source§

impl ComponentType for u32

Available on crate feature runtime only.
Source§

impl ComponentType for u64

Available on crate feature runtime only.
Source§

impl ComponentType for ()

Available on crate feature runtime only.
Source§

impl ComponentType for String

Available on crate feature runtime only.
Source§

impl<A1> ComponentType for (A1,)
where A1: ComponentType,

Available on crate feature runtime only.
Source§

impl<A1, A2> ComponentType for (A1, A2)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3> ComponentType for (A1, A2, A3)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4> ComponentType for (A1, A2, A3, A4)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5> ComponentType for (A1, A2, A3, A4, A5)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5, A6> ComponentType for (A1, A2, A3, A4, A5, A6)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5, A6, A7> ComponentType for (A1, A2, A3, A4, A5, A6, A7)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5, A6, A7, A8> ComponentType for (A1, A2, A3, A4, A5, A6, A7, A8)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5, A6, A7, A8, A9> ComponentType for (A1, A2, A3, A4, A5, A6, A7, A8, A9)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10> ComponentType for (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11> ComponentType for (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12> ComponentType for (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13> ComponentType for (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14> ComponentType for (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15> ComponentType for (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15)

Available on crate feature runtime only.
Source§

impl<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16> ComponentType for (A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16)

Available on crate feature runtime only.
Source§

impl<T> ComponentType for Option<T>
where T: ComponentType,

Available on crate feature runtime only.
Source§

impl<T> ComponentType for [T]
where T: ComponentType,

Available on crate feature runtime only.
Source§

impl<T, E> ComponentType for Result<T, E>

Available on crate feature runtime only.
Source§

impl<T: ComponentType + ?Sized> ComponentType for &T

Available on crate feature runtime only.
Source§

impl<T: ComponentType + ?Sized> ComponentType for Box<T>

Available on crate feature runtime only.
Source§

impl<T: ComponentType + ?Sized> ComponentType for Rc<T>

Available on crate feature runtime only.
Source§

impl<T: ComponentType + ?Sized> ComponentType for Arc<T>

Available on crate feature runtime only.
Source§

impl<T: ComponentType> ComponentType for Vec<T>

Available on crate feature runtime only.

Implementors§

Source§

impl ComponentType for ResourceAny

Available on crate feature runtime only.
Source§

impl ComponentType for WasmStr

Available on crate feature runtime only.
Source§

impl<T: 'static> ComponentType for Resource<T>

Available on crate feature runtime only.
Source§

impl<T: ComponentType> ComponentType for WasmList<T>

Available on crate feature runtime only.