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

Worker: support rkyv in additon to bincode #221

Closed
wants to merge 4 commits into from

Conversation

droogmic
Copy link

@droogmic droogmic commented May 28, 2022

I ran into issue bincode-org/bincode#245 in bincode, which will seemingly not be fixed (serde-rs/serde#1346) without the implementation of a new stricter flatten attribute in serde.

Although I could remove #[serde(flatten)] from my type, but that only sidesteps the problem.

It would be best if gloo_worker supports something other than serde+bincode, so this attempts to add rkyv.

@droogmic
Copy link
Author

Help needed

I don't think I know rust well enough to know how to do this without advice.

What I tried to do is add rkyv as a feature, which then enables different trait bounds through cfg. Part way through the implementation, particularly when adding the SerDe helper trait, I began to wonder if macros weren't a better way to switch between trait bounds.

In it's current state, it doesn't compile. I don't know how to add the rkyv::Deserialize trait bound in with the correct generic type parameters.

https://doc.rust-lang.org/cargo/reference/features.html#mutually-exclusive-features
The documentation hints that mutually exclusive features may best be done using different crates or runtime switching, so I am wondering if there is a better design where the current crate API needs a breaking change to do this properly?

@droogmic
Copy link
Author

There is also #200, which will significantly conflict with this effort.

@droogmic droogmic closed this Jun 16, 2022
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.

1 participant