diff --git a/src/client.rs b/src/client.rs index 068327b..25ec546 100644 --- a/src/client.rs +++ b/src/client.rs @@ -11,17 +11,17 @@ use crate::{ /// `POST` /api/v2/execute This endpoint requests execution of some arbitrary code. /// /// language (required) The language to use for execution, must be a string and must be installed. -/// version (required) The version of the language to use for execution, must be a string containing a SemVer selector for the version or the specific version number to use. +/// version (required) The version of the language to use for execution, must be a string containing a `SemVer` selector for the version or the specific version number to use. /// files (required) An array of files containing code or other data that should be used for execution. The first file in this array is considered the main file. /// files[].name (optional) The name of the file to upload, must be a string containing no path or left out. /// files[].content (required) The content of the files to upload, must be a string containing text to write. /// files[].encoding (optional) The encoding scheme used for the file content. One of base64, hex or utf8. Defaults to utf8. /// stdin (optional) The text to pass as stdin to the program. Must be a string or left out. Defaults to blank string. /// args (optional) The arguments to pass to the program. Must be an array or left out. Defaults to []. -/// compile_timeout (optional) The maximum time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number or left out. Defaults to 10000 (10 seconds). -/// run_timeout (optional) The maximum time allowed for the run stage to finish before bailing out in milliseconds. Must be a number or left out. Defaults to 3000 (3 seconds). -/// compile_memory_limit (optional) The maximum amount of memory the compile stage is allowed to use in bytes. Must be a number or left out. Defaults to -1 (no limit) -/// run_memory_limit (optional) The maximum amount of memory the run stage is allowed to use in bytes. Must be a number or left out. Defaults to -1 (no limit)#[derive(Serialize)] +/// `compile_timeout` (optional) The maximum time allowed for the compile stage to finish before bailing out in milliseconds. Must be a number or left out. Defaults to 10000 (10 seconds). +/// `run_timeout` (optional) The maximum time allowed for the run stage to finish before bailing out in milliseconds. Must be a number or left out. Defaults to 3000 (3 seconds). +/// `compile_memory_limit` (optional) The maximum amount of memory the compile stage is allowed to use in bytes. Must be a number or left out. Defaults to -1 (no limit) +/// `run_memory_limit` (optional) The maximum amount of memory the run stage is allowed to use in bytes. Must be a number or left out. Defaults to -1 (no limit)#[derive(Serialize)] #[derive(Clone, Serialize)] struct Data { language: String, @@ -98,8 +98,8 @@ impl Client { let runtime_url = build_url(url.as_ref(), self.api_version, RUNTIMES_PATH); let exec_url = build_url("https://emkc.org", self.api_version, EXECUTE_PATH); Self { - runtime_url, exec_url, + runtime_url, ..self } } diff --git a/src/lang.rs b/src/lang.rs index ae72a2f..7bccf4b 100644 --- a/src/lang.rs +++ b/src/lang.rs @@ -23,14 +23,17 @@ pub struct Response { } impl Response { + #[must_use] pub fn language(&self) -> &str { self.language.as_ref() } + #[must_use] pub fn version(&self) -> &str { self.version.as_ref() } + #[must_use] pub fn data(&self) -> &RunData { &self.run } @@ -42,6 +45,7 @@ pub struct ErrorResponse { } impl ErrorResponse { + #[must_use] pub fn message(&self) -> &str { self.message.as_ref() } @@ -56,18 +60,22 @@ pub struct RunData { } impl RunData { + #[must_use] pub fn stdout(&self) -> &str { self.stdout.as_ref() } + #[must_use] pub fn output(&self) -> &str { self.output.as_ref() } + #[must_use] pub fn code(&self) -> u8 { self.code } + #[must_use] pub fn signal(&self) -> Option<&str> { self.signal.as_deref() } diff --git a/tests/api.rs b/tests/api.rs index 278430e..7186cc1 100644 --- a/tests/api.rs +++ b/tests/api.rs @@ -48,6 +48,6 @@ mod client_tests { ) .await; - assert!(client.is_ok()) + assert!(client.is_ok()); } }