rust-gamedig/examples
Tom b368877031
[Protocol] Implement generic response with dyn (#56)
* 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
2023-06-25 16:31:23 +03:00
..
generic.rs [Protocol] Implement generic response with dyn (#56) 2023-06-25 16:31:23 +03:00
master_querant.rs [Game] Add JC2MP support. (#54) 2023-06-19 22:10:49 +03:00
minecraft.rs [Crate] Changed all address &str to &Ipv4Addr 2023-05-27 00:41:41 +03:00
tf2.rs [Crate] Enforce formatting in CI (#46) 2023-06-10 18:15:12 +03:00
valve_master_server_query.rs [Service] Fix tests 2023-05-08 15:34:59 +03:00