wsbx
A type-safe Rust API for controlling Windows Sandbox through the wsb CLI.
This crate is supported on Windows only.
This crate provides:
SandboxEnvironmentfor interacting with running sandbox instancesSandboxEnvironmentBuilderfor starting new sandbox instancesSandboxConfigfor constructing.wsb-compatible configuration XMLSandboxIdfor working with sandbox identifiers returned bywsb
The configuration model in config follows the Windows Sandbox .wsb
configuration format documented by Microsoft. For details, see
Use and configure Windows Sandbox.
The runtime API in this crate wraps the Windows Sandbox CLI. For command behavior and arguments, see Windows Sandbox command line interface.
Examples
Start a sandbox with a typed configuration:
use ;
let environment = builder
.config
.start?;
Attach to an existing sandbox by ID and execute a command:
use ;
let id: SandboxId = "12345678-1234-1234-1234-1234567890ab".parse?;
let environment = from_id;
let result = environment.exec?;
let _exit_code = result.exit_code;
Usage
Add this to your Cargo.toml:
[]
= "0.1.0"
Minimum supported Rust version (MSRV)
The minimum supported Rust version is Rust 1.87.0. At least the last 3 versions of stable Rust are supported at any given time.
While a crate is a pre-release status (0.x.x) it may have its MSRV bumped in a patch release. Once a crate has reached 1.x, any MSRV bump will be accompanied by a new minor version.
License
This project is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
See CONTRIBUTING.md.