1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
use craterequest;
use crate;
pub use icons;
/// Gets all online servers on Minehut asynchronously.
///
/// # Example
///
/// ```
/// #[tokio::main]
/// async fn main() {
/// // get all servers and print their player count
/// minehut::servers::all().await.into_iter().for_each(|s| {
/// println!("{} players on {}", s.player_data.player_count, s.name);
/// });
/// }
/// ```
pub async
/// Gets a server from the specified name asynchronously.
///
/// # Arguments
///
/// * `name` - Name of the server
///
/// # Example
///
/// ```
/// async fn wife() {
/// // get server named "Wife"
/// let server = minehut::servers::server_from_name("Wife").await;
///
/// // server might not exist, so we do a check
/// match server {
/// Ok(s) => println!("{}", s.player_count),
/// Err(_) => println!("Could not find server named Wife")
/// }
/// }
/// ```
///
/// # Errors
///
/// `servers::server_from_name(&str)` returns an error if the server name
/// passed as a parameter does not link to any servers.
pub async
/// Gets a server from the specified server ID.
///
/// # Arguments
///
/// * `id` - ID of the server
///
/// # Example
///
/// ```
/// #[tokio::main]
/// async fn main() {
/// // getting a server from an ID
/// let server = minehut::servers::server_from_id("93nmIi2meopOs3").await;
///
/// // server may not exist
/// match server {
/// Ok(s) => println!("{}", s.player_count),
/// Err(_) => println!("AAAAA!!")
/// }
/// }
/// ```
///
/// # Errors
///
/// `servers::server_from_id(&str)` returns an error if the server id passed
/// does not correlate to any servers.
pub async