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
//! [`StatusExt`] trait and Minecraft text formatting helpers.
//!
//! [`strip_formatting`] and [`truncate_str`] are pure string utilities defined
//! in [`core::fmt`](crate::core::fmt) and re-exported here for convenience.
pub use crate;
/// Common interface shared by [`JavaServerStatus`](super::JavaServerStatus)
/// and [`BedrockServerStatus`](super::BedrockServerStatus).
///
/// Provides access to the fields that exist on every successful ping result
/// regardless of edition. Import this trait to call its methods:
///
/// ```rust,no_run
/// use rust_mc_status::{McClient, StatusExt};
///
/// # #[tokio::main] async fn main() -> Result<(), rust_mc_status::McError> {
/// let client = McClient::builder().build();
/// let s = client.java("mc.hypixel.net").await?;
///
/// // These methods come from StatusExt:
/// println!("{} ms", s.latency_ms() as u32);
/// println!("{}", s.display_players()); // "21000/200000"
/// println!("{}", s.ip());
/// println!("{}", s.hostname());
/// # Ok(()) }
/// ```