Crate iseven_api

Source
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

Structs§

IsEvenApiBlockingClient
Blocking API client for isEven API.
IsEvenApiClient
Asynchronous API client for isEven API.
IsEvenApiErrorResponse
Struct containing the error response from the API.
IsEvenApiResponse
Struct containing the return response from the API.

Enums§

IsEvenApiError
An error type containing errors which can result from the API call.

Functions§

is_even
Checks if a number is even.
is_odd
Checks if a number is odd.