Enum cranelift_wasm::wasmparser::types::Type
source · pub enum Type {
Sub(SubType),
Module(Box<ModuleType>),
Instance(Box<InstanceType>),
Component(Box<ComponentType>),
ComponentInstance(Box<ComponentInstanceType>),
ComponentFunc(ComponentFuncType),
Defined(ComponentDefinedType),
Resource(ResourceId),
}
Expand description
A unified type definition for validating WebAssembly modules and components.
Variants§
Sub(SubType)
The definition is for a sub type.
Module(Box<ModuleType>)
The definition is for a core module type.
This variant is only supported when parsing a component.
Instance(Box<InstanceType>)
The definition is for a core module instance type.
This variant is only supported when parsing a component.
Component(Box<ComponentType>)
The definition is for a component type.
This variant is only supported when parsing a component.
ComponentInstance(Box<ComponentInstanceType>)
The definition is for a component instance type.
This variant is only supported when parsing a component.
ComponentFunc(ComponentFuncType)
The definition is for a component function type.
This variant is only supported when parsing a component.
Defined(ComponentDefinedType)
The definition is for a component defined type.
This variant is only supported when parsing a component.
Resource(ResourceId)
This definition is for a resource type in the component model.
Each resource is identified by a unique identifier specified here.
Implementations§
source§impl Type
impl Type
sourcepub fn unwrap_func(&self) -> &FuncType
pub fn unwrap_func(&self) -> &FuncType
Converts the type to a core function type.
sourcepub fn unwrap_array(&self) -> &ArrayType
pub fn unwrap_array(&self) -> &ArrayType
Converts the type to an array type.
sourcepub fn unwrap_struct(&self) -> &StructType
pub fn unwrap_struct(&self) -> &StructType
Converts the type to a struct type.
sourcepub fn unwrap_module(&self) -> &ModuleType
pub fn unwrap_module(&self) -> &ModuleType
Converts the type to a core module type.
sourcepub fn unwrap_instance(&self) -> &InstanceType
pub fn unwrap_instance(&self) -> &InstanceType
Converts the type to a core module instance type.
sourcepub fn unwrap_component(&self) -> &ComponentType
pub fn unwrap_component(&self) -> &ComponentType
Converts the type to a component type.
sourcepub fn unwrap_component_instance(&self) -> &ComponentInstanceType
pub fn unwrap_component_instance(&self) -> &ComponentInstanceType
Converts the type to a component instance type.
sourcepub fn unwrap_component_func(&self) -> &ComponentFuncType
pub fn unwrap_component_func(&self) -> &ComponentFuncType
Converts the type to a component function type.
sourcepub fn unwrap_defined(&self) -> &ComponentDefinedType
pub fn unwrap_defined(&self) -> &ComponentDefinedType
Converts the type to a component defined type.
sourcepub fn unwrap_resource(&self) -> ResourceId
pub fn unwrap_resource(&self) -> ResourceId
Converts this type to a resource type, returning the corresponding id.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin 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> 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