Crate sandkasten_client
source ·Expand description
§Sandkasten Client
Sandkasten client library for running untrusted code
§Example
use sandkasten_client::{
schemas::programs::{BuildRequest, BuildRunRequest, MainFile},
SandkastenClient,
};
#[tokio::main]
async fn main() {
let client = SandkastenClient::new("http://your-sandkasten-instance".parse().unwrap());
let result = client
.build_and_run(&BuildRunRequest {
build: BuildRequest {
environment: "python".into(),
main_file: MainFile {
name: Some("test.py".into()),
content: "print(6 * 7, end='')".into(),
},
..Default::default()
},
run: Default::default(),
})
.await
.unwrap();
assert_eq!(result.run.stdout, "42");
}
Modules§
- Sandkasten request and response schemas.
Structs§
- BlockingSandkastenClient
reqwest
andblocking
A synchronous client for Sandkasten. - SandkastenClient
reqwest
An asynchronous client for Sandkasten.
Enums§
- Error
reqwest
The errors that may occur when using the client.
Constants§
- The version of this client.
Type Aliases§
- Result
reqwest
Type alias forResult<T, sandkasten_client::Error<E>>
.