Function minehut::servers::server_from_id
source · [−]Expand description
Gets a Server struct from the specified server ID asynchronously.
Arguments
id
- ID of the server.
Example
use minehut::Error;
#[tokio::main]
async fn main() {
let server = minehut::servers::server_from_id("93nmIi2meopOs3").await;
match server {
Err(e) => match e {
Error::Json(_) => println!("Failed to de-serialize data."),
Error::Http(_) => println!("HTTP problems.")
},
Ok(s) => println!("{s:?}")
}
}
Errors
servers::server_from_id(&str)
returns Err
if the server ID passed as
a parameter does not link to any servers.