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 Serialize/Deserialize trait bounds to ragnarok_packets::Packet #81

Open
vE5li opened this issue May 31, 2024 · 3 comments
Open

Add Serialize/Deserialize trait bounds to ragnarok_packets::Packet #81

vE5li opened this issue May 31, 2024 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@vE5li
Copy link
Owner

vE5li commented May 31, 2024

There is currently no use case for this but I can imagine something like converting the packets to JSON for debugging or data collection, and there is really no reason the packets shouldn't implement Serde traits.

This ticket is pretty easy, just a bit of manual labor (much less when using a good Regex I assume).

@vE5li vE5li added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels May 31, 2024
@aleDsz
Copy link
Contributor

aleDsz commented May 31, 2024

I can see this being used to communicate with RO using WebSocket (jokes) 😆

@arpd
Copy link

arpd commented Jun 16, 2024

I don't think this is quite as simple as suggested.

serde only supports arrays of up to [_; 32]. In other words, any arrays with N > 32 means defining a new struct that implements Serialize, Deserialize, in addition to e.g.:

  • ElementDisplay
  • PrototypeElement

As an example, see ragnarok_packets/lib.rs::struct CharacterSelectionPacket and CharacterServerInformation.

Still a good issue, but you probably want some familiarity with serde before tackling it.

@vE5li
Copy link
Owner Author

vE5li commented Jun 17, 2024

Good point!

To be honest I thought serde would have moved to using const generics by now. I will link an issue providing a possible solution and an explainiation as to why it's a problem in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants