Trait scroll::ctx::SizeWith
[−]
[src]
pub trait SizeWith<Ctx = ()> { type Units; fn size_with(ctx: &Ctx) -> Self::Units; }
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:
- 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. - Allow a context based size, which is useful for 32/64 bit variants for various containers, etc.
Associated Types
type Units
Required Methods
Implementors
impl SizeWith<Endian> for u8
impl SizeWith<Endian> for i8
impl SizeWith<Endian> for u16
impl SizeWith<Endian> for i16
impl SizeWith<Endian> for u32
impl SizeWith<Endian> for i32
impl SizeWith<Endian> for u64
impl SizeWith<Endian> for i64
impl SizeWith<Endian> for f32
impl SizeWith<Endian> for f64
impl SizeWith<Endian> for usize
impl SizeWith<Endian> for isize