No description
Find a file
Brian Anderson 844caac05c Initial
2017-02-20 11:22:19 -08:00
src Initial 2017-02-20 11:22:19 -08:00
tests Initial 2017-02-20 11:22:19 -08:00
.gitignore Initial 2017-02-20 11:22:19 -08:00
build.rs Initial 2017-02-20 11:22:19 -08:00
Cargo.lock Initial 2017-02-20 11:22:19 -08:00
Cargo.toml Initial 2017-02-20 11:22:19 -08:00
README.md Initial 2017-02-20 11:22:19 -08:00

extern crate byteorder;

use std::io::Cursor;
use byteorder::{BigEndian, ReadBytesExt};

fn main() {
   let mut rdr = Cursor::new(vec![2, 5, 3, 0]);
   // Note that we use type parameters to indicate which kind of byte
   // order we want!
   assert_eq!(517, rdr.read_u16::<BigEndian>().unwrap());
   assert_eq!(768, rdr.read_u16::<BigEndian>().unwrap());
}