pub struct PersistentInstance { /* private fields */ }Expand description
A persistent guest instance over a single Sandbox, driving the generic
packed-op ABI.
Holds the long-lived Store/Instance so guest state survives across calls.
call_op ships the argument into guest memory, calls
op(op_code, ptr, len) -> i64, decodes the packed (out_ptr<<32)|out_len reply,
reads [tag][payload], then deallocs the reply buffer — returning (tag, payload). This crate assigns NO meaning to op_code or tag beyond the shared
TAG_OK convention; a language profile crate (e.g. hyprstream-workers-python)
layers its own op codes / result decoding on top.
A PersistentInstance must be driven from a NON-async thread if its sandbox holds
a VFS capability (the vfs_* host fns blocking_send).
Implementations§
Source§impl PersistentInstance
impl PersistentInstance
Sourcepub fn call_op(
&mut self,
export: &str,
op: i32,
arg: &[u8],
) -> Result<(u8, Vec<u8>)>
pub fn call_op( &mut self, export: &str, op: i32, arg: &[u8], ) -> Result<(u8, Vec<u8>)>
Call the named packed-op export (i32 op, i32 ptr, i32 len) -> i64 with arg
shipped into guest memory under a fresh per-call fuel budget; decode the
(out_ptr<<32)|out_len reply into (tag, payload).
Returns Err if the guest TRAPPED (fuel exhaustion, un-granted import, etc.)
or the reply was malformed (empty / out of bounds).
Auto Trait Implementations§
impl Freeze for PersistentInstance
impl !RefUnwindSafe for PersistentInstance
impl Send for PersistentInstance
impl !Sync for PersistentInstance
impl Unpin for PersistentInstance
impl UnsafeUnpin for PersistentInstance
impl !UnwindSafe for PersistentInstance
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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
§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