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

Serialization #4

Closed
llucax opened this issue Nov 30, 2020 · 2 comments · Fixed by #5
Closed

Serialization #4

llucax opened this issue Nov 30, 2020 · 2 comments · Fixed by #5

Comments

@llucax
Copy link
Contributor

llucax commented Nov 30, 2020

I wonder if making the main structs (de)serializable using #[derive(Deserializable, Serializable)] from serde wouldn't be a good addition. I'm new to rust so maybe there is a way to do this easily from outside the crate, so this starts more as a question than a suggestion. I tried to use serde's remote serialization but, besides having to mirror all structs from this library, I bumped into Vec<OpengraphObejct> and I couldn't find a way easily (in a declarative way) define how to (de)serialize that.

I know adding serde as a dependency might not be desired by all users, but maybe it can be added conditionally through a feature flag?

If you think this is a good idea I might even give it a try as a rust exercise :)

PS: Unrelated quick question: any reason why Webpage doesn't derive Debug too? I notice most structs in the library do.

@orottier
Copy link
Owner

orottier commented Dec 4, 2020

Hi @llucax, those are some valid questions.

I won't be able to make the changes myself this week, but please feel free to open a pull request to address serializability and debug.

You can add the serde dependency as an optional crate feature. This may be a starting point: serde-rs/serde#1021

@llucax
Copy link
Contributor Author

llucax commented Dec 4, 2020

#5

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 a pull request may close this issue.

2 participants