mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
feat(protocols): Add more control over gathering additional information (#180)
* protocols: Add more control over gathering additional information Adds GatherToggle which allows choosing the behaviour for how the query handles fetching additional information. The choices are: - DontGather - Don't attempt to fetch information - AttemptGather - Try to fetch the information but ignore errors - Required - Try to fetch information and fail if it errors A handy macro was also added to utils to dispatch additional queries based on a GatherToggle value. * Add/Update badge * protocols: Improve GatherToggle enum names Co-Authored-By: Cain <75994858+cainthebest@users.noreply.github.com> Co-Authored-By: CosminPerRam <cosmin.p@live.com> * Add/Update badge --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Cain <75994858+cainthebest@users.noreply.github.com> Co-authored-by: CosminPerRam <cosmin.p@live.com>
This commit is contained in:
parent
6d0c25d6ea
commit
89ed19f089
10 changed files with 195 additions and 64 deletions
|
|
@ -1,3 +1,4 @@
|
|||
use gamedig::protocols::types::GatherToggle;
|
||||
use gamedig::protocols::valve;
|
||||
use gamedig::protocols::valve::{Engine, GatheringSettings};
|
||||
use gamedig::TimeoutSettings;
|
||||
|
|
@ -8,9 +9,9 @@ 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
|
||||
check_app_id: false, // Loosen up the query a bit by not checking app id
|
||||
players: GatherToggle::Enforce, // We want to query for players
|
||||
rules: GatherToggle::Skip, // We don't want to query for rules
|
||||
check_app_id: false, // Loosen up the query a bit by not checking app id
|
||||
};
|
||||
|
||||
let read_timeout = Duration::from_secs(2);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue