[−][src]Trait binjs::io::bytes::varnum::ReadVarNum
Required methods
fn read_varnum(&mut self) -> Result<u32, Error>
fn read_signed_varnum(&mut self) -> Result<i32, Error>
fn read_maybe_varnum(&mut self) -> Result<Option<u32>, Error>
fn read_varnum_to(&mut self, num: &mut u32) -> Result<usize, Error>
fn read_extended_varnum_to(&mut self, num: &mut u32) -> Result<usize, Error>
As read_varnum_to
, but ignore invalid 0s.
Used to implement e.g. read_varfloat
.
fn read_extended_signed_varnum_to(
&mut self,
num: &mut i32
) -> Result<usize, Error>
&mut self,
num: &mut i32
) -> Result<usize, Error>
Implementors
impl<T> ReadVarNum for T where
T: Read,
[src]
T: Read,
fn read_varnum(&mut self) -> Result<u32, Error>
[src]
use binjs_io::bytes::varnum::*; use std::io::Cursor; let source = vec![0]; eprintln!("Test {:?}", source); assert_eq!(Cursor::new(source).read_varnum().unwrap(), 0); // This odd encoding of 0 may be reserved as a magic header: let source = vec![1, 0]; assert!(Cursor::new(source).read_varnum().is_err()); // This odd encoding of 0 may be reserved as a magic header: let source = vec![1,1,0]; assert!(Cursor::new(source).read_varnum().is_err()); // This odd encoding of 0 may be reserved as a magic header: let source = vec![1,1,1,0]; assert!(Cursor::new(source).read_varnum().is_err());
fn read_signed_varnum(&mut self) -> Result<i32, Error>
[src]
fn read_maybe_varnum(&mut self) -> Result<Option<u32>, Error>
[src]
fn read_extended_signed_varnum_to(
&mut self,
num: &mut i32
) -> Result<usize, Error>
[src]
&mut self,
num: &mut i32
) -> Result<usize, Error>