Expand description
A Rust wrapper for isEven API.
Includes the library as well as a simple command line app.
§Examples
use std::error::Error;
use iseven_api::IsEvenApiClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
// Initialise the client
let client = IsEvenApiClient::new();
// Make requests
let odd_num = client.get(41).await?;
let even_num = client.get(42).await?;
assert!(odd_num.isodd());
assert!(even_num.iseven());
Ok(())
}
§Crate features
- blocking - Enables
IsEvenApiBlockingClient
which is a blocking alternative toIsEvenApiClient
and does not require async runtime. It also enables ‘convenience’ functionsis_odd
andis_even
.
Structs§
- IsEven
ApiBlocking Client - Blocking API client for isEven API.
- IsEven
ApiClient - Asynchronous API client for isEven API.
- IsEven
ApiError Response - Struct containing the error response from the API.
- IsEven
ApiResponse - Struct containing the return response from the API.
Enums§
- IsEven
ApiError - An error type containing errors which can result from the API call.