| Crates.io | playground-api |
| lib.rs | playground-api |
| version | 0.3.4 |
| created_at | 2025-05-15 07:08:07.877112+00 |
| updated_at | 2025-05-26 09:52:09.27709+00 |
| description | Simple API-binding for The Rust Playground |
| homepage | |
| repository | https://github.com/kingananas20/playground-api |
| max_upload_size | |
| id | 1674591 |
| size | 139,348 |
playground-api is a Rust crate designed to simplify interaction with the Rust Playground API. It provides an easy-to-use interface for executing Rust code snippets programmatically. It supports async and blocking Clients.
Add the following to your Cargo.toml:
[dependencies]
playground-api = "0.2" # Replace with the latest version
To use the crate, first ensure you have an internet connection as it interacts with the Rust Playground API. Below is a simple example showcasing the .execute feature:
// Create a new ExecuteRequest with the default values
let req = ExecuteRequest::default();
// Create a new client with an url to the playground of your choice (here the official one)
let client = Client::new("https://play.rust-lang.org/");
// send the ExecuteRequest to the playground server and receive the result
let res = client.execute(&req).await.unwrap();
Hello, world!
The following methods are supported
client.execute // Execute code
client.compile // Compile code to different targets
client.format // Format code using rustfmt
client.clippy // Use clippy on your code
client.miri // Run your code with the Miri interpreter
client.macro_expansion // Expand your used macros
client.crates // Get the available crates
client.versions // Get the current rustc, rustfmt, clippy and miri versions
client.gist_create // Create a new gist with your code
client.gist_get // Get a gist with an id
For full documentation, including advanced usage and customization, visit docs.rs.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.