[][src]Trait floaout::io::read::ReadBytes

pub trait ReadBytes<T>: Read {
    fn read_be_bytes(&mut self) -> Result<T>;
fn read_le_bytes(&mut self) -> Result<T>; }

This trait reads bytes for inferring from variable to be assigned.

Required methods

fn read_be_bytes(&mut self) -> Result<T>

This method reads bytes in big-endian byte order.

Examples

use std::io;
use std::fs::File;
use floaout::io::read::ReadBytes;
 
fn main() -> io::Result<()> {
    let mut f = File::open("foo.txt")?;
 
    // read u32 in big-endian byte order
    let u_32: u32 = f.read_be_bytes()?;
 
    Ok(())
}

fn read_le_bytes(&mut self) -> Result<T>

This method reads bytes in little-endian byte order.

Examples

use std::io;
use std::fs::File;
use floaout::io::read::ReadBytes;
 
fn main() -> io::Result<()> {
    let mut f = File::open("foo.txt")?;
 
    // read u32 in little-endian byte order
    let u_32: u32 = f.read_le_bytes()?;
 
    Ok(())
}
Loading content...

Implementors

impl<R: Read + ?Sized> ReadBytes<f32> for R[src]

impl<R: Read + ?Sized> ReadBytes<f64> for R[src]

impl<R: Read + ?Sized> ReadBytes<(u64, u64)> for R[src]

impl<R: Read + ?Sized> ReadBytes<u16> for R[src]

impl<R: Read + ?Sized> ReadBytes<u32> for R[src]

impl<R: Read + ?Sized> ReadBytes<u64> for R[src]

impl<R: Read + ?Sized> ReadBytes<u8> for R[src]

impl<R: Read + ?Sized> ReadBytes<BubbleFieldSize> for R[src]

impl<R: Read + ?Sized> ReadBytes<Color> for R[src]

Loading content...