wasmtime_environ::wasmparser::types

Struct Types

Source
pub struct Types { /* private fields */ }
Expand description

Represents the types known to a crate::Validator once validation has completed.

The type information is returned via the crate::Validator::end method.

Implementations§

Source§

impl Types

Source

pub fn id(&self) -> ValidatorId

Get the id of the validator that these types are associated with.

Source

pub fn as_ref(&self) -> TypesRef<'_>

Gets a reference to this validation type information.

Source

pub fn get<T>(&self, id: T) -> Option<&<T as TypeIdentifier>::Data>
where T: TypeIdentifier,

Gets a type based on its type id.

Returns None if the type id is unknown.

Source

pub fn core_type_at(&self, index: u32) -> ComponentCoreTypeId

Gets a core WebAssembly type at the given type index.

Note that this is in contrast to TypesRef::component_type_at which gets a component type from its index.

§Panics

Panics if index is not a valid function index.

Source

pub fn component_any_type_at(&self, index: u32) -> ComponentAnyTypeId

Gets a component WebAssembly type at the given type index.

Note that this is in contrast to TypesRef::core_type_at which gets a core type from its index.

§Panics

Panics if index is not a valid type index.

Source

pub fn component_type_at(&self, index: u32) -> ComponentTypeId

Gets a component type at the given type index.

§Panics

Panics if index is not a valid component type index.

Source

pub fn component_defined_type_at(&self, index: u32) -> ComponentDefinedTypeId

Gets a component type from the given component type index.

§Panics

Panics if index is not a valid defined type index or if this type information represents a core module.

Source

pub fn type_count(&self) -> usize

Gets the count of core types.

Source

pub fn table_at(&self, index: u32) -> TableType

Gets the type of a table at the given table index.

§Panics

Panics if index is not a valid function index.

Source

pub fn table_count(&self) -> usize

Gets the count of imported and defined tables.

Source

pub fn memory_at(&self, index: u32) -> MemoryType

Gets the type of a memory at the given memory index.

§Panics

Panics if index is not a valid function index.

Source

pub fn memory_count(&self) -> u32

Gets the count of imported and defined memories.

Source

pub fn global_at(&self, index: u32) -> GlobalType

Gets the type of a global at the given global index.

§Panics

Panics if index is not a valid function index.

Source

pub fn global_count(&self) -> u32

Gets the count of imported and defined globals.

Source

pub fn tag_at(&self, index: u32) -> CoreTypeId

Gets the type of a tag at the given tag index.

§Panics

Panics if index is not a valid function index.

Source

pub fn tag_count(&self) -> u32

Gets the count of imported and defined tags.

Source

pub fn core_function_at(&self, index: u32) -> CoreTypeId

Gets the type of a core function at the given function index.

§Panics

Panics if index is not a valid function index.

Source

pub fn core_function_count(&self) -> u32

Gets the count of core functions defined so far.

Note that this includes imported functions, defined functions, and for components lowered/aliased functions.

Source

pub fn element_at(&self, index: u32) -> RefType

Gets the type of an element segment at the given element segment index.

§Panics

This will panic if the index provided is out of bounds.

Source

pub fn element_count(&self) -> u32

Gets the count of element segments.

Source

pub fn component_function_at(&self, index: u32) -> ComponentFuncTypeId

Gets the type of a component function at the given function index.

§Panics

This will panic if the index provided is out of bounds or if this type information represents a core module.

Source

pub fn component_function_count(&self) -> u32

Gets the count of imported, exported, or aliased component functions.

Source

pub fn module_at(&self, index: u32) -> ComponentCoreModuleTypeId

Gets the type of a module at the given module index.

§Panics

This will panic if the index provided is out of bounds or if this type information represents a core module.

Source

pub fn module_count(&self) -> usize

Gets the count of imported, exported, or aliased modules.

Source

pub fn core_instance_at(&self, index: u32) -> ComponentCoreInstanceTypeId

Gets the type of a module instance at the given module instance index.

§Panics

This will panic if the index provided is out of bounds or if this type information represents a core module.

Source

pub fn core_instance_count(&self) -> usize

Gets the count of imported, exported, or aliased core module instances.

Source

pub fn component_at(&self, index: u32) -> ComponentTypeId

Gets the type of a component at the given component index.

§Panics

This will panic if the index provided is out of bounds or if this type information represents a core module.

Source

pub fn component_count(&self) -> usize

Gets the count of imported, exported, or aliased components.

Source

pub fn component_instance_at(&self, index: u32) -> ComponentInstanceTypeId

Gets the type of an component instance at the given component instance index.

§Panics

This will panic if the index provided is out of bounds or if this type information represents a core module.

Source

pub fn component_instance_count(&self) -> usize

Gets the count of imported, exported, or aliased component instances.

Source

pub fn value_at(&self, index: u32) -> ComponentValType

Gets the type of a value at the given value index.

§Panics

This will panic if the index provided is out of bounds or if this type information represents a core module.

Source

pub fn value_count(&self) -> usize

Gets the count of imported, exported, or aliased values.

Source

pub fn entity_type_from_import(&self, import: &Import<'_>) -> Option<EntityType>

Gets the entity type from the given import.

Source

pub fn entity_type_from_export(&self, export: &Export<'_>) -> Option<EntityType>

Gets the entity type from the given export.

Source

pub fn component_entity_type_of_import( &self, name: &str, ) -> Option<ComponentEntityType>

Gets the component entity type for the given component import name.

Source

pub fn component_entity_type_of_export( &self, name: &str, ) -> Option<ComponentEntityType>

Gets the component entity type for the given component export name.

Source

pub fn peel_alias<T>(&self, ty: T) -> Option<T>
where T: Aliasable,

Attempts to lookup the type id that ty is an alias of.

Returns None if ty wasn’t listed as aliasing a prior type.

Trait Implementations§

Source§

impl<T> Index<T> for Types
where T: TypeIdentifier,

Source§

type Output = <T as TypeIdentifier>::Data

The returned type after indexing.
Source§

fn index(&self, id: T) -> &<Types as Index<T>>::Output

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl Freeze for Types

§

impl RefUnwindSafe for Types

§

impl Send for Types

§

impl Sync for Types

§

impl Unpin for Types

§

impl UnwindSafe for Types

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.