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 Human readable Serializers #42

Merged
merged 5 commits into from
Dec 21, 2023
Merged

Add Human readable Serializers #42

merged 5 commits into from
Dec 21, 2023

Conversation

density215
Copy link
Member

@density215 density215 commented Dec 20, 2023

I've changed my mind, and think that the somewhat special Serializers for HopPath and Community should live in routecore. They can be behind a feature flag, so that people don't have to use them. I am still trying to figure out if I can make it so that users can chose which serialization they use.

This would enable roto to use the routecore types directly, otherwise I would have to stick to NewTypes for HopPath and Communities. Also I think it's better if Rotonda doesn't have its own Serializer.

@partim
Copy link
Member

partim commented Dec 21, 2023

An alternative approach would be to provide them as a module for use with Serde’s with attribute if needed. I.e., you derive the impls for the standard serialization and if people want to switch to the alternative impls they tag the path and community attributes of their structs with #[serde(with = "routecore::bgp::communities::human_serde")] or somesuch.

- remove `human_serde` feature
- HumanReadableCommunity type with Serializer impl
- regular derive(Serialize) on Community
- generic communities() and all_communities() on Update
Copy link
Collaborator

@DRiKE DRiKE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, also for fixing those typos!

@density215 density215 merged commit 5e7eafb into main Dec 21, 2023
24 checks passed
@density215 density215 deleted the human-serde branch December 21, 2023 14:00
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