Crates.io | iseven_api |
lib.rs | iseven_api |
version | 0.7.0 |
source | src |
created_at | 2021-11-26 07:12:09.481431 |
updated_at | 2024-02-05 02:48:50.747869 |
description | A Rust wrapper for isEven API |
homepage | https://github.com/megascrapper/iseven-api-rust |
repository | https://github.com/megascrapper/iseven-api-rust |
max_upload_size | |
id | 487934 |
size | 75,239 |
A Rust wrapper for isEven API.
Includes the library as well as a simple command-line front end.
cargo install iseven_api --all-features
git clone https://github.com/megascrapper/iseven-api-rust
cd iseven-api
cargo build --all-features
Checks whether a number is even or odd using isEven API (https://isevenapi.xyz/)
Usage: iseven_api [OPTIONS] <NUMBER>
Arguments:
<NUMBER> Number to check
Options:
--json Print JSON response
-h, --help Print help
cargo add iseven_api
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(())
}
https://docs.rs/iseven_api/latest/iseven_api/
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.