impl From<Box<[u8]>> for Bytes (#504)

This commit is contained in:
Ian Jackson
2021-08-24 12:42:22 +02:00
committed by GitHub
parent ee24be7fa0
commit 0e9fa0b602
2 changed files with 17 additions and 3 deletions
+8
View File
@@ -994,3 +994,11 @@ fn bytes_put_bytes() {
bytes.put_bytes(19, 2);
assert_eq!([17, 19, 19], bytes.as_ref());
}
#[test]
fn box_slice_empty() {
// See https://github.com/tokio-rs/bytes/issues/340
let empty: Box<[u8]> = Default::default();
let b = Bytes::from(empty);
assert!(b.is_empty());
}