Expand description
craftping provides a ping
function to send Server List Ping requests to a Minecraft server.
§Feature flags
sync
(default): Enables synchronous, blockingping
function.async-tokio
: Enables asynchronous,tokio
-basedping
function.async-futures
: Enables asynchronous,futures
-basedping
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§
- futures
async-futures
- Provides asynchronous
ping
function. (especially for futures-io compatible streams) - sync
sync
- Provides synchronous, blocking
ping
function. - tokio
async-tokio
- Provides asynchronous
ping
function. (especially for tokio streams)
Structs§
- Forge
Channel - The information of the channels used by the mods.
- Forge
Data - The forge information object used in FML2 protocol (version 1.13 - current).
- Forge
Mod - The information of an installed mod.
- ModInfo
- The mod information object used in FML protocol (version 1.7 - 1.12).
- ModInfo
Item - 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.