-
Notifications
You must be signed in to change notification settings - Fork 3.5k
sync human-readable value #8859
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
base: master
Are you sure you want to change the base?
Conversation
|
@jtdavis777 @aardappel Hello, could you spare some time to review this code? |
jtdavis777
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change seems fine... I'm not convinced it closes the original ticket out, but I don't see why adding an additional function to get more info would be a bad thing.
I wasn't really able to follow the discussion on the original issue.
|
Sorry, I forgot to explain the reason for this modification. Here I would like to add: In the serde repository, the is_human_readable function is defined as default true (which means that if this function is not overridden, its return value will be true). The problem with flexbuffers is that if no compatible features are defined, the value of is_human_readable will be false. If only FlexbufferSerializer is defined, it works fine. Because it correctly utilizes the features. see:https://github.com/google/flatbuffers/blob/master/rust/flexbuffers/src/builder/ser.rs#L219 However, the struct MapKeySerializer does not override this feature, which results in the "is_human_readable" value being true (using the default value from the serde library), which is different from FlexbufferSerializer. As of now, it cannot be said that the above code has any problems. However, at present, the only deserialization type available is Reader. see: https://github.com/google/flatbuffers/blob/master/rust/flexbuffers/src/reader/de.rs#L162 It redefined the "is_human_readable" function, with the return value determined by the "features" definition, and the default value is false. The problem here is that, by default, the value of is_human_readable is true during serialization, but it is false during deserialization. For the serialization and deserialization of the same data sequence, the value of is_human_readable must be the same in order to conform to the conventional definition. NOTE: The above is my personal understanding, but at the same time I don't think there is any problem with the original implementation. I hope that experienced Rust developers can judge whether the above modifications are appropriate. If these characteristics were deliberately designed, then perhaps adding more explanations would be more beneficial. (At least I have a misunderstanding about this.) |
|
I really appreciate your detailed message and I am good with this PR. However, if possible I think a test would be great. |
|
I'm sorry, I think it's difficult to add the test. Regardless of the value of is_ruman_deadable, whether it actually causes problems is determined by the user's own implementation of the serialize or deserialize feature. The above modifications are only intended to make the definition more "conventional" or "unambiguous" |
fix #8438