pub struct ExnType { /* private fields */ }Expand description
A WebAssembly exception-object signature type.
This type captures the signature of an exception object. Note
that the WebAssembly standard does not define concrete types in
the heap-type lattice between exn (any exception object – the
top type) and noexn (the uninhabited bottom type). Wasmtime
defines concrete types based on the signature – that is, the
function type that describes the signature of the exception
payload values – rather than the tag. The tag is a per-instance
nominal entity (similar to a memory or a table) and is associated
only with particular exception objects.
Implementations§
Source§impl ExnType
 
impl ExnType
Sourcepub fn new(
    engine: &Engine,
    fields: impl IntoIterator<Item = ValType>,
) -> Result<ExnType>
 Available on crate feature runtime only.
pub fn new( engine: &Engine, fields: impl IntoIterator<Item = ValType>, ) -> Result<ExnType>
runtime only.Create a new ExnType.
This function creates a new exception object type with the given signature, i.e., list of payload value types. This signature implies a tag type, and when instantiated at runtime, it must be associated with a tag of that type.
Sourcepub fn from_tag_type(tag: &TagType) -> Result<ExnType>
 Available on crate feature runtime only.
pub fn from_tag_type(tag: &TagType) -> Result<ExnType>
runtime only.Create a new ExnType from an existing TagType.
This function creates a new exception object type with the
signature represented by the tag. The signature must have no
result values, i.e., must be of the form (T1, T2, ...) -> ().
Sourcepub fn tag_type(&self) -> TagType
 Available on crate feature runtime only.
pub fn tag_type(&self) -> TagType
runtime only.Get the tag type that this exception type is associated with.
Sourcepub fn field(&self, i: usize) -> Option<FieldType>
 Available on crate feature runtime only.
pub fn field(&self, i: usize) -> Option<FieldType>
runtime only.Get the ith field type.
Returns None if i is out of bounds.
Sourcepub fn fields(&self) -> impl ExactSizeIterator<Item = FieldType> + '_
 Available on crate feature runtime only.
pub fn fields(&self) -> impl ExactSizeIterator<Item = FieldType> + '_
runtime only.Returns the list of field types for this function.
Sourcepub fn engine(&self) -> &Engine
 Available on crate feature runtime only.
pub fn engine(&self) -> &Engine
runtime only.Get the engine that this exception type is associated with.
Sourcepub fn matches(&self, other: &ExnType) -> bool
 Available on crate feature runtime only.
pub fn matches(&self, other: &ExnType) -> bool
runtime only.Does this exception type match the other exception type?
That is, is this exception type a subtype of the other exception type?
§Panics
Panics if either type is associated with a different engine from the other.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExnType
impl !RefUnwindSafe for ExnType
impl Send for ExnType
impl Sync for ExnType
impl Unpin for ExnType
impl !UnwindSafe for ExnType
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§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