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
//! One-shot facade functions for single pings without a client.
//!
//! [`ping_java`] and [`ping_bedrock`] use a lazily-initialised process-global
//! [`McClient`] with default settings (10 s timeout, no response cache).
//!
//! Use these when you need a quick one-off ping without setting up a client.
//! For repeated pings, custom timeouts, caching, or proxy support, construct
//! a client with [`McClient::builder()`].
use OnceCell;
use McClient;
use crateMcError;
use crate;
/// Process-global client shared by all facade calls.
/// Initialised once on first use with all-default settings.
static DEFAULT_CLIENT: = const_new;
async
/// Ping a Java Edition server with a single call — no client setup required.
///
/// Uses a shared global client with default settings (10 s timeout, no
/// response cache, no proxy). For custom settings use [`McClient::builder()`].
///
/// # Errors
///
/// See [`McError`] — most commonly [`NetworkError::Timeout`](crate::error::NetworkError::Timeout)
/// or [`NetworkError::Dns`](crate::error::NetworkError::Dns).
///
/// # Example
///
/// ```rust,no_run
/// use rust_mc_status::{ping_java, StatusExt};
///
/// # #[tokio::main] async fn main() -> Result<(), rust_mc_status::McError> {
/// let status = ping_java("mc.hypixel.net").await?;
/// println!("{}", status); // Display: "mc.hypixel.net [42 ms] 21000/200000 — …"
/// println!("{}", status.display_players()); // "21000/200000"
/// println!("{:.1} ms", status.latency_ms()); // "42.3 ms"
/// # Ok(()) }
/// ```
pub async
/// Ping a Bedrock Edition server with a single call — no client setup required.
///
/// Uses a shared global client with default settings (10 s timeout, no
/// response cache, no proxy). For custom settings use [`McClient::builder()`].
///
/// # Errors
///
/// See [`McError`] — Bedrock uses UDP so network errors may differ from Java.
///
/// # Example
///
/// ```rust,no_run
/// use rust_mc_status::{ping_bedrock, StatusExt};
///
/// # #[tokio::main] async fn main() -> Result<(), rust_mc_status::McError> {
/// let status = ping_bedrock("geo.hivebedrock.network").await?;
/// println!("{}", status.edition()); // "MCPE"
/// println!("{}", status.display_players()); // "14000/unlimited"
/// println!("{}", status.motd_clean()); // "The Hive"
/// # Ok(()) }
/// ```
pub async