pub struct TypesRef<'a> { /* private fields */ }
Expand description
Represents the types known to a crate::Validator
during validation.
Retrieved via the crate::Validator::types
method.
Implementations§
Source§impl<'a> TypesRef<'a>
impl<'a> TypesRef<'a>
Sourcepub fn id(&self) -> ValidatorId
pub fn id(&self) -> ValidatorId
Get the id of the validator that these types are associated with.
Sourcepub fn get<T>(&self, id: T) -> Option<&'a <T as TypeIdentifier>::Data>where
T: TypeIdentifier,
pub fn get<T>(&self, id: T) -> Option<&'a <T as TypeIdentifier>::Data>where
T: TypeIdentifier,
Gets a type based on its type id.
Returns None
if the type id is unknown.
Sourcepub fn rec_group_id_of(&self, id: CoreTypeId) -> RecGroupId
pub fn rec_group_id_of(&self, id: CoreTypeId) -> RecGroupId
Get the id of the rec group that the given type id was defined within.
Sourcepub fn rec_group_elements(&self, id: RecGroupId) -> impl ExactSizeIterator
pub fn rec_group_elements(&self, id: RecGroupId) -> impl ExactSizeIterator
Get the types within a rec group.
Sourcepub fn supertype_of(&self, id: CoreTypeId) -> Option<CoreTypeId>
pub fn supertype_of(&self, id: CoreTypeId) -> Option<CoreTypeId>
Get the super type of the given type id, if any.
Sourcepub fn core_type_at(&self, index: u32) -> ComponentCoreTypeId
pub fn core_type_at(&self, index: u32) -> ComponentCoreTypeId
Gets a core WebAssembly type id from a type index.
Note that this is in contrast to TypesRef::component_type_at
which
gets a component type from its index.
§Panics
This will panic if the index
provided is out of bounds.
Sourcepub fn component_any_type_at(&self, index: u32) -> ComponentAnyTypeId
pub fn component_any_type_at(&self, index: u32) -> ComponentAnyTypeId
Gets a type id from a type index.
§Panics
Panics if index
is not a valid type index or if this type information
represents a core module.
Sourcepub fn component_type_at(&self, index: u32) -> ComponentTypeId
pub fn component_type_at(&self, index: u32) -> ComponentTypeId
Gets a component type id from a type index.
§Panics
Panics if index
is not a valid component type index or if this type
information represents a core module.
Sourcepub fn component_defined_type_at(&self, index: u32) -> ComponentDefinedTypeId
pub fn component_defined_type_at(&self, index: u32) -> ComponentDefinedTypeId
Gets a type id from a type index.
§Panics
Panics if index
is not a valid function index or if this type
information represents a core module.
Sourcepub fn core_type_count(&self) -> u32
pub fn core_type_count(&self) -> u32
Returns the number of core types defined so far.
Sourcepub fn component_type_count(&self) -> u32
pub fn component_type_count(&self) -> u32
Returns the number of component types defined so far.
Sourcepub fn table_at(&self, index: u32) -> TableType
pub fn table_at(&self, index: u32) -> TableType
Gets the type of a table at the given table index.
§Panics
This will panic if the index
provided is out of bounds.
Sourcepub fn table_count(&self) -> u32
pub fn table_count(&self) -> u32
Returns the number of tables defined so far.
Sourcepub fn memory_at(&self, index: u32) -> MemoryType
pub fn memory_at(&self, index: u32) -> MemoryType
Gets the type of a memory at the given memory index.
§Panics
This will panic if the index
provided is out of bounds.
Sourcepub fn memory_count(&self) -> u32
pub fn memory_count(&self) -> u32
Returns the number of memories defined so far.
Sourcepub fn global_at(&self, index: u32) -> GlobalType
pub fn global_at(&self, index: u32) -> GlobalType
Gets the type of a global at the given global index.
§Panics
This will panic if the index
provided is out of bounds.
Sourcepub fn global_count(&self) -> u32
pub fn global_count(&self) -> u32
Returns the number of globals defined so far.
Sourcepub fn tag_at(&self, index: u32) -> CoreTypeId
pub fn tag_at(&self, index: u32) -> CoreTypeId
Gets the type of a tag at the given tag index.
§Panics
This will panic if the index
provided is out of bounds.
Sourcepub fn core_function_at(&self, index: u32) -> CoreTypeId
pub fn core_function_at(&self, index: u32) -> CoreTypeId
Gets the type of a core function at the given function index.
§Panics
This will panic if the index
provided is out of bounds.
Sourcepub fn function_count(&self) -> u32
pub fn 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.
Sourcepub fn element_at(&self, index: u32) -> RefType
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.
Sourcepub fn element_count(&self) -> u32
pub fn element_count(&self) -> u32
Returns the number of elements defined so far.
Sourcepub fn component_function_at(&self, index: u32) -> ComponentFuncTypeId
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.
Sourcepub fn component_function_count(&self) -> u32
pub fn component_function_count(&self) -> u32
Returns the number of component functions defined so far.
Sourcepub fn module_at(&self, index: u32) -> ComponentCoreModuleTypeId
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.
Sourcepub fn module_count(&self) -> u32
pub fn module_count(&self) -> u32
Returns the number of core wasm modules defined so far.
Sourcepub fn core_instance_at(&self, index: u32) -> ComponentCoreInstanceTypeId
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.
Sourcepub fn core_instance_count(&self) -> u32
pub fn core_instance_count(&self) -> u32
Returns the number of core wasm instances defined so far.
Sourcepub fn component_at(&self, index: u32) -> ComponentTypeId
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.
Sourcepub fn component_count(&self) -> u32
pub fn component_count(&self) -> u32
Returns the number of components defined so far.
Sourcepub fn component_instance_at(&self, index: u32) -> ComponentInstanceTypeId
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.
Sourcepub fn component_instance_count(&self) -> u32
pub fn component_instance_count(&self) -> u32
Returns the number of component instances defined so far.
Sourcepub fn value_at(&self, index: u32) -> ComponentValType
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.
Sourcepub fn entity_type_from_import(&self, import: &Import<'_>) -> Option<EntityType>
pub fn entity_type_from_import(&self, import: &Import<'_>) -> Option<EntityType>
Gets the entity type for the given import.
Sourcepub fn entity_type_from_export(&self, export: &Export<'_>) -> Option<EntityType>
pub fn entity_type_from_export(&self, export: &Export<'_>) -> Option<EntityType>
Gets the entity type from the given export.
Sourcepub fn component_entity_type_of_import(
&self,
name: &str,
) -> Option<ComponentEntityType>
pub fn component_entity_type_of_import( &self, name: &str, ) -> Option<ComponentEntityType>
Gets the component entity type for the given component import.
Sourcepub fn component_entity_type_of_export(
&self,
name: &str,
) -> Option<ComponentEntityType>
pub fn component_entity_type_of_export( &self, name: &str, ) -> Option<ComponentEntityType>
Gets the component entity type for the given component export.
Sourcepub fn peel_alias<T>(&self, ty: T) -> Option<T>where
T: Aliasable,
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 TypesRef<'_>where
T: TypeIdentifier,
impl<T> Index<T> for TypesRef<'_>where
T: TypeIdentifier,
impl<'a> Copy for TypesRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for TypesRef<'a>
impl<'a> RefUnwindSafe for TypesRef<'a>
impl<'a> Send for TypesRef<'a>
impl<'a> Sync for TypesRef<'a>
impl<'a> Unpin for TypesRef<'a>
impl<'a> UnwindSafe for TypesRef<'a>
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,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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