Skip to main content

PingProtocol

Trait PingProtocol 

Source
pub trait PingProtocol: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn ping(
        &self,
        target: &ResolvedTarget,
        timeout: Duration,
        proxy: Option<&ProxyConfig>,
    ) -> impl Future<Output = Result<PingResult, McError>> + Send;
}
Expand description

Low-level wire protocol for pinging a Minecraft server.

Implementors should be unit structs (zero-size, Copy, no heap allocation per call). Proxy config is passed by reference — no cloning.

Returns a PingResult which carries:

  • data — typed edition-specific payload (ServerData)
  • latency — round-trip time in milliseconds (monotonic)
  • meta — escape hatch for unstructured/future protocol fields

Required Methods§

Source

fn name(&self) -> &'static str

Short human-readable identifier, e.g. "java-modern", "bedrock", "query". Used as part of the response-cache key.

Source

fn ping( &self, target: &ResolvedTarget, timeout: Duration, proxy: Option<&ProxyConfig>, ) -> impl Future<Output = Result<PingResult, McError>> + Send

Execute the ping against an already-resolved target.

proxy is None when no proxy is configured or the proxy feature is disabled — implementors should fall back to a direct connection.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§