Enum Type
pub enum Type {
Show 28 variants
Bool,
S8,
U8,
S16,
U16,
S32,
U32,
S64,
U64,
Float32,
Float64,
Char,
String,
List(List),
Map(Map),
Record(Record),
Tuple(Tuple),
Variant(Variant),
Enum(Enum),
Option(OptionType),
Result(ResultType),
Flags(Flags),
Own(ResourceType),
Borrow(ResourceType),
Future(FutureType),
Stream(StreamType),
ErrorContext,
FixedLengthList(FixedLengthList),
}Expand description
Represents a component model interface type
Variants§
Bool
S8
U8
S16
U16
S32
U32
S64
U64
Float32
Float64
Char
String
List(List)
Map(Map)
Record(Record)
Tuple(Tuple)
Variant(Variant)
Enum(Enum)
Option(OptionType)
Result(ResultType)
Flags(Flags)
Own(ResourceType)
Borrow(ResourceType)
Future(FutureType)
Stream(StreamType)
ErrorContext
FixedLengthList(FixedLengthList)
Implementations§
§impl Type
impl Type
pub fn unwrap_list(&self) -> &List
pub fn unwrap_list(&self) -> &List
pub fn unwrap_map(&self) -> &Map
pub fn unwrap_map(&self) -> &Map
pub fn unwrap_record(&self) -> &Record
pub fn unwrap_record(&self) -> &Record
pub fn unwrap_tuple(&self) -> &Tuple
pub fn unwrap_tuple(&self) -> &Tuple
pub fn unwrap_variant(&self) -> &Variant
pub fn unwrap_variant(&self) -> &Variant
Retrieve the inner Variant of a Type::Variant.
§Panics
This will panic if self is not a Type::Variant.
pub fn unwrap_enum(&self) -> &Enum
pub fn unwrap_enum(&self) -> &Enum
pub fn unwrap_option(&self) -> &OptionType
pub fn unwrap_option(&self) -> &OptionType
Retrieve the inner OptionType of a Type::Option.
§Panics
This will panic if self is not a Type::Option.
pub fn unwrap_result(&self) -> &ResultType
pub fn unwrap_result(&self) -> &ResultType
Retrieve the inner ResultType of a Type::Result.
§Panics
This will panic if self is not a Type::Result.
pub fn unwrap_flags(&self) -> &Flags
pub fn unwrap_flags(&self) -> &Flags
pub fn unwrap_own(&self) -> &ResourceType
pub fn unwrap_own(&self) -> &ResourceType
pub fn unwrap_borrow(&self) -> &ResourceType
pub fn unwrap_borrow(&self) -> &ResourceType
Retrieve the inner ResourceType of a Type::Borrow.
§Panics
This will panic if self is not a Type::Borrow.
pub fn default_value(&self, store: impl AsContextMut) -> Result<Val, Error>
pub fn default_value(&self, store: impl AsContextMut) -> Result<Val, Error>
Construct a default value of this type, if one exists.
Defaults are the “empty” or “zero” value of each type: zero for the
numerics, the empty string/list, none for option, ok for
result, no flags set, and the first case of a variant or enum.
An own or borrow of a host-defined resource defaults to a fresh
handle in store, with an arbitrary representation and no destructor.
Nothing can be done with such a handle beyond passing it back to the
component that the resource was defined for.
§Errors
Returns an error for an own or borrow of a guest-defined resource,
whose representation belongs to the guest and so cannot be conjured by
the host.
Returns an error for future, stream, and error-context, as there
is currently no way to synthesize these without statically knowing
their payload type.
An aggregate containing any of the above is an error for the same reason.
This function will return an OutOfMemory error
when memory allocation fails. See the OutOfMemory type’s
documentation for details on Wasmtime’s out-of-memory handling.
Trait Implementations§
impl Eq for Type
impl StructuralPartialEq for Type
§impl WasmType for Type
impl WasmType for Type
§fn kind(&self) -> WasmTypeKind
fn kind(&self) -> WasmTypeKind
WasmTypeKind of this type.§fn list_element_type(&self) -> Option<Type>
fn list_element_type(&self) -> Option<Type>
§fn record_fields(&self) -> Box<dyn Iterator<Item = (Cow<'_, str>, Type)> + '_>
fn record_fields(&self) -> Box<dyn Iterator<Item = (Cow<'_, str>, Type)> + '_>
self is not a record type. Read more§fn tuple_element_types(&self) -> Box<dyn Iterator<Item = Type> + '_>
fn tuple_element_types(&self) -> Box<dyn Iterator<Item = Type> + '_>
self is not a tuple type. Read more§fn variant_cases(
&self,
) -> Box<dyn Iterator<Item = (Cow<'_, str>, Option<Type>)> + '_>
fn variant_cases( &self, ) -> Box<dyn Iterator<Item = (Cow<'_, str>, Option<Type>)> + '_>
self is not a tuple type. Read more§fn enum_cases(&self) -> Box<dyn Iterator<Item = Cow<'_, str>> + '_>
fn enum_cases(&self) -> Box<dyn Iterator<Item = Cow<'_, str>> + '_>
self is not an enum type. Read more§fn option_some_type(&self) -> Option<Type>
fn option_some_type(&self) -> Option<Type>
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnsafeUnpin for Type
impl UnwindSafe for Type
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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