Skip to content

Commit

Permalink
fix: run proper formatting on valve_protocol_query example
Browse files Browse the repository at this point in the history
  • Loading branch information
CosminPerRam committed Oct 29, 2023
1 parent a3740c5 commit 4bbe7e1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions examples/valve_protocol_query.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::time::Duration;
use gamedig::protocols::types::TimeoutSettings;
use gamedig::protocols::valve;
use gamedig::protocols::valve::{Engine, GatheringSettings};
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::time::Duration;

fn main() {
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 gather_settings = GatheringSettings {
players: true, // We want to query for players
rules: false, // We don't want to query for rules
players: true, // We want to query for players
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
};

Expand All @@ -18,6 +18,11 @@ fn main() {
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 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:#?}");
}

0 comments on commit 4bbe7e1

Please sign in to comment.