pub enum Direction {
Import,
Export,
}
Expand description
This is the direction from the user’s perspective. Are we importing functions to call, or defining functions and exporting them to be called?
This is only used outside of Generator
implementations. Inside of
Generator
implementations, the Direction
is translated to an
AbiVariant
instead. The ABI variant is usually the same as the
Direction
, but it’s different in the case of the Wasmtime host bindings:
In a wasm-calling-wasm use case, one wasm module would use the Import
ABI, the other would use the Export
ABI, and there would be an adapter
layer between the two that translates from one ABI to the other.
But with wasm-calling-host, we don’t go through a separate adapter layer;
the binding code we generate on the host side just does everything itself.
So when the host is conceptually “exporting” a function to wasm, it uses
the Import
ABI so that wasm can also use the Import
ABI and import it
directly from the host.
These are all implementation details; from the user perspective, and
from the perspective of everything outside of Generator
implementations,
export
means I’m exporting functions to be called, and import
means I’m
importing functions that I’m going to call, in both wasm modules and host
code. The enum here represents this user perspective.
Variants
Import
Export
Trait Implementations
sourceimpl PartialEq<Direction> for Direction
impl PartialEq<Direction> for Direction
impl Copy for Direction
impl Eq for Direction
impl StructuralEq for Direction
impl StructuralPartialEq for Direction
Auto Trait Implementations
impl RefUnwindSafe for Direction
impl Send for Direction
impl Sync for Direction
impl Unpin for Direction
impl UnwindSafe for Direction
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more