pub struct UninitializedSandbox { /* private fields */ }
Expand description
A preliminary Sandbox
, not yet ready to execute guest code.
Prior to initializing a full-fledged Sandbox
, you must create one of
these UninitializedSandbox
es with the new
function, register all the
host-implemented functions you need to be available to the guest, then
call evolve
to transform your
UninitializedSandbox
into an initialized Sandbox
.
Implementations§
Source§impl UninitializedSandbox
impl UninitializedSandbox
Sourcepub fn new(
guest_binary: GuestBinary,
cfg: Option<SandboxConfiguration>,
sandbox_run_options: Option<SandboxRunOptions>,
host_print_writer: Option<&dyn HostFunction1<'_, String, i32>>,
) -> Result<Self>
pub fn new( guest_binary: GuestBinary, cfg: Option<SandboxConfiguration>, sandbox_run_options: Option<SandboxRunOptions>, host_print_writer: Option<&dyn HostFunction1<'_, String, i32>>, ) -> Result<Self>
Create a new sandbox configured to run the binary at path
bin_path
.
The instrument attribute is used to generate tracing spans and also to emit an error should the Result be an error.
The skip attribute is used to skip the guest binary from being printed in the tracing span.
The name attribute is used to name the tracing span.
The err attribute is used to emit an error should the Result be an error, it uses the std::fmt::Debug trait
to print the error.
Sourcepub fn set_max_guest_log_level(&mut self, log_level: LevelFilter)
pub fn set_max_guest_log_level(&mut self, log_level: LevelFilter)
Set the max log level to be used by the guest.
If this is not set then the log level will be determined by parsing the RUST_LOG environment variable.
If the RUST_LOG environment variable is not set then the max log level will be set to LevelFilter::Error
.
Trait Implementations§
Source§impl Debug for UninitializedSandbox
impl Debug for UninitializedSandbox
Source§impl EvolvableSandbox<UninitializedSandbox, MultiUseSandbox, Noop<UninitializedSandbox, MultiUseSandbox>> for UninitializedSandbox
impl EvolvableSandbox<UninitializedSandbox, MultiUseSandbox, Noop<UninitializedSandbox, MultiUseSandbox>> for UninitializedSandbox
Source§fn evolve(
self,
_: Noop<UninitializedSandbox, MultiUseSandbox>,
) -> Result<MultiUseSandbox>
fn evolve( self, _: Noop<UninitializedSandbox, MultiUseSandbox>, ) -> Result<MultiUseSandbox>
Evolve self
to a MultiUseSandbox
without any additional metadata.
Source§impl Sandbox for UninitializedSandbox
impl Sandbox for UninitializedSandbox
Source§impl UninitializedSandbox for UninitializedSandbox
impl UninitializedSandbox for UninitializedSandbox
Source§fn get_uninitialized_sandbox(&self) -> &UninitializedSandbox
fn get_uninitialized_sandbox(&self) -> &UninitializedSandbox
UninitializedSandbox
Source§fn get_uninitialized_sandbox_mut(&mut self) -> &mut UninitializedSandbox
fn get_uninitialized_sandbox_mut(&mut self) -> &mut UninitializedSandbox
UninitializedSandbox
Source§fn is_running_in_process(&self) -> bool
fn is_running_in_process(&self) -> bool
true
if the Sandbox is configured to run in process otherwise false