Struct wiggle::wasmtime::WasmtimeGuestMemory
source · [−]pub struct WasmtimeGuestMemory<'a> { /* private fields */ }
Expand description
Lightweight wasmtime::Memory
wrapper so we can implement the
wiggle::GuestMemory
trait on it.
Implementations
Trait Implementations
sourceimpl GuestMemory for WasmtimeGuestMemory<'_>
impl GuestMemory for WasmtimeGuestMemory<'_>
sourcefn base(&self) -> (*mut u8, u32)
fn base(&self) -> (*mut u8, u32)
Returns the base allocation of this guest memory, located in host memory. Read more
sourcefn has_outstanding_borrows(&self) -> bool
fn has_outstanding_borrows(&self) -> bool
Indicates whether any outstanding borrows are known to the
GuestMemory
. This function must be false
in order for it to be
safe to recursively call into a WebAssembly module, or to manipulate
the WebAssembly memory by any other means. Read more
Check if a region of linear memory has any shared borrows.
sourcefn is_mut_borrowed(&self, r: Region) -> bool
fn is_mut_borrowed(&self, r: Region) -> bool
Check if a region of linear memory is exclusively borrowed. This is called during any
GuestPtr::read
or GuestPtr::write
operation to ensure that wiggle is not reading or
writing a region of memory which Rust believes it has exclusive access to. Read more
Shared borrow a region of linear memory. This is used when constructing a
GuestSlice
or GuestStr
. Those types will give Rust &
(shared reference) access
to the region of linear memory. Read more
sourcefn mut_borrow(&self, r: Region) -> Result<BorrowHandle, GuestError>
fn mut_borrow(&self, r: Region) -> Result<BorrowHandle, GuestError>
Exclusively borrow a region of linear memory. This is used when constructing a
GuestSliceMut
or GuestStrMut
. Those types will give Rust &mut
access
to the region of linear memory, therefore, the GuestMemory
impl must
guarantee that at most one BorrowHandle
is issued to a given region,
GuestMemory::has_outstanding_borrows
is true for the duration of the
borrow, and that GuestMemory::is_mut_borrowed
of any overlapping region
is false for the duration of the borrow. Read more
Unborrow a previously borrowed shared region. As long as GuestSlice
and
GuestStr
are implemented correctly, a shared BorrowHandle
should only be
unborrowed once. Read more
sourcefn mut_unborrow(&self, h: BorrowHandle)
fn mut_unborrow(&self, h: BorrowHandle)
Unborrow a previously borrowed mutable region. As long as GuestSliceMut
and
GuestStrMut
are implemented correctly, a mut BorrowHandle
should only be
unborrowed once. Read more
sourcefn validate_size_align(
&self,
offset: u32,
align: usize,
len: u32
) -> Result<*mut u8, GuestError>
fn validate_size_align(
&self,
offset: u32,
align: usize,
len: u32
) -> Result<*mut u8, GuestError>
Validates a guest-relative pointer given various attributes, and returns the corresponding host pointer. Read more
Auto Trait Implementations
impl<'a> RefUnwindSafe for WasmtimeGuestMemory<'a>
impl<'a> Send for WasmtimeGuestMemory<'a>
impl<'a> Sync for WasmtimeGuestMemory<'a>
impl<'a> Unpin for WasmtimeGuestMemory<'a>
impl<'a> !UnwindSafe for WasmtimeGuestMemory<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more