Struct craftping::Response

source ·
#[non_exhaustive]
pub struct Response { pub version: String, pub protocol: i32, pub enforces_secure_chat: Option<bool>, pub previews_chat: Option<bool>, pub max_players: usize, pub online_players: usize, pub sample: Option<Vec<Player>>, pub description: Chat, pub favicon: Option<Vec<u8>>, pub mod_info: Option<ModInfo>, pub forge_data: Option<ForgeData>, /* private fields */ }
Expand description

A ping response returned from server. The response schema can be altered anytime, thus #[non_exhaustive].

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§version: String

The version name of the server.

§protocol: i32

The protocol number of the server. See also the minecraft protocol wiki for the actual values.

§enforces_secure_chat: Option<bool>

If the server requires the user to sign chat messages with their private key.

§previews_chat: Option<bool>§max_players: usize

The maximum number of the connected players.

§online_players: usize

The number of the players currently connected.

§sample: Option<Vec<Player>>

The sample of the connected players. Note that it can be None even if some players are connected.

§description: Chat

The description (aka MOTD) of the server. See also the minecraft protocol wiki for the Chat format.

§favicon: Option<Vec<u8>>

The favicon of the server in PNG format.

§mod_info: Option<ModInfo>

The mod information object used in FML protocol (version 1.7 - 1.12). See also the minecraft protocol wiki for the ModInfo format.

§forge_data: Option<ForgeData>

The forge information object used in FML2 protocol (version 1.13 - current). See also the minecraft protocol wiki for the ForgeData format.

Implementations§

source§

impl Response

source

pub fn raw(&self) -> &[u8]

The raw response returned from the server. It is Vec<u8> because server is not guaranteed to return valid UTF-8, even not a json at all.

Trait Implementations§

source§

impl Clone for Response

source§

fn clone(&self) -> Response

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Response

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Response

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for Response

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,