[Generic] Add struct for all extra request settings (#93)

* [Generic] Add struct for all extra request settings

Adds a new struct `ExtraRequestSettings` that contains all possible
extra settings for all protocols, and can be implicitly converted with
`.into()` into each protocol's extra settings type.

This is then used in a new query method
`query_with_timeout_and_extra_settings()` that passes the object on to
the selected protocol.

This also updates the generic example to set some of these generic
settings so that it can be used for certain queries like
"mc.hypixel.net".

* [Minecraft] Add `request_settings` parameter to auto query

This allows generic queries to pass through request settings when using
the `mc` game so that servers like `mc.hypixel.net` will still work when
using auto query.

* Fix generic examples tests (and enable example tests in pre-commit)
This commit is contained in:
Tom 2023-09-04 22:13:12 +00:00 committed by GitHub
parent 76a3ac2f78
commit 6c1fdb1159
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 175 additions and 20 deletions

View file

@ -19,6 +19,10 @@ Crate:
- Rich errors, capturing backtrace is done on `RUST_BACKTRACE=1`.
- Applied some nursery Clippy lints.
Generics:
- Added `ExtraRequestSettings` containing all possible extra request settings.
- Added `query_with_timeout_and_extra_settings()` to allow generic queries with extra settings.
### Breaking...
Crate:
- The enum used for errors, `GDError` has been renamed to `GDErrorKind`.
@ -56,6 +60,9 @@ Protocols:
- Minecraft Bedrock
1. Renamed `version_protocol` to `protocol_version`.
- Minecraft:
1. Added `request_settings` parameter to `query()`
- The Ship:
1. Renamed `protocol` to `protocol_version`.
2. Renamed `max_players` to `players_maximum` and changed its type from `u64` to `u32`.