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
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.
Sourcepub fn matches(&self, other: &StorageType) -> bool
pub fn matches(&self, other: &StorageType) -> bool
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: &StorageType, b: &StorageType) -> bool
pub fn eq(a: &StorageType, b: &StorageType) -> bool
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
impl Clone for StorageType
Source§fn clone(&self) -> StorageType
fn clone(&self) -> StorageType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more