vastly improved enum support, serializer returns the value#5
Open
miko3k wants to merge 3 commits into
Open
Conversation
Sytten
reviewed
Jun 1, 2026
Member
Sytten
left a comment
There was a problem hiding this comment.
I reviewed the deserializer and it looks good, just one small comment to change.
I still need to review the serializer, sorry this is taking longer that I would wish.
| @@ -592,60 +606,69 @@ fn get_index<'a>(obj: &Object<'a>, idx: usize) -> rquickjs::Result<Value<'a>> { | |||
| } | |||
|
|
|||
| /// A helper struct for deserializing enums containing unit variants. | |||
Author
There was a problem hiding this comment.
yep. I adjsuted the comment. Like I understand my changes to serializer are significant, but trying to keep current previous architecture while supporting enum full would be very challenging for the whole state managment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
What a cool crate you guys made.
My idea was to add proper enum serialization and deserialization.
Deserialization was fairly straightforward.
Serialization turned out to be a bit more difficult, as I couldn’t quite wrap my head around state management in the Serializer. This commit reworks the approach and reimplements the logic in a tree-builder style. Note that this also introduces an API change, as the Serializer now returns the resulting value, just like the Deserializer does.
Unit tests are included.
Assisted by: ChatGPT was used to answer questions; no vibe coding took place.
Cheers.