Crates.io | pistones |
lib.rs | pistones |
version | 0.2.1 |
source | src |
created_at | 2024-08-20 03:09:00.278868 |
updated_at | 2024-08-28 02:56:14.749778 |
description | An wrapper for the Piston code execution engine. |
homepage | https://github.com/RustLangES/pistones |
repository | https://github.com/RustLangES/pistones |
max_upload_size | |
id | 1344805 |
size | 50,671 |
Unofficial API Client wrapper from engineer-man/piston
The Piston client provides functionalities to:
reqwest
client for HTTP requests.The library utilizes an asynchronous programming model. Here's a basic example demonstrating how to run a Piston script:
use piston_client::Client;
#[tokio::main]
fn main() -> Result<(), piston_client::Error>> {
let mut client = Client::new()?;
// Get the Rust language version
let rust_version = client.lang_version("rust").await?;
println!("Rust version: {}", rust_version);
// Define the code to run
let code = r#"
fn main() {
println!("Hello, Piston!");
}
"#;
// Run the code
let response = client.run("rust", code.to_string()).await?;
// Process the response
println!("Response: {:?}", response);
Ok(())
}
api_version
method.https://emkc.org
. You can override this with the base_url
method.disable_cache
method.reqwest
for making HTTP requests. You can provide your own reqwest::Client
instance using the custom_client
method.reqwest
client for HTTP requests.FileData
structs.name
and required content
fields.Feel free to contribute to this library by opening pull requests on the relevant Github repository. Make sure to follow the project's contribution guidelines.