pub enum StorageType {
I8,
I16,
ValType(ValType),
}
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
Available on crate feature runtime
only.
pub fn is_val_type(&self) -> bool
runtime
only.Is this a Wasm value type?
Sourcepub fn as_val_type(&self) -> Option<&ValType>
Available on crate feature runtime
only.
pub fn as_val_type(&self) -> Option<&ValType>
runtime
only.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
Available on crate feature runtime
only.
pub fn unwrap_val_type(&self) -> &ValType
runtime
only.Get this storage type’s underlying value type, panicking if it is not a value type.
Sourcepub fn unpack(&self) -> &ValType
Available on crate feature runtime
only.
pub fn unpack(&self) -> &ValType
runtime
only.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.
Sourcepub fn matches(&self, other: &Self) -> bool
Available on crate feature runtime
only.
pub fn matches(&self, other: &Self) -> bool
runtime
only.Does this field type match the other field type?
That is, is this field type a subtype of the other field type?
§Panics
Panics if either type is associated with a different engine from the other.
Sourcepub fn eq(a: &Self, b: &Self) -> bool
Available on crate feature runtime
only.
pub fn eq(a: &Self, b: &Self) -> bool
runtime
only.Is field type a
precisely equal to field type b
?
Returns false
even if a
is a subtype of b
or vice versa, if they
are not exactly the same field type.
§Panics
Panics if either type is associated with a different engine from the other.
Trait Implementations§
Source§impl Clone for StorageType
Available on crate feature runtime
only.
impl Clone for StorageType
runtime
only.Source§fn clone(&self) -> StorageType
fn clone(&self) -> StorageType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Display for StorageType
Available on crate feature runtime
only.
impl Display for StorageType
runtime
only.Source§impl From<RefType> for StorageType
Available on crate feature runtime
only.
impl From<RefType> for StorageType
runtime
only.Source§impl From<ValType> for StorageType
Available on crate feature runtime
only.
impl From<ValType> for StorageType
runtime
only.Source§impl Hash for StorageType
Available on crate feature runtime
only.
impl Hash for StorageType
runtime
only.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
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