Struct rustwide::cmd::SandboxBuilder
source · pub struct SandboxBuilder { /* private fields */ }
Expand description
The sandbox builder allows to configure a sandbox, used later in a
Command
.
Implementations§
source§impl SandboxBuilder
impl SandboxBuilder
sourcepub fn mount(
self,
host_path: &Path,
sandbox_path: &Path,
kind: MountKind
) -> Self
pub fn mount( self, host_path: &Path, sandbox_path: &Path, kind: MountKind ) -> Self
Mount a path inside the sandbox. It’s possible to choose whether to mount the path
read-only or writeable through the MountKind
enum.
sourcepub fn memory_limit(self, limit: Option<usize>) -> Self
pub fn memory_limit(self, limit: Option<usize>) -> Self
Enable or disable the sandbox’s memory limit. When the processes inside the sandbox use more memory than the limit the sandbox will be killed.
By default no memory limit is present, and its size is provided in bytes.
sourcepub fn cpu_limit(self, limit: Option<f32>) -> Self
pub fn cpu_limit(self, limit: Option<f32>) -> Self
Enable or disable the sandbox’s CPU limit. The value of the limit is the fraction of CPU cores the sandbox is allowed to use.
For example, on a 4-core machine, setting a CPU limit of 2.0
will only allow two of the
cores to be used, while a CPU limit of 0.5
will only allow half of a single CPU core to
be used.
sourcepub fn enable_networking(self, enable: bool) -> Self
pub fn enable_networking(self, enable: bool) -> Self
Enable or disable the sandbox’s networking. When it’s disabled processes inside the sandbox won’t be able to reach network service on the Internet or the host machine.
By default networking is enabled.
Trait Implementations§
source§impl Clone for SandboxBuilder
impl Clone for SandboxBuilder
source§fn clone(&self) -> SandboxBuilder
fn clone(&self) -> SandboxBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more