serde-rs / bytes

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

Add `Deserialize` implementation for `Bytes` #5

Closed hcpl closed 7 years ago

hcpl commented 7 years ago

The Bytes instance borrows directly from the input source and as such provides a zero-copy interface.

dtolnay commented 7 years ago

Thanks! This was an oversight when updating to Serde 1.0.

I tweaked the error message in 42c1f08f70b1cb8608b2330dffa1674e2c2792be to be consistent with &str. Otherwise formats that do not support borrowing a byte array will produce unhelpful messages that say unexpected type byte array, expected byte array.

Published in serde_bytes 0.10.2.

Thanks for the review @oli-obk!

hcpl commented 7 years ago

Thanks for the quick release!