Crate craftping

Source
Expand description

craftping provides a ping function to send Server List Ping requests to a Minecraft server.

§Feature flags

  • sync (default): Enables synchronous, blocking ping function.
  • async-tokio: Enables asynchronous, tokio-based ping function.
  • async-futures: Enables asynchronous, futures-based ping function.

§Examples

use craftping::sync::ping;
use std::net::TcpStream;

fn main() {
    let hostname = "my.server.com";
    let port = 25565;
    let mut stream = TcpStream::connect((hostname, port)).unwrap();
    let response = ping(&mut stream, hostname, port).unwrap();
    println!("Players online: {}", response.online_players);
}

Modules§

futuresasync-futures
Provides asynchronous ping function. (especially for futures-io compatible streams)
syncsync
Provides synchronous, blocking ping function.
tokioasync-tokio
Provides asynchronous ping function. (especially for tokio streams)

Structs§

ForgeChannel
The information of the channels used by the mods.
ForgeData
The forge information object used in FML2 protocol (version 1.13 - current).
ForgeMod
The information of an installed mod.
ModInfo
The mod information object used in FML protocol (version 1.7 - 1.12).
ModInfoItem
The information of an installed mod.
Player
The sample players’ information.
Response
A ping response returned from server. The response schema can be altered anytime, thus #[non_exhaustive].

Enums§

Error
The ping error type.

Type Aliases§

Result
The ping result type.