Enum deku::ctx::Size[][src]

pub enum Size {
    Bits(usize),
    Bytes(usize),
}

The size of a field

Variants

Bits(usize)

bit size

Bytes(usize)

byte size

Implementations

impl Size[src]

pub fn of<T>() -> Self[src]

Returns the bit size of a type.

Examples


assert_eq!(Size::of::<i32>(), Size::Bits(4 * 8));

Panics

Panic if the bit size of given type is greater than usize::MAX

pub fn of_val<T: ?Sized>(val: &T) -> Self[src]

Returns the bit size of the pointed-to value

pub fn bit_size(&self) -> usize[src]

Returns the size in bits of a Size

Panics

Panic if the bit size of Size::Bytes(n) is greater than usize::MAX

pub fn byte_size(&self) -> Result<usize, DekuError>[src]

Returns the size in bytes of a Size

Panics

Panic if the bit size of Size::Bytes(n) is greater than usize::MAX

Trait Implementations

impl Clone for Size[src]

impl Copy for Size[src]

impl Debug for Size[src]

impl DekuRead<'_, Size> for NonZeroU8[src]

impl DekuRead<'_, Size> for NonZeroU16[src]

impl DekuRead<'_, Size> for NonZeroI128[src]

impl DekuRead<'_, Size> for NonZeroIsize[src]

impl DekuRead<'_, Size> for u8[src]

impl DekuRead<'_, Size> for u16[src]

impl DekuRead<'_, Size> for u32[src]

impl DekuRead<'_, Size> for u64[src]

impl DekuRead<'_, Size> for u128[src]

impl DekuRead<'_, Size> for usize[src]

impl DekuRead<'_, Size> for i8[src]

impl DekuRead<'_, Size> for i16[src]

impl DekuRead<'_, Size> for NonZeroU32[src]

impl DekuRead<'_, Size> for i32[src]

impl DekuRead<'_, Size> for i64[src]

impl DekuRead<'_, Size> for i128[src]

impl DekuRead<'_, Size> for isize[src]

impl DekuRead<'_, Size> for f32[src]

impl DekuRead<'_, Size> for f64[src]

impl DekuRead<'_, Size> for NonZeroU64[src]

impl DekuRead<'_, Size> for NonZeroU128[src]

impl DekuRead<'_, Size> for NonZeroUsize[src]

impl DekuRead<'_, Size> for NonZeroI8[src]

impl DekuRead<'_, Size> for NonZeroI16[src]

impl DekuRead<'_, Size> for NonZeroI32[src]

impl DekuRead<'_, Size> for NonZeroI64[src]

impl DekuWrite<Size> for NonZeroU8[src]

impl DekuWrite<Size> for NonZeroU16[src]

impl DekuWrite<Size> for NonZeroI128[src]

impl DekuWrite<Size> for NonZeroIsize[src]

impl DekuWrite<Size> for u8[src]

impl DekuWrite<Size> for u16[src]

impl DekuWrite<Size> for u32[src]

impl DekuWrite<Size> for u64[src]

impl DekuWrite<Size> for u128[src]

impl DekuWrite<Size> for usize[src]

impl DekuWrite<Size> for i8[src]

impl DekuWrite<Size> for i16[src]

impl DekuWrite<Size> for NonZeroU32[src]

impl DekuWrite<Size> for i32[src]

impl DekuWrite<Size> for i64[src]

impl DekuWrite<Size> for i128[src]

impl DekuWrite<Size> for isize[src]

impl DekuWrite<Size> for f32[src]

impl DekuWrite<Size> for f64[src]

impl DekuWrite<Size> for NonZeroU64[src]

impl DekuWrite<Size> for NonZeroU128[src]

impl DekuWrite<Size> for NonZeroUsize[src]

impl DekuWrite<Size> for NonZeroI8[src]

impl DekuWrite<Size> for NonZeroI16[src]

impl DekuWrite<Size> for NonZeroI32[src]

impl DekuWrite<Size> for NonZeroI64[src]

impl Eq for Size[src]

impl<T> From<Size> for Limit<T, fn(_: &T) -> bool>[src]

impl Ord for Size[src]

impl PartialEq<Size> for Size[src]

impl PartialOrd<Size> for Size[src]

impl StructuralEq for Size[src]

impl StructuralPartialEq for Size[src]

Auto Trait Implementations

impl RefUnwindSafe for Size

impl Send for Size

impl Sync for Size

impl Unpin for Size

impl UnwindSafe for Size

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> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

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

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

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

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.