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),
}component-model and runtime only.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§
Source§impl Type
impl Type
Sourcepub fn unwrap_list(&self) -> &List
pub fn unwrap_list(&self) -> &List
Sourcepub fn unwrap_map(&self) -> &Map
pub fn unwrap_map(&self) -> &Map
Sourcepub fn unwrap_record(&self) -> &Record
pub fn unwrap_record(&self) -> &Record
Sourcepub fn unwrap_tuple(&self) -> &Tuple
pub fn unwrap_tuple(&self) -> &Tuple
Sourcepub 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.
Sourcepub fn unwrap_enum(&self) -> &Enum
pub fn unwrap_enum(&self) -> &Enum
Sourcepub 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.
Sourcepub 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.
Sourcepub fn unwrap_flags(&self) -> &Flags
pub fn unwrap_flags(&self) -> &Flags
Sourcepub fn unwrap_own(&self) -> &ResourceType
pub fn unwrap_own(&self) -> &ResourceType
Sourcepub 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.
Sourcepub fn default_value(&self, store: impl AsContextMut) -> Result<Val>
pub fn default_value(&self, store: impl AsContextMut) -> Result<Val>
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
Source§impl WasmType for Type
Available on crate feature wave only.
impl WasmType for Type
wave only.Source§fn list_element_type(&self) -> Option<Self>
fn list_element_type(&self) -> Option<Self>
Source§fn record_fields(&self) -> Box<dyn Iterator<Item = (Cow<'_, str>, Self)> + '_>
fn record_fields(&self) -> Box<dyn Iterator<Item = (Cow<'_, str>, Self)> + '_>
self is not a record type. Read moreSource§fn tuple_element_types(&self) -> Box<dyn Iterator<Item = Self> + '_>
fn tuple_element_types(&self) -> Box<dyn Iterator<Item = Self> + '_>
self is not a tuple type. Read moreSource§fn variant_cases(
&self,
) -> Box<dyn Iterator<Item = (Cow<'_, str>, Option<Self>)> + '_>
fn variant_cases( &self, ) -> Box<dyn Iterator<Item = (Cow<'_, str>, Option<Self>)> + '_>
self is not a tuple type. Read moreSource§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 moreSource§fn option_some_type(&self) -> Option<Self>
fn option_some_type(&self) -> Option<Self>
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
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