-
-
Notifications
You must be signed in to change notification settings - Fork 791
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
How to skip some bytes when deserlializer? #2490
Comments
Hmm... just skip them in your read stream procedure (I believe that by "have a custom deserializer" you mean "implements its own serialization format" and does not wrap another deserializer) |
The deserializer contains two deserializers. The first deserializer is used to read fields and split the binary into dictionaries. The second serializer is used to convert the binary into a structure |
But whether the field is unknown can only be known in the structure. Therefore, other ways may be needed to skip bytes |
Not supported by your deserializer? How your deserializer knows that them are not supported? It read some sign from the data stream? Then skip bytes as soon as you read this sign. The deserialized type will ask deserializer about data that it contain, so deserializer can just not answer "I have some data" if it cannot understand them but skip them instead. |
The form of these data is like this: [(k,v), (k,v)]. where the length of k is fixed and the length of v is explained by k. v is deserialized by one deserializer de1 and (k,v) is deserialized by another deserializer de2. |
I guess I should call let _: Vec:: = map.next_value()? when k is not supported. Thus storing v in a container so that it can be skipped over. But actually something goes wrong. |
I probably figured out what was going on. I will close this issue |
I now have a custom deserializer and a custom Visitor struct. During the deserialization process, some fields in the data stream are not supported, but the length of these fields can be calculated so skip these bytes. Does serde provide some mechanism to skip the these bytes?
IgnoredAny doesn't seem to be used to skip bytes. And if IgnoredAny is used, it will still enter the deserialization process. But I just want those bytes to be simply skipped.
The text was updated successfully, but these errors were encountered: