Replace iovec with std::io::IoSlice

- Renames `bytes_vec` to `bytes_vectored` and `bytes_vec_mut` to
  `bytes_vectored_mut`.
This commit is contained in:
Sean McArthur
2019-06-11 11:58:43 -07:00
parent ac4e8f2fc5
commit dea868a4b0
10 changed files with 104 additions and 95 deletions
+5 -7
View File
@@ -1,9 +1,8 @@
extern crate bytes;
extern crate byteorder;
extern crate iovec;
use bytes::Buf;
use iovec::IoVec;
use std::io::IoSlice;
#[test]
fn test_fresh_cursor_vec() {
@@ -48,11 +47,10 @@ fn test_get_u16_buffer_underflow() {
fn test_bufs_vec() {
let buf = &b"hello world"[..];
let b1: &[u8] = &mut [0];
let b2: &[u8] = &mut [0];
let b1: &[u8] = &mut [];
let b2: &[u8] = &mut [];
let mut dst: [IoVec; 2] =
[b1.into(), b2.into()];
let mut dst = [IoSlice::new(b1), IoSlice::new(b2)];
assert_eq!(1, buf.bytes_vec(&mut dst[..]));
assert_eq!(1, buf.bytes_vectored(&mut dst[..]));
}