Jailer
Project status & info:
| License | Crates Version | Docs |
|---|---|---|
Crate to create a sandbox environment for testing and other use cases. It provides an isolated temporary directory that automatically cleans up upon closure or when the object goes out of scope.
Add as dependencies
Edit Cargo.toml file to add jailer as dependencies
[]
= "0.4.1"
Usage
Jailer allows you to create a temporary directory where all operations occur. Once the jailer instance is dropped or closed, the directory and its contents are automatically deleted.
let jailer = new.unwrap;
// use rust code as required
// Data is deleted when jailer is dropped or when it is closed
jailer.close.unwrap;
Using EnvJailer for Environment Variable Isolation
EnvJailer extends Jailer by also managing environment variables. It ensures that environment changes within the jail do not persist beyond its lifetime.
use EnvJailer;
let mut env_jailer = new.unwrap;
unsafe
env_jailer.set_preserved_env;
assert_eq!;
unsafe
assert_eq!;
unsafe
assert_eq!;
assert!;