Struct holochain_wasmer_host::env::Env
source · pub struct Env {
pub memory: Option<Memory>,
pub allocate: Option<TypedFunction<i32, i32>>,
pub deallocate: Option<TypedFunction<(i32, i32), ()>>,
pub wasmer_metering_points_exhausted: Option<Global>,
pub wasmer_metering_remaining_points: Option<Global>,
}
Fields§
§memory: Option<Memory>
§allocate: Option<TypedFunction<i32, i32>>
§deallocate: Option<TypedFunction<(i32, i32), ()>>
§wasmer_metering_points_exhausted: Option<Global>
§wasmer_metering_remaining_points: Option<Global>
Implementations§
source§impl Env
impl Env
sourcepub fn move_data_to_guest<I>(
&self,
store_mut: &mut StoreMut<'_>,
input: I
) -> Result<GuestPtrLen, RuntimeError>
pub fn move_data_to_guest<I>( &self, store_mut: &mut StoreMut<'_>, input: I ) -> Result<GuestPtrLen, RuntimeError>
Given some input I that can be serialized, request an allocation from the guest and copy the serialized bytes to the allocated pointer. The guest MUST subsequently take ownership of these bytes or it will leak memory.
sourcepub fn consume_bytes_from_guest<O>(
&self,
store_mut: &mut StoreMut<'_>,
guest_ptr: GuestPtr,
len: Len
) -> Result<O, RuntimeError>where
O: DeserializeOwned + Debug,
pub fn consume_bytes_from_guest<O>(
&self,
store_mut: &mut StoreMut<'_>,
guest_ptr: GuestPtr,
len: Len
) -> Result<O, RuntimeError>where
O: DeserializeOwned + Debug,
Given a pointer and length for a region of memory in the guest, copy the
bytes to the host and attempt to deserialize type O
from the data. The
guest will be asked to deallocate the copied bytes whether or not the
deserialization is successful.
sourcepub fn get_remaining_points(
&self,
store_mut: &mut StoreMut<'_>
) -> Result<MeteringPoints, RuntimeError>
pub fn get_remaining_points( &self, store_mut: &mut StoreMut<'_> ) -> Result<MeteringPoints, RuntimeError>
Mimics upstream function of the same name but accesses the global directly from env. https://github.com/wasmerio/wasmer/blob/master/lib/middlewares/src/metering.rs#L285
pub fn set_remaining_points( &self, store_mut: &mut StoreMut<'_>, points: u64 ) -> Result<(), RuntimeError>
pub fn decrease_points( &self, store_mut: &mut StoreMut<'_>, points: u64 ) -> Result<MeteringPoints, RuntimeError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Env
impl RefUnwindSafe for Env
impl Send for Env
impl Sync for Env
impl Unpin for Env
impl UnwindSafe for Env
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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>
Converts
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>
Converts
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 moresource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Upcastable for T
impl<T> Upcastable for T
source§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
source§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref