I’m working on serializing and deserializing the EDN format using serde.
I’m having a hard time figuring out how to use serde to deserialize EDN’s different sequence types.
Summarizing the problem as best I can: say JSON gains support for Sets, represented by
( ) in a JSON string. For
(“foo”, “bar”, “baz”) I’d like to deserialize in the same way as serde_json does for its
Value::Array when it detects a
[ in the input. The only difference is I want to return a
Value::Set when I see a
( in the input.
What seems important:
visit_seq works wonderfully. It returns a
Value::Array(Vec<Value>) by using serde’s traits and their implementations, handling recursion.
Here, we want the same basic thing. The only difference: Instead of a
Value::Array we want to return a
What’s the best way to achieve this?
Any help is greatly appreciated!