diff options
author | 2019-08-27 22:09:43 +0200 | |
---|---|---|
committer | 2019-08-27 13:09:43 -0700 | |
commit | b6cb346adfaae89bce44bfa337652e6d218d38c4 (patch) | |
tree | 0e6cb36b1db4ece480554bce0f2f0ab307013931 /tests/test_from_buf.rs | |
parent | 79e4b2847f27137faaf149d116a352cbeae47fd1 (diff) | |
download | bytes-b6cb346adfaae89bce44bfa337652e6d218d38c4.tar.gz bytes-b6cb346adfaae89bce44bfa337652e6d218d38c4.tar.zst bytes-b6cb346adfaae89bce44bfa337652e6d218d38c4.zip |
Remove IntoBuf/FromBuf (#288)
As consequence Buf::collect is removed as well, which is replaced with `Buf::into_bytes`. The advantage of `Buf::into_bytes` is that it can be optimized in cases where converting a `T: Buf` into a `Bytes` instance is efficient.
Diffstat (limited to 'tests/test_from_buf.rs')
-rw-r--r-- | tests/test_from_buf.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/tests/test_from_buf.rs b/tests/test_from_buf.rs deleted file mode 100644 index 5f644e1..0000000 --- a/tests/test_from_buf.rs +++ /dev/null @@ -1,33 +0,0 @@ -#![deny(warnings, rust_2018_idioms)] - -use bytes::{Buf, Bytes, BytesMut}; - -const LONG: &'static [u8] = b"mary had a little lamb, little lamb, little lamb"; -const SHORT: &'static [u8] = b"hello world"; - -#[test] -fn collect_to_vec() { - let buf: Vec<u8> = SHORT.collect(); - assert_eq!(buf, SHORT); - - let buf: Vec<u8> = LONG.collect(); - assert_eq!(buf, LONG); -} - -#[test] -fn collect_to_bytes() { - let buf: Bytes = SHORT.collect(); - assert_eq!(buf, SHORT); - - let buf: Bytes = LONG.collect(); - assert_eq!(buf, LONG); -} - -#[test] -fn collect_to_bytes_mut() { - let buf: BytesMut = SHORT.collect(); - assert_eq!(buf, SHORT); - - let buf: BytesMut = LONG.collect(); - assert_eq!(buf, LONG); -} |