[][src]Trait scroll::ctx::SizeWith

pub trait SizeWith<Ctx = ()> {
    fn size_with(ctx: &Ctx) -> usize;
}

Gets the size of Self with a Ctx, and in Self::Units. Implementors can then call Gread related functions

The rationale behind this trait is to:

  1. Prevent gread from being used, and the offset being modified based on simply the sizeof the value, which can be a misnomer, e.g., for Leb128, etc.
  2. Allow a context based size, which is useful for 32/64 bit variants for various containers, etc.

Required methods

fn size_with(ctx: &Ctx) -> usize

Loading content...

Implementations on Foreign Types

impl SizeWith<Endian> for u8[src]

impl SizeWith<Endian> for i8[src]

impl SizeWith<Endian> for u16[src]

impl SizeWith<Endian> for i16[src]

impl SizeWith<Endian> for u32[src]

impl SizeWith<Endian> for i32[src]

impl SizeWith<Endian> for u64[src]

impl SizeWith<Endian> for i64[src]

impl SizeWith<Endian> for u128[src]

impl SizeWith<Endian> for i128[src]

impl SizeWith<Endian> for f32[src]

impl SizeWith<Endian> for f64[src]

impl SizeWith<Endian> for usize[src]

impl SizeWith<Endian> for isize[src]

Loading content...

Implementors

Loading content...