[−][src]Function fcc::get_last_byte
pub fn get_last_byte<R: Read + Seek>(f: &mut R) -> Result<u8>
Returns the last byte of a file, an in-memory cursor, or anything that
implements Read
and Seek
.
Note that this function does not alter the internal cursor of the given input.
Errors
If the given reader is empty, an error variant of ErrorKind::SeekNegative
will
be returned. If this function encounters other errors, an error variant
of ErrorKind::Io
will be returned.
Examples
use fcc::get_last_byte; use std::io::Cursor; let mut cursor = Cursor::new(vec![1, 2, 3, b'\n']); let last_byte = get_last_byte(&mut cursor).unwrap(); assert_eq!(last_byte, b'\n');