[−][src]Function bin_io::utils::skip
pub fn skip<R: Read, W: Write, Rf, Wf, I>(
f: (Rf, Wf),
i: I
) -> (impl ReadFn<R, ()>, impl WriteFn<W, ()>) where
Rf: ReadFn<R, I>,
Wf: WriteFn<W, I>,
I: Clone,
Skips a value to a writer/reader.
This is an helper function used in conjuction
with seq!
.
Reading
The function just reads the value and then discards the value.
Writing
The function writes the input value.
Remarks
This function is identical to bind
with
the exception that it won't check the read
value.
Examples
use std::io::Cursor; use bin_io::numbers::{ be_u8 }; use bin_io::{ write, skip, seq }; let vec = Vec::new(); let mut cursor = Cursor::new(vec); let a = seq!( (), skip(be_u8(), 0x50) => ); write(&mut cursor, &(), a) .unwrap(); assert_eq!(cursor.get_ref()[0], 0x50);