Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add with-serde feature #120

Merged
merged 11 commits into from
Jun 14, 2021
Merged

Add with-serde feature #120

merged 11 commits into from
Jun 14, 2021

Conversation

Coffelius
Copy link
Contributor

This feature derives the de/serializable traits in each of the command types.

Rust's orphan rule requires that either the trait or the type for which you are implementing the trait must be defined in the same crate as the impl, so it is not possible to implement Serialize and Deserialize for a type in a different crate directly.
https://serde.rs/remote-derive.html

However, even following the remote derive workarounds provided by Serde, it seems that there isn't yet a way to remote derive the structs that contain types nested in Option, Vec, or Map without having to write a lot of boilerplaty code that hard to keep synch with twitch-irc-rs updates.
serde-rs/serde#723

The reason why I need to serialize the commands is because I'm using an architecture in which all the mensajes obtained by twitch-irc-rs are relayed using a publisher pattern and proxy balanced, while there are subscribers that perform all specific logging and bot operations that can be disconnected or replaced.

Pull request checklist:

  • [*] CHANGELOG.md was updated, if applicable

@RAnders00 RAnders00 changed the title Added serde-commands-support feature Added serde feature Jun 14, 2021
@RAnders00 RAnders00 changed the title Added serde feature Added with-serde feature Jun 14, 2021
@RAnders00 RAnders00 changed the title Added with-serde feature Ad with-serde feature Jun 14, 2021
@RAnders00 RAnders00 changed the title Ad with-serde feature Add with-serde feature Jun 14, 2021
@RAnders00 RAnders00 merged commit 415d6da into robotty:master Jun 14, 2021
@RAnders00
Copy link
Collaborator

Thank you! I hope you don't mind that I made some changes...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants