mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
[Protocol] Add derives to RequestSettings and new_just_hostname function
This commit is contained in:
parent
2106e965e4
commit
7164ab5f64
2 changed files with 17 additions and 3 deletions
|
|
@ -3,7 +3,9 @@ Who knows what the future holds...
|
||||||
|
|
||||||
# 0.X.Y - DD/MM/YYYY
|
# 0.X.Y - DD/MM/YYYY
|
||||||
### Changes:
|
### Changes:
|
||||||
None, yet...
|
Protocols:
|
||||||
|
- Minecraft Java: Add derives to `RequestSettings` and add `new_just_hostname` that creates new settings just by specifying
|
||||||
|
the hostname, `protocol_version` defaults to -1.
|
||||||
|
|
||||||
### Breaking...
|
### Breaking...
|
||||||
None, yaay!
|
None, yaay!
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,8 @@ pub struct JavaResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Java-only additional request settings.
|
/// Java-only additional request settings.
|
||||||
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
pub struct RequestSettings {
|
pub struct RequestSettings {
|
||||||
/// Some Minecraft servers do not respond as expected if this
|
/// Some Minecraft servers do not respond as expected if this
|
||||||
/// isn't a specific value, `mc.hypixel.net` is an example.
|
/// isn't a specific value, `mc.hypixel.net` is an example.
|
||||||
|
|
@ -99,8 +101,7 @@ pub struct RequestSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for RequestSettings {
|
impl Default for RequestSettings {
|
||||||
/// `hostname`: "gamedig"
|
/// `hostname`: "gamedig"
|
||||||
///
|
|
||||||
/// `protocol_version`: -1
|
/// `protocol_version`: -1
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
@ -110,6 +111,17 @@ impl Default for RequestSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl RequestSettings {
|
||||||
|
/// Make a new *RequestSettings* with just the hostname, the protocol
|
||||||
|
/// version defaults to -1
|
||||||
|
pub fn new_just_hostname(hostname: String) -> Self {
|
||||||
|
Self {
|
||||||
|
hostname,
|
||||||
|
protocol_version: -1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<ExtraRequestSettings> for RequestSettings {
|
impl From<ExtraRequestSettings> for RequestSettings {
|
||||||
fn from(value: ExtraRequestSettings) -> Self {
|
fn from(value: ExtraRequestSettings) -> Self {
|
||||||
let default = Self::default();
|
let default = Self::default();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue