-
Notifications
You must be signed in to change notification settings - Fork 9
Out of order list of tags deserialization error #33
Comments
To what rust code do you expect it to deserialize? I have no clue how to represent interleaved sequences. |
See #26 for a similar/the same case |
I expect/prefer for it to deserialize to: struct States {
state: Vec<State>,
statelist: Statelist,
}
struct Statelist {
state: Vec<State>,
} i.e., merge the sequences into a single |
There can't be multiple state lists? This is very hard to do, I'll think about it, but it'll require some intermediate allocations. The easiest would be to manually implement deserialize for this special case |
There can be multiple statelists, but I simplified it for the purposes of illustrating the example. Here's the full version of what I want. Let me know what you've decided when you've finished thinking about it. If it's indeed too hard to handle then I guess I can write a custom deserializer. |
The serde deserialization framework does not fit your use case with autogenerated deserialize impls. There's no need for a custom deserializer, since that won't help. You need to implement I'd still say that the solution from #26 is cleaner, but I'm not sure on the usability of the struct and enum |
Yeah that's what I meant by "custom deserializer". Ok I'll look into it, thanks. |
Actually, I don't think I can use the solution in #26 because my elements don't specify an |
Yea, you need to write a |
Similar to the generic one here you can simply call a |
Well for what's its worth I ended up implementing |
So I basically have some XML in the form:
which fails to deserialize because the tags go
state
,statelist
,state
.However it deserializes fine if the two
state
tags come first:The text was updated successfully, but these errors were encountered: