* Add rich error type with source and backtrace
Adds a rich error type that will take a backtrace and allow capturing
the source of the error. The best way to use this is with the included
helpers that will automatically capture the backtrace and convert the
source error:
```
GDRichError::packet_bad_from_into("Reason packet was bad")
```
* [Crate] Bump MSRV to 1.65.0
This is required for backtraces in rich errors.
* Remove leftover debug logging
* [Errors] Replace variant overloads with single .rich method on kind enum
This overhaul replaces the exhaustive impls of each variant as multiple
methods on the rich error type with a singular .rich() method on the
kind enum. This consumes the variant and converts it to a rich error
with a source (.into() can be used if a source is not needed).
I also took the liberty of replacing all usages with the this new method
as I saw fit (adding various error messages) and converting a few
PacketBad errors to TypeParse errors when they are the result of parse
failing.
* Fix problem with rustdoc
* Remove BadGame's owned string
* Rename GDError to GDErrorKind
* Rename GDRichError to GDError
* Remove error impl from GDErrorKind
* Fix tests not passing
* Use error context everywhere map_err is used
* Improve GDError display formatter
* Add tests for new error type
* [CI] Improve checks
- Adds .actrc so CI actions can be tested locally
- Adds testing for variants of features so changes that break feature
sets like disabling games can be caught
- Adds more of the CI tests to pre-commit
* [CI] Add more feature sets to test
* [CI] Check github actions before comitting
Requires act: https://github.com/nektos/act
* [CI] Add caching between builds
* [CI] Add caching everywhere
* [CI] Add more feature tests
* [CI] Add YAML schemas
* [CI] Disable audit when running locally
This is needed because the audit action requires a GITHUB_TOKEN which we
don't have when running locally.
* [CI] Move clippy to own job and use action that annotates PRs
Using actions-rs/clippy-check means that PRs will problems will
automatically have the relevant lines annotated
* [CI] Don't unnecessarily cache targets for fmt
Adding query functions with timeout settings to proprietary games allows
the generic query with timeout function to pass the timeout settings
through.
This does change how the pre-existing FFOW query_with_timeout function
worked: it accepted a non-optional timeout settings, this was changed to
optional to be consistent with other query_with_timeout functions and to
move deciding what to do if the user doesn't provide timeout settings to
a more central location.
Closes#64
* [Protocol] Add CUSTOM to protocol enumeration
* [Protocol] Rename CUSTOM to PROPRIETARY
* [Protocol] Rename struct to ProprietaryProtocol and do the same thing to generic response
* [Protocol] Revert proprietary change on generic response
* Implement generic response as enum
* First draft of implementing into_common()
* Make common response type generic
* Use macros and generics to reduce repetition
* [Games] Add dynamically dispatched CommonResponse trait
This adds two traits: "CommonResponse", and "CommonPlayer", when the
generic game query function returns a response it returns a pointer to
its original response type that implements "CommonResponse".
Both common traits require that "as_original()" be implemented, this
returns an enum containing a pointer to the original type.
Both traits have a concrete method "as_json()" that returns a struct
containing data fetched from all of its methods as. This struct
implements serde and can hence be serialized as required.
The traits require a few other methods be implemented, those being the
fields that are common across all types. All other methods have a
default None implementation so that each response type only needs to
implement methods for fields that it has.
* [Game] Implement common traits for JCMP2 response
* [Fmt] Run cargo fmt
* Fix doctest failing
* Run cargo fmt
VERSIONS.md tells you what the current versions for things like MSRV is
and which files you need to update if you change it.
Also fixes the incorrect:
- MSRV in README.md
- nightly version in .pre-commit-config.yaml
These hooks can be installed using [pre-commit], with:
"pre-commit install". Once installed they will prevent you from
committing if the staged code has clippy warnings or hasn't been
formatted. You can skip the pre-commit checks by adding the "-n" flag to
your git commit command.
The hooks also require rustup as the nightly versions of rustfmt and
clippy are used.
[pre-commit]: https://pre-commit.com/
* [Game] Add JC2MP support.
* [Game] Add game to changelog and games
* [Games] Add generic support to JC2MP.
* [Game] Add players_maximum and players_online
* Define games as structs
* Create table of response types
* Ensure serde is always included
* Remove server_ prefix in GenericResponse
* Make players online/max non-optional in generic response
* Use already existing minecraft server enum
* Implement ExtraResponses to prevent cloning when creating generic
* Add game definitions
* Add doc comments to generic types
* Include players in gamespy extra responses
* Add custom response types for TheShip and FFOW
* Cargo format differing files
* Final cleanup
* [Protocol] Add initial files
* [Protocol] Add test to test the request
* [Protocol] Add initial query response type
* [Protocol] Parse teams
* [Protocol] Add players parse and add nice macro
* [Protocol] Add proper derives to structs
* [Protocol] Change to get all informations from one request
* [Protocol] Add Halo: CE support and update CHANGELOG.md
* [Protocol] Remove a .clone usage
* [Protocol] Add todo comment regarding code performance
* [Protocol] Use iterator instead of index range