You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Since the 0.21.0 release and the new deserialize implementation for Color, there has been a compatibility issue with Bincode because it expects the deserialize implementation to tell it what type of data to expect and doesn't support "deserialize_any".
Given the new color function expects to deserialize strings, ansi, and rgb values, not sure how to solve. Perhaps use deserialize_str for all, and handle parsing in the visitor, is that possible/sensible?
To Reproduce
Steps to reproduce the behavior:
Use bincode to serialize / deserialize a crossterm Color, results in the below error:
Bincode does not support the serde::Deserializer::deserialize_any method
Expected behavior
Deserializing with bincode should work successfully.
OS
All
Terminal/Console
All
The text was updated successfully, but these errors were encountered:
When implementing Deserialize, you should avoid relying on Deserializer::deserialize_any unless you need to be told by the Deserializer what type is in the input. Know that relying on Deserializer::deserialize_any means your data type will be able to deserialize from self-describing formats only, ruling out Bincode and many others.
So I have it working when serializing Color::RGB to rgb_(r,g,b) and Color::Ansi to ansi_(a). Although it does feel hacky it might be a valid solution to only use the string deserializer. Im not sure how deserialize_enum works.
Describe the bug
Since the 0.21.0 release and the new deserialize implementation for Color, there has been a compatibility issue with Bincode because it expects the deserialize implementation to tell it what type of data to expect and doesn't support "deserialize_any".
#576
https://github.com/crossterm-rs/crossterm/blob/master/src/style/types/color.rs (line 293)
Given the new color function expects to deserialize strings, ansi, and rgb values, not sure how to solve. Perhaps use deserialize_str for all, and handle parsing in the visitor, is that possible/sensible?
To Reproduce
Steps to reproduce the behavior:
Use bincode to serialize / deserialize a crossterm Color, results in the below error:
Bincode does not support the serde::Deserializer::deserialize_any method
Expected behavior
Deserializing with bincode should work successfully.
OS
Terminal/Console
The text was updated successfully, but these errors were encountered: