sandkasten-client

Crates.iosandkasten-client
lib.rssandkasten-client
version0.2.2
sourcesrc
created_at2023-05-07 19:00:26.553513
updated_at2024-07-30 09:49:35.661374
descriptionSandkasten client library for running untrusted code
homepage
repositoryhttps://github.com/Defelo/sandkasten
max_upload_size
id859337
size27,985
Felix Bargfeldt (Defelo)

documentation

https://docs.rs/sandkasten-client/

README

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");
}
Commit count: 550

cargo fmt