Struct minecraft_server_query::BasicStat
source · [−]pub struct BasicStat {
pub motd: String,
pub gametype: String,
pub map: String,
pub numplayers: u32,
pub maxplayers: u32,
pub hostport: u16,
pub hostip: String,
}
Expand description
Basic status information on a minecraft server
Fields
motd: String
Server MoTD as displayed in the in-game server browser
gametype: String
The server’s gametype, hardcoded to "SMP"
map: String
Name of the default world
numplayers: u32
How many players are currently online
maxplayers: u32
Maximum number of players this server supports
hostport: u16
Port the server is listening on
hostip: String
IP that the server may receive connections on
Implementations
sourceimpl BasicStat
impl BasicStat
sourcepub fn from_payload(payload: &[u8]) -> Result<Self>
pub fn from_payload(payload: &[u8]) -> Result<Self>
Parse a basic stat struct from a UDP payload. Fails if fields are missing, returning an IO error for missing data
let payload = b"A Minecraft Server\0SMP\0world\02\020\0\xDD\x63127.0.0.1\0";
assert_eq!(
BasicStat::from_payload(&payload[..])?,
BasicStat {
motd: "A Minecraft Server".to_string(),
gametype: "SMP".to_string(),
map: "world".to_string(),
numplayers: 2,
maxplayers: 20,
hostport: 25565,
hostip: "127.0.0.1".to_string(),
}
);
Trait Implementations
impl Eq for BasicStat
impl StructuralEq for BasicStat
impl StructuralPartialEq for BasicStat
Auto Trait Implementations
impl RefUnwindSafe for BasicStat
impl Send for BasicStat
impl Sync for BasicStat
impl Unpin for BasicStat
impl UnwindSafe for BasicStat
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more