pub struct Sandbox { /* private fields */ }Expand description
A sandbox instance that enforces security policies during execution.
Implementations§
Source§impl Sandbox
impl Sandbox
Sourcepub fn new(config: SandboxConfig) -> Result<Self>
pub fn new(config: SandboxConfig) -> Result<Self>
Create a new sandbox with the given configuration.
Sourcepub fn config(&self) -> &SandboxConfig
pub fn config(&self) -> &SandboxConfig
Get the sandbox configuration.
Sourcepub fn check_read(&self, path: &Path) -> Result<()>
pub fn check_read(&self, path: &Path) -> Result<()>
Check read permission and return an error if denied.
Sourcepub fn check_write(&self, path: &Path) -> Result<()>
pub fn check_write(&self, path: &Path) -> Result<()>
Check write permission and return an error if denied.
Sourcepub fn check_connect(&self, host: &str) -> Result<()>
pub fn check_connect(&self, host: &str) -> Result<()>
Check network connection permission and return an error if denied.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sandbox
impl RefUnwindSafe for Sandbox
impl Send for Sandbox
impl Sync for Sandbox
impl Unpin for Sandbox
impl UnwindSafe 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