serde-rs / bytes

Wrapper types to enable optimized handling of &[u8] and Vec<u8>
Apache License 2.0
306 stars 37 forks source link

Improve some `crate::de::Deserialize` impls by privately introducing `CowBytes<'a>` #24

Closed timotree3 closed 4 years ago

timotree3 commented 4 years ago

Resolves #23

Notably, CowBytes<'a> is not publicly visible because it isn't re-exported at the crate-level like the other structs.

Follow-up work would be to add proper trait impls and documentation and make the type public.

I haven't bothered to learn serde_test and as such this introduces some untested code in the cowbytes.rs module. If that would block this PR I am happy to learn it and add the relevant tests.