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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
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>
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