mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
[Crate] Enforce formatting in CI (#46)
* [CI] Check formatting * Format all files
This commit is contained in:
parent
a6279177bb
commit
b95b2abe0f
76 changed files with 251 additions and 170 deletions
|
|
@ -1,9 +1,9 @@
|
|||
use std::net::{IpAddr, SocketAddr};
|
||||
use crate::protocols::types::TimeoutSettings;
|
||||
use crate::protocols::valve::{Engine, Environment, Server, ValveProtocol};
|
||||
use crate::GDResult;
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::net::{IpAddr, SocketAddr};
|
||||
|
||||
/// The query response.
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
|
|
@ -47,8 +47,15 @@ pub fn query(address: &IpAddr, port: Option<u16>) -> GDResult<Response> {
|
|||
query_with_timeout(address, port, TimeoutSettings::default())
|
||||
}
|
||||
|
||||
pub fn query_with_timeout(address: &IpAddr, port: Option<u16>, timeout_settings: TimeoutSettings) -> GDResult<Response> {
|
||||
let mut client = ValveProtocol::new(&SocketAddr::new(*address, port.unwrap_or(5478)), Some(timeout_settings))?;
|
||||
pub fn query_with_timeout(
|
||||
address: &IpAddr,
|
||||
port: Option<u16>,
|
||||
timeout_settings: TimeoutSettings,
|
||||
) -> GDResult<Response> {
|
||||
let mut client = ValveProtocol::new(
|
||||
&SocketAddr::new(*address, port.unwrap_or(5478)),
|
||||
Some(timeout_settings),
|
||||
)?;
|
||||
let mut buffer = client.get_request_data(
|
||||
&Engine::GoldSrc(true),
|
||||
0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue