1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! **Piston Client Library**
//!
//! This library provides an interface for interacting with the Piston execution platform.
//! It allows you to send code written in various programming languages to Piston for execution and receive the results.
//!
//! ## Key Features
//!
//! * **Code execution:** Execute code in various programming languages supported by Piston.
//! * **Version management:** Specify the language version to use.
//! * **File handling:** Send multiple files as part of the code to be executed.
//! * **Language caching:** Optionally cache language information for performance improvements.
//! * **Customization:** Configure the base URL of the API, user agent, and use a custom HTTP client.
//!
//! ## Basic Usage
//!
//! ```ignore
//! use piston_client::Client;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), piston_client::Error> {
//! let mut client = Client::new().await?;
//!
//! // Execute Rust code
//! let code = r#"
//! fn main() {
//! println!("Hello from Piston!");
//! }
//! "#;
//! let response = client.run("rust", code.to_string()).await?;
//!
//! println!("Response: {:?}", response);
//!
//! Ok(())
//! }
//! ```
//!
//! ## Structure
//!
//! The library primarily consists of:
//!
//! * **`Client`:** The main structure representing a Piston client.
//! * **`Data`:** Represents the data to be sent for code execution.
//! * **`FileData`:** Represents a file to be included in the execution.
//! * **`ApiVersion`:** Enumeration representing different versions of the Piston API.
//!
//! ## More Information
//!
//! **Detailed documentation:** For more details on the functionalities and usage of the library, refer to the detailed documentation of each structure and method.
//!
//! **Note:** This is a basic documentation example. You can customize and expand it to include more details and examples as needed.
extern crate reqwest;
/// Use only for GET method
pub const RUNTIMES_PATH: &str = "/piston/runtimes";
/// Use only for POST method
pub const EXECUTE_PATH: &str = "/piston/execute";
pub use Client;
pub use Error;