Struct cranelift_wasm::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 as_ref(&self) -> TypesRef<'_>

Gets a reference to this validation type information.

source

pub fn type_from_id(&self, id: TypeId) -> Option<&Type>

Gets a type based on its type id.

Returns None if the type id is unknown.

source

pub fn id_from_type_index(&self, index: u32, core: bool) -> Option<TypeId>

Gets a type id from a type index.

Returns None if the type index is out of bounds.

source

pub fn type_at(&self, index: u32, core: bool) -> Option<&Type>

Gets a type at the given type index.

Returns None if the index is out of bounds.

source

pub fn func_type_at(&self, index: u32) -> Option<&FuncType>

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

Returns None if the index is out of bounds.

source

pub fn type_count(&self) -> usize

Gets the count of core types.

source

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

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

Returns None if the index is out of bounds.

source

pub fn table_count(&self) -> usize

Gets the count of imported and defined tables.

source

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

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

Returns None if the index is out of bounds.

source

pub fn memory_count(&self) -> usize

Gets the count of imported and defined memories.

source

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

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

Returns None if the index is out of bounds.

source

pub fn global_count(&self) -> usize

Gets the count of imported and defined globals.

source

pub fn tag_at(&self, index: u32) -> Option<&FuncType>

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

Returns None if the index is out of bounds.

source

pub fn tag_count(&self) -> usize

Gets the count of imported and defined tags.

source

pub fn function_at(&self, index: u32) -> Option<&FuncType>

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

Returns None if the index is out of bounds.

source

pub fn function_count(&self) -> usize

Gets the count of imported and defined core functions.

The count also includes aliased core functions in components.

source

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

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

Returns None if the index is out of bounds.

source

pub fn element_count(&self) -> usize

Gets the count of element segments.

source

pub fn component_function_at(&self, index: u32) -> Option<&ComponentFuncType>

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

Returns None if the index is out of bounds.

source

pub fn component_function_count(&self) -> usize

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

source

pub fn module_at(&self, index: u32) -> Option<&ModuleType>

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

Returns None if the index is out of bounds.

source

pub fn module_count(&self) -> usize

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

source

pub fn instance_at(&self, index: u32) -> Option<&InstanceType>

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

Returns None if the index is out of bounds.

source

pub fn instance_count(&self) -> usize

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

source

pub fn component_at(&self, index: u32) -> Option<&ComponentType>

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

Returns None if the index is out of bounds.

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, ) -> Option<&ComponentInstanceType>

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

Returns None if the index is out of bounds.

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) -> Option<ComponentValType>

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

Returns None if the index is out of bounds.

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_extern( &self, name: &str, ) -> Option<ComponentEntityType>

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

source

pub fn peel_alias(&self, ty: TypeId) -> Option<TypeId>

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

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

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

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.