Skip to content

Instantly share code, notes, and snippets.

Last active July 27, 2020 12:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
read_vectored in libstd
use std::fs;
use std::io::{self, IoSliceMut, Read, Write, Seek, SeekFrom};
fn main() -> io::Result<()> {
let mut f = fs::OpenOptions::new()
let buffer = &mut [0u8; 6];
let (mut first, mut second) = buffer.split_at_mut(3);
let iovecs = &mut [IoSliceMut::new(&mut first), IoSliceMut::new(&mut second)];
assert_eq!(b"Hello!", buffer, "buffers should be equal");
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `[72, 101, 108, 108, 111, 33]`,
right: `[72, 101, 108, 0, 0, 0]`: buffers should be equal', src\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment