Struct binread::PosValue [−][src]
pub struct PosValue<T> {
pub val: T,
pub pos: u64,
}
Expand description
A wrapper where the position it was read from is stored alongside the value
use binread::{BinRead, PosValue, BinReaderExt, io::Cursor};
#[derive(BinRead)]
struct MyType {
a: u16,
b: PosValue<u8>
}
let val = Cursor::new(b"\xFF\xFE\xFD").read_be::<MyType>().unwrap();
assert_eq!(val.b.pos, 2);
assert_eq!(*val.b, 0xFD);
Fields
val: T
pos: u64
Trait Implementations
The type of arguments needed to be supplied in order to read this type, usually a tuple. Read more
fn read_options<R: Read + Seek>(
reader: &mut R,
options: &ReadOptions,
args: T::Args
) -> BinResult<Self>
fn read_options<R: Read + Seek>(
reader: &mut R,
options: &ReadOptions,
args: T::Args
) -> BinResult<Self>
Read the type from the reader
fn after_parse<R: Read + Seek>(
&mut self,
reader: &mut R,
options: &ReadOptions,
args: Self::Args
) -> BinResult<()>
Read the type from the reader while assuming no arguments have been passed Read more
Read the type from the reader using the specified arguments
Auto Trait Implementations
impl<T> RefUnwindSafe for PosValue<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for PosValue<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more