pub async fn all() -> Result<Vec<ServerData>, Error>
Expand description

Gets a vector of Serverdata struct from Minehut asynchronously. Returns all online servers.

Example

async fn print_servers() {
    // Get all servers and print their player count
    minehut::servers::all().await.unwrap().into_iter().for_each(|s| {
        println!("{} players on {}", s.player_data.player_count, s.name);
    });
}

Errors

Returns an error if Reqwest could not fetch the data or if it could not parse the JSON. This is usually a network problem.