Crate sandkasten_client

Source
Expand description

check test codecov Version dependency status

§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§

schemas
Sandkasten request and response schemas.

Structs§

BlockingSandkastenClientreqwest and blocking
A synchronous client for Sandkasten.
SandkastenClientreqwest
An asynchronous client for Sandkasten.

Enums§

Errorreqwest
The errors that may occur when using the client.

Constants§

VERSION
The version of this client.

Type Aliases§

Resultreqwest
Type alias for Result<T, sandkasten_client::Error<E>>.