[−][src]Trait floaout::io::read::ReadBytesFor
This trait reads bytes for size. This is because, size is unknown in String.
Required methods
fn read_be_bytes_for(&mut self, size: usize) -> Result<T>
This method reads bytes in big-endian byte order.
Examples
use std::io; use std::fs::File; use floaout::io::read::ReadBytesFor; fn main() -> io::Result<()> { let mut f = File::open("foo.txt")?; // read String for size of 3 in big-endian byte order let string: String = f.read_be_bytes_for(3)?; Ok(()) }
fn read_le_bytes_for(&mut self, size: usize) -> Result<T>
This method reads bytes in little-endian byte order.
Examples
use std::io; use std::fs::File; use floaout::io::read::ReadBytesFor; fn main() -> io::Result<()> { let mut f = File::open("foo.txt")?; // read Vec<u8> for size of 1 in little-endian byte order let vec_u8: Vec<u8> = f.read_le_bytes_for(1)?; Ok(()) }