pub enum StorageType {
I8,
I16,
ValType(ValType),
}
Available on crate feature
runtime
only.Expand description
The storage type of a struct
field or array
element.
This is either a packed 8- or -16 bit integer, or else it is some unpacked Wasm value type.
Variants§
Implementations§
Source§impl StorageType
impl StorageType
Sourcepub fn is_val_type(&self) -> bool
pub fn is_val_type(&self) -> bool
Is this a Wasm value type?
Sourcepub fn as_val_type(&self) -> Option<&ValType>
pub fn as_val_type(&self) -> Option<&ValType>
Get this storage type’s underlying value type, if any.
Returns None
if this storage type is not a value type.
Sourcepub fn unwrap_val_type(&self) -> &ValType
pub fn unwrap_val_type(&self) -> &ValType
Get this storage type’s underlying value type, panicking if it is not a value type.
Sourcepub fn unpack(&self) -> &ValType
pub fn unpack(&self) -> &ValType
Unpack this (possibly packed) storage type into a full ValType
.
If this is a StorageType::ValType
, then the inner ValType
is
returned as-is.
If this is a packed StorageType::I8
or StorageType::I16, then a
ValType::I32` is returned.
Trait Implementations§
Source§impl Clone for StorageType
impl Clone for StorageType
Source§fn clone(&self) -> StorageType
fn clone(&self) -> StorageType
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Display for StorageType
impl Display for StorageType
Source§impl From<RefType> for StorageType
impl From<RefType> for StorageType
Source§impl From<ValType> for StorageType
impl From<ValType> for StorageType
Auto Trait Implementations§
impl Freeze for StorageType
impl !RefUnwindSafe for StorageType
impl Send for StorageType
impl Sync for StorageType
impl Unpin for StorageType
impl !UnwindSafe for StorageType
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
Mutably borrows from an owned value. Read more
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>
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 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>
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