Add optional postcard feature to enable postcard impl for Value#118
Add optional postcard feature to enable postcard impl for Value#118diondokter merged 1 commit intotweedegolf:masterfrom
Conversation
|
Force pushed to fix formatting CI. |
|
Are you sure this is the correct repo? This seems totally unrelated to |
Yeah, I suggested he add this to the repo :) I am now thinking this could actually be quite sucky in some situations... Not sure how that will play out... The code itself looks good though. |
|
Sorry, I didn't realize that
Without the blanket impl on |
|
Sorry, I should probably have written a clearer description of the PR! This basically makes it much easier to use arbitrary Rust types as your In principle you could even use postcard for all types, remove the trait entirely, and require just that values impl the serde traits, but as that's not backwards compatible this approach is probably better. As @Sympatron says, the marker trait means postcard is only used for types that explicitly opt in to it, so it won't affect any existing code (regardless of whether the feature is enabled). |
|
Oh! I didn't read the code correctly. I saw the marker trait and assumed it would have a blanket impl. My bad :) |
|
Released as 7.1.0 :) |
Allows using postcard with any serde-compatible types.
Originally I had a blanket impl for any
T: Serialize+Deserialize, but that conflicts with pretty much every other impl, so the marker trait approach seemed a bit more fine-grained while still being very easy to use.