pub(crate) enum WasmRepr {
Val(ValType),
Struct(Vec<WasmRepr>),
Class(Vec<WasmRepr>),
Nothing,
}Expand description
The WASM representation for a Dada value independent of the place in which it is stored. This isn’t really a specific representation, in some sense, but rather enough information to determine how to represent an instance of this value in any of the places it could appear:
- On the WebAssembly stack or memory, in which case all the flattened values would be pushed/stored one after the other.
- In WebAssembly local variables, in which case a subset of the values would be stored in subsequent variables. Note that the data for classes never appears in locals, and so a single value can be partially stored in locals and partially in memory.
§See also
The WasmPlaceRepr type describes the representation of
particular Dada place (which in turn has an associated Dada type).
Variants§
Val(ValType)
Indicates a single primitive value. This may appear on the WASM stack, a local value, or the memory, depending on the context in which it appears.
Struct(Vec<WasmRepr>)
An aggregate value type. The values needed to represent its fields
are found in the Vec<WasmRepr> argument.
Class(Vec<WasmRepr>)
A class. The data for classes is always stored in WASM memory.
It begins with an (implicit) I32 flag word and then contains
whatever values are needed to represent the fields, stored as a Vec<WasmRepr>.
Nothing
No data at all (something zero-sized).
Implementations§
Source§impl WasmRepr
impl WasmRepr
Sourcepub fn flatten(&self) -> Vec<ValType>
pub fn flatten(&self) -> Vec<ValType>
Primitive WASM values needed for a value with this representation stored on the WASM stack or in memory.
Sourcepub fn local_val_tys(&self) -> Vec<ValType>
pub fn local_val_tys(&self) -> Vec<ValType>
Returns the types of the WASM local variables that would be used to store a value with this representation. Any data found inside of a class is stored in memory and hence not represented in the return type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WasmRepr
impl RefUnwindSafe for WasmRepr
impl Send for WasmRepr
impl Sync for WasmRepr
impl Unpin for WasmRepr
impl UnsafeUnpin for WasmRepr
impl UnwindSafe for WasmRepr
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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