Trait wasmi::FromValue

source ·
pub trait FromValue: Sized {
    // Required method
    fn from_value(val: Value) -> Option<Self>;
}
Expand description

Trait for creating value from a Value.

Typically each implementation can create a value from the specific type. For example, values of type bool or u32 are both represented by I32 and f64 values are represented by F64.

Required Methods§

source

fn from_value(val: Value) -> Option<Self>

Create a value of type Self from a given Value.

Returns None if the Value is of type different than expected by the conversion in question.

Implementations on Foreign Types§

source§

impl FromValue for i64

source§

impl FromValue for i16

This conversion assumes that i16 is represented as an I32.

source§

impl FromValue for i8

This conversion assumes that i8 is represented as an I32.

source§

impl FromValue for u32

source§

impl FromValue for bool

This conversion assumes that boolean values are represented by I32 type.

source§

impl FromValue for u8

This conversion assumes that u8 is represented as an I32.

source§

impl FromValue for u64

source§

impl FromValue for u16

This conversion assumes that u16 is represented as an I32.

source§

impl FromValue for i32

Implementors§