[][src]Struct binread::PosValue

pub struct PosValue<T> {
    pub val: T,
    pub pos: u64,
}

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: Tpos: u64

Trait Implementations

impl<T: BinRead> BinRead for PosValue<T>[src]

type Args = T::Args

The type of arguments needed to be supplied in order to read this type, usually a tuple. Read more

impl<T: Clone> Clone for PosValue<T>[src]

impl<T: Debug> Debug for PosValue<T>[src]

impl<T> Deref for PosValue<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T> DerefMut for PosValue<T>[src]

impl<U, T: PartialEq<U>> PartialEq<U> for PosValue<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for PosValue<T> where
    T: RefUnwindSafe

impl<T> Send for PosValue<T> where
    T: Send

impl<T> Sync for PosValue<T> where
    T: Sync

impl<T> Unpin for PosValue<T> where
    T: Unpin

impl<T> UnwindSafe for PosValue<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.