Value

Struct Value 

pub struct Value(/* private fields */);
Expand description

A Value is a WAVE value, and implements WasmValue.

Trait Implementations§

§

impl Clone for Value

§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Value

§

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

Formats the value using the given formatter. Read more
§

impl<'a> From<&'a str> for Value

§

fn from(value: &'a str) -> Value

Converts to this type from the input type.
§

impl<const N: usize, T> From<[T; N]> for Value
where T: ValueTyped + Into<Value>,

§

fn from(values: [T; N]) -> Value

Converts to this type from the input type.
§

impl<T1> From<(T1,)> for Value
where T1: ValueTyped + Into<Value>,

§

fn from(_: (T1,)) -> Value

Converts to this type from the input type.
§

impl<T1, T2> From<(T1, T2)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3> From<(T1, T2, T3)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2, T3)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4> From<(T1, T2, T3, T4)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2, T3, T4)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5> From<(T1, T2, T3, T4, T5)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2, T3, T4, T5)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5, T6> From<(T1, T2, T3, T4, T5, T6)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>, T6: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2, T3, T4, T5, T6)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5, T6, T7> From<(T1, T2, T3, T4, T5, T6, T7)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>, T6: ValueTyped + Into<Value>, T7: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2, T3, T4, T5, T6, T7)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5, T6, T7, T8> From<(T1, T2, T3, T4, T5, T6, T7, T8)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>, T6: ValueTyped + Into<Value>, T7: ValueTyped + Into<Value>, T8: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2, T3, T4, T5, T6, T7, T8)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9> From<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>, T6: ValueTyped + Into<Value>, T7: ValueTyped + Into<Value>, T8: ValueTyped + Into<Value>, T9: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2, T3, T4, T5, T6, T7, T8, T9)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> From<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>, T6: ValueTyped + Into<Value>, T7: ValueTyped + Into<Value>, T8: ValueTyped + Into<Value>, T9: ValueTyped + Into<Value>, T10: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> From<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>, T6: ValueTyped + Into<Value>, T7: ValueTyped + Into<Value>, T8: ValueTyped + Into<Value>, T9: ValueTyped + Into<Value>, T10: ValueTyped + Into<Value>, T11: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> From<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>, T6: ValueTyped + Into<Value>, T7: ValueTyped + Into<Value>, T8: ValueTyped + Into<Value>, T9: ValueTyped + Into<Value>, T10: ValueTyped + Into<Value>, T11: ValueTyped + Into<Value>, T12: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> From<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>, T6: ValueTyped + Into<Value>, T7: ValueTyped + Into<Value>, T8: ValueTyped + Into<Value>, T9: ValueTyped + Into<Value>, T10: ValueTyped + Into<Value>, T11: ValueTyped + Into<Value>, T12: ValueTyped + Into<Value>, T13: ValueTyped + Into<Value>,

§

fn from(_: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> From<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>, T6: ValueTyped + Into<Value>, T7: ValueTyped + Into<Value>, T8: ValueTyped + Into<Value>, T9: ValueTyped + Into<Value>, T10: ValueTyped + Into<Value>, T11: ValueTyped + Into<Value>, T12: ValueTyped + Into<Value>, T13: ValueTyped + Into<Value>, T14: ValueTyped + Into<Value>,

§

fn from( _: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14), ) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> From<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>, T6: ValueTyped + Into<Value>, T7: ValueTyped + Into<Value>, T8: ValueTyped + Into<Value>, T9: ValueTyped + Into<Value>, T10: ValueTyped + Into<Value>, T11: ValueTyped + Into<Value>, T12: ValueTyped + Into<Value>, T13: ValueTyped + Into<Value>, T14: ValueTyped + Into<Value>, T15: ValueTyped + Into<Value>,

§

fn from( _: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15), ) -> Value

Converts to this type from the input type.
§

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> From<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16)> for Value
where T1: ValueTyped + Into<Value>, T2: ValueTyped + Into<Value>, T3: ValueTyped + Into<Value>, T4: ValueTyped + Into<Value>, T5: ValueTyped + Into<Value>, T6: ValueTyped + Into<Value>, T7: ValueTyped + Into<Value>, T8: ValueTyped + Into<Value>, T9: ValueTyped + Into<Value>, T10: ValueTyped + Into<Value>, T11: ValueTyped + Into<Value>, T12: ValueTyped + Into<Value>, T13: ValueTyped + Into<Value>, T14: ValueTyped + Into<Value>, T15: ValueTyped + Into<Value>, T16: ValueTyped + Into<Value>,

§

fn from( _: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16), ) -> Value

Converts to this type from the input type.
§

impl<T> From<Option<T>> for Value
where T: ValueTyped + Into<Value>,

§

fn from(value: Option<T>) -> Value

Converts to this type from the input type.
§

impl<T, U> From<Result<T, U>> for Value
where T: ValueTyped + Into<Value>, U: ValueTyped + Into<Value>,

§

fn from(value: Result<T, U>) -> Value

Converts to this type from the input type.
§

impl From<String> for Value

§

fn from(value: String) -> Value

Converts to this type from the input type.
§

impl<T> From<Vec<T>> for Value
where T: ValueTyped + Into<Value>,

§

fn from(values: Vec<T>) -> Value

Converts to this type from the input type.
§

impl From<bool> for Value

§

fn from(value: bool) -> Value

Converts to this type from the input type.
§

impl From<char> for Value

§

fn from(value: char) -> Value

Converts to this type from the input type.
§

impl From<f32> for Value

§

fn from(value: f32) -> Value

Converts to this type from the input type.
§

impl From<f64> for Value

§

fn from(value: f64) -> Value

Converts to this type from the input type.
§

impl From<i16> for Value

§

fn from(value: i16) -> Value

Converts to this type from the input type.
§

impl From<i32> for Value

§

fn from(value: i32) -> Value

Converts to this type from the input type.
§

impl From<i64> for Value

§

fn from(value: i64) -> Value

Converts to this type from the input type.
§

impl From<i8> for Value

§

fn from(value: i8) -> Value

Converts to this type from the input type.
§

impl From<u16> for Value

§

fn from(value: u16) -> Value

Converts to this type from the input type.
§

impl From<u32> for Value

§

fn from(value: u32) -> Value

Converts to this type from the input type.
§

impl From<u64> for Value

§

fn from(value: u64) -> Value

Converts to this type from the input type.
§

impl From<u8> for Value

§

fn from(value: u8) -> Value

Converts to this type from the input type.
§

impl PartialEq for Value

§

fn eq(&self, other: &Value) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl WasmValue for Value

§

type Type = Type

A type representing types of these values.
§

fn kind(&self) -> WasmTypeKind

The kind of type of this value.
§

fn make_bool(val: bool) -> Value

Returns a new WasmValue of the given type. Read more
§

fn unwrap_bool(&self) -> bool

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn make_s8(val: i8) -> Value

Returns a new WasmValue of the given type. Read more
§

fn unwrap_s8(&self) -> i8

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn make_s16(val: i16) -> Value

Returns a new WasmValue of the given type. Read more
§

fn unwrap_s16(&self) -> i16

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn make_s32(val: i32) -> Value

Returns a new WasmValue of the given type. Read more
§

fn unwrap_s32(&self) -> i32

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn make_s64(val: i64) -> Value

Returns a new WasmValue of the given type. Read more
§

fn unwrap_s64(&self) -> i64

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn make_u8(val: u8) -> Value

Returns a new WasmValue of the given type. Read more
§

fn unwrap_u8(&self) -> u8

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn make_u16(val: u16) -> Value

Returns a new WasmValue of the given type. Read more
§

fn unwrap_u16(&self) -> u16

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn make_u32(val: u32) -> Value

Returns a new WasmValue of the given type. Read more
§

fn unwrap_u32(&self) -> u32

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn make_u64(val: u64) -> Value

Returns a new WasmValue of the given type. Read more
§

fn unwrap_u64(&self) -> u64

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn make_char(val: char) -> Value

Returns a new WasmValue of the given type. Read more
§

fn unwrap_char(&self) -> char

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn make_f32(val: f32) -> Value

Returns a new WasmValue of the given type. Read more
§

fn make_f64(val: f64) -> Value

Returns a new WasmValue of the given type. Read more
§

fn make_string(val: Cow<'_, str>) -> Value

Returns a new WasmValue of the given type. Read more
§

fn make_list( ty: &<Value as WasmValue>::Type, vals: impl IntoIterator<Item = Value>, ) -> Result<Value, WasmValueError>

Returns a new WasmValue of the given type. Read more
§

fn make_record<'a>( ty: &<Value as WasmValue>::Type, fields: impl IntoIterator<Item = (&'a str, Value)>, ) -> Result<Value, WasmValueError>

Returns a new WasmValue of the given type. Read more
§

fn make_tuple( ty: &<Value as WasmValue>::Type, vals: impl IntoIterator<Item = Value>, ) -> Result<Value, WasmValueError>

Returns a new WasmValue of the given type. Read more
§

fn make_variant( ty: &<Value as WasmValue>::Type, case_name: &str, val: Option<Value>, ) -> Result<Value, WasmValueError>

Returns a new WasmValue of the given type. Read more
§

fn make_enum( ty: &<Value as WasmValue>::Type, case: &str, ) -> Result<Value, WasmValueError>

Returns a new WasmValue of the given type. Read more
§

fn make_option( ty: &<Value as WasmValue>::Type, val: Option<Value>, ) -> Result<Value, WasmValueError>

Returns a new WasmValue of the given type. Read more
§

fn make_result( ty: &<Value as WasmValue>::Type, val: Result<Option<Value>, Option<Value>>, ) -> Result<Value, WasmValueError>

Returns a new WasmValue of the given type. Read more
§

fn make_flags<'a>( ty: &<Value as WasmValue>::Type, names: impl IntoIterator<Item = &'a str>, ) -> Result<Value, WasmValueError>

Returns a new WasmValue of the given type. Read more
§

fn unwrap_f32(&self) -> f32

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn unwrap_f64(&self) -> f64

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn unwrap_string(&self) -> Cow<'_, str>

Returns the underlying value of the WasmValue, panicing if it’s the wrong type. Read more
§

fn unwrap_list(&self) -> Box<dyn Iterator<Item = Cow<'_, Value>> + '_>

Returns an iterator of the element Vals of the list. Read more
§

fn unwrap_record( &self, ) -> Box<dyn Iterator<Item = (Cow<'_, str>, Cow<'_, Value>)> + '_>

Returns an iterator of the field names and Vals of the record. Read more
§

fn unwrap_tuple(&self) -> Box<dyn Iterator<Item = Cow<'_, Value>> + '_>

Returns an iterator of the field Vals of the tuple. Read more
§

fn unwrap_variant(&self) -> (Cow<'_, str>, Option<Cow<'_, Value>>)

Returns the variant case name and optional payload WasmValue of the variant. Read more
§

fn unwrap_enum(&self) -> Cow<'_, str>

Returns the case name of the enum. Read more
§

fn unwrap_option(&self) -> Option<Cow<'_, Value>>

Returns the optional WasmValue. Read more
§

fn unwrap_result( &self, ) -> Result<Option<Cow<'_, Value>>, Option<Cow<'_, Value>>>

Returns Ok() or Err() with the optional payload WasmValue. Read more
§

fn unwrap_flags(&self) -> Box<dyn Iterator<Item = Cow<'_, str>> + '_>

Returns an iterator of the names of the flags WasmValue. Read more
§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Pointer = u32

Source§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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