minehut 1.0.1

Simple Rust wrapper for the Minehut API
Documentation
![crates.io](https://img.shields.io/crates/v/minehut.svg)

# minehut

Simple Rust wrapper for the Minehut API. View the documentation [by clicking here](https://docs.rs/minehut/1.0.0/minehut/).

This wrapper does nothing more than allow you to retrieve information from the Minehut API in an organised manner using structs. This is my first Rust project, as well as my first API wrapper.

When `handler::all()` is called with the handler [`products`](src/handlers/products.rs) or [`servers::icons`](src/handlers/icons.rs), that information is cached. If you're writing an application that needs the information more than once, the cache will eliminate the need to de serialise all of the data multiple times, resulting in a much shorter wait time. This does not apply to the [`server`](src/handlers/servers.rs) handler because the data there is constantly changing.

# Example

This is an example programme that you can make with this package:

```rust
use minehut::servers; // use servers handler

#[tokio::main]

async fn main() {
    let mut server = String::new();
  
    loop {
        println!("Server name: ");
        
        std::io::stdin()
            .read_line(&mut server)
            .expect("Could not read line");

        // try to get server by name
        let server = match servers::server_from_name(&server).await {
            // server does not exist
            Err(_) => {
                println!("Could not find server, try again.");
                continue;
            },
            // found the server
            Ok(s) => s  
        };
    
        println!("Server found: {server:?}");
    }
}
```

# More examples

Apart from [this](https://docs.rs/minehut/1.0.0/minehut/), there is currently no proper documentation. I intend to add a `/examples` folder in the near future.

# Installation

Add this to your `Cargo.toml` file:
```toml
[dependencies]
minehut = "1.0.0"
```
Keep in mind you'll need [tokio](https://github.com/tokio-rs/tokio) to use the package properly.