pub struct SandboxBuilder { /* private fields */ }Expand description
A builder for creating a new JSSandbox
A builder for a ProtoJSSandbox
Implementations§
Source§impl SandboxBuilder
impl SandboxBuilder
Sourcepub fn with_host_print_fn(self, host_print_fn: HostPrintFn) -> Self
pub fn with_host_print_fn(self, host_print_fn: HostPrintFn) -> Self
Set the host print function
Sourcepub fn with_guest_output_buffer_size(
self,
guest_output_buffer_size: usize,
) -> Self
pub fn with_guest_output_buffer_size( self, guest_output_buffer_size: usize, ) -> Self
Set the guest output buffer size
Sourcepub fn with_guest_input_buffer_size(
self,
guest_input_buffer_size: usize,
) -> Self
pub fn with_guest_input_buffer_size( self, guest_input_buffer_size: usize, ) -> Self
Set the guest input buffer size This is the size of the buffer that the guest can write to to send data to the host The host can read from this buffer The guest can write to this buffer
Sourcepub fn with_guest_stack_size(self, guest_stack_size: u64) -> Self
pub fn with_guest_stack_size(self, guest_stack_size: u64) -> Self
Set the guest stack size This is the size of the stack that code executing in the guest can use. If this value is too small then the guest will fail with a stack overflow error The default value (and minimum) is set to the value of the MIN_STACK_SIZE const.
Sourcepub fn with_guest_heap_size(self, guest_heap_size: u64) -> Self
pub fn with_guest_heap_size(self, guest_heap_size: u64) -> Self
Set the guest heap size This is the size of the heap that code executing in the guest can use. If this value is too small then the guest will fail, usually with a malloc failed error The default (and minimum) value for this is set to the value of the MIN_HEAP_SIZE const.
Sourcepub fn set_interrupt_vcpu_sigrtmin_offset(&mut self, offset: u8) -> Result<()>
pub fn set_interrupt_vcpu_sigrtmin_offset(&mut self, offset: u8) -> Result<()>
Sets the offset from SIGRTMIN to determine the real-time signal used for
interrupting the VCPU thread.
The final signal number is computed as SIGRTMIN + offset, and it must fall within
the valid range of real-time signals supported by the host system.
Returns Ok(()) if the offset is valid, or an error if it exceeds the maximum real-time signal number.
Sourcepub fn with_interrupt_retry_delay(self, delay: Duration) -> Self
pub fn with_interrupt_retry_delay(self, delay: Duration) -> Self
Sets the interrupt retry delay This controls the delay between sending signals to the VCPU thread to interrupt it.
Sourcepub fn get_config(&self) -> &SandboxConfiguration
pub fn get_config(&self) -> &SandboxConfiguration
Get the current configuration
Sourcepub fn build(self) -> Result<ProtoJSSandbox>
pub fn build(self) -> Result<ProtoJSSandbox>
Build the ProtoJSSandbox