mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
fix: run proper formatting on valve_protocol_query example
This commit is contained in:
parent
a3740c5424
commit
4bbe7e1780
1 changed files with 10 additions and 5 deletions
|
|
@ -1,15 +1,15 @@
|
||||||
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
|
||||||
use std::time::Duration;
|
|
||||||
use gamedig::protocols::types::TimeoutSettings;
|
use gamedig::protocols::types::TimeoutSettings;
|
||||||
use gamedig::protocols::valve;
|
use gamedig::protocols::valve;
|
||||||
use gamedig::protocols::valve::{Engine, GatheringSettings};
|
use gamedig::protocols::valve::{Engine, GatheringSettings};
|
||||||
|
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let address = &SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 27015);
|
let address = &SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 27015);
|
||||||
let engine = Engine::Source(None); // We don't specify a steam app id, let the query try to find it.
|
let engine = Engine::Source(None); // We don't specify a steam app id, let the query try to find it.
|
||||||
let gather_settings = GatheringSettings {
|
let gather_settings = GatheringSettings {
|
||||||
players: true, // We want to query for players
|
players: true, // We want to query for players
|
||||||
rules: false, // We don't want to query for rules
|
rules: false, // We don't want to query for rules
|
||||||
check_app_id: false, // Loosen up the query a bit by not checking app id
|
check_app_id: false, // Loosen up the query a bit by not checking app id
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -18,6 +18,11 @@ fn main() {
|
||||||
let retries = 1; // does another request if the first one fails.
|
let retries = 1; // does another request if the first one fails.
|
||||||
let timeout_settings = TimeoutSettings::new(Some(read_timeout), Some(write_timeout), retries).unwrap();
|
let timeout_settings = TimeoutSettings::new(Some(read_timeout), Some(write_timeout), retries).unwrap();
|
||||||
|
|
||||||
let response = valve::query(address, engine, Some(gather_settings), Some(timeout_settings));
|
let response = valve::query(
|
||||||
|
address,
|
||||||
|
engine,
|
||||||
|
Some(gather_settings),
|
||||||
|
Some(timeout_settings),
|
||||||
|
);
|
||||||
println!("{response:#?}");
|
println!("{response:#?}");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue