Struct wasmparser::types::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 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_in_component 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 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 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.

source§

impl Types

source

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

Return a TypesRef through which types can be inspected.

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) -> &Self::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.