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

optional serde integration #4

Open
kitlith opened this issue Feb 9, 2021 · 1 comment
Open

optional serde integration #4

kitlith opened this issue Feb 9, 2021 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@kitlith
Copy link
Owner

kitlith commented Feb 9, 2021

prompted by https://rust-lang.github.io/api-guidelines/interoperability.html#c-serde

need to investigate how this would work with serde.

@kitlith
Copy link
Owner Author

kitlith commented Sep 14, 2023

The easiest structure output would essentially be a literal encoding of the cons list. I don't think this is a nice solution, though.

It would make more sense to essentially "look like a struct", but that leaves the issue of providing field names.

A sketch:

trait FieldName {
    const NAME: &'static str;
}

trait Serializable { /* ... */}

impl Serializable for TyEnd { /* ... */ }

impl<T, R> Serializable for Ty<T, R> where T: FieldName, R: Serializable { /* ... */ }

impl<T, R> serde::Serialize for Ty<T, R> where Ty<T, R>: Serializable { /* ... */ }

@kitlith kitlith added enhancement New feature or request good first issue Good for newcomers labels Sep 14, 2023
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
Projects
None yet
Development

No branches or pull requests

1 participant