pub struct Sandbox { /* private fields */ }Expand description
A capability-free WASM sandbox.
Implementations§
Source§impl Sandbox
impl Sandbox
Sourcepub fn new() -> VtaResult<Sandbox>
pub fn new() -> VtaResult<Sandbox>
Create a sandbox with fuel metering enabled and no host capabilities.
Sourcepub fn run_i32(
&self,
wasm: &[u8],
func: &str,
arg: i32,
fuel: u64,
) -> VtaResult<i32>
pub fn run_i32( &self, wasm: &[u8], func: &str, arg: i32, fuel: u64, ) -> VtaResult<i32>
Run an exported func(i32) -> i32 in a fresh, capability-free instance
under a fuel budget. Instantiation fails if the module imports anything
(no ambient authority is granted); the call traps cleanly if it exhausts
its fuel. Compute-only hooks use this; richer hooks extend the host set.
Auto Trait Implementations§
impl !RefUnwindSafe for Sandbox
impl !UnwindSafe for Sandbox
impl Freeze for Sandbox
impl Send for Sandbox
impl Sync for Sandbox
impl Unpin for Sandbox
impl UnsafeUnpin for Sandbox
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
Mutably borrows from an owned value. Read more
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 more