[][src]Enum deku::ctx::Limit

pub enum Limit<T, Predicate: FnMut(&T) -> bool> {
    Count(usize),
    Until(Predicate, PhantomData<T>),
    Bits(BitSize),
}

A limit placed on a container's elements

Variants

Count(usize)

Read a specific count of elements

Until(Predicate, PhantomData<T>)

Read until a given predicate holds true

Bits(BitSize)

Read until a given quantity of bits have been read

Implementations

impl<T, Predicate: for<'a> FnMut(&'a T) -> bool> Limit<T, Predicate>[src]

pub fn new_until(predicate: Predicate) -> Self[src]

Constructs a new Limit that reads until the given predicate returns true The predicate is given a reference to the latest read value and must return true to stop reading

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

pub fn new_count(count: usize) -> Self[src]

Constructs a new Limit that reads unil the given number of elements are read

pub fn new_bits(bits: BitSize) -> Self[src]

Constructs a new Limit that reads until the given number of bits have been read

Trait Implementations

impl<T: Clone, Predicate: Clone + FnMut(&T) -> bool> Clone for Limit<T, Predicate>[src]

impl<T: Copy, Predicate: Copy + FnMut(&T) -> bool> Copy for Limit<T, Predicate>[src]

impl<T: Debug, Predicate: Debug + FnMut(&T) -> bool> Debug for Limit<T, Predicate>[src]

impl<T: DekuRead, Predicate: FnMut(&T) -> bool> DekuRead<Limit<T, Predicate>> for Vec<T>[src]

fn read(
    input: &BitSlice<Msb0, u8>,
    limit: Limit<T, Predicate>
) -> Result<(&BitSlice<Msb0, u8>, Self), DekuError> where
    Self: Sized
[src]

Read Ts until the given limit from input for types which don't require context.

impl<T: Eq, Predicate: Eq + FnMut(&T) -> bool> Eq for Limit<T, Predicate>[src]

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

impl<T, Predicate: for<'a> FnMut(&'a T) -> bool> From<Predicate> for Limit<T, Predicate>[src]

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

impl<T: Ord, Predicate: Ord + FnMut(&T) -> bool> Ord for Limit<T, Predicate>[src]

impl<T: PartialEq, Predicate: PartialEq + FnMut(&T) -> bool> PartialEq<Limit<T, Predicate>> for Limit<T, Predicate>[src]

impl<T: PartialOrd, Predicate: PartialOrd + FnMut(&T) -> bool> PartialOrd<Limit<T, Predicate>> for Limit<T, Predicate>[src]

impl<T, Predicate: FnMut(&T) -> bool> StructuralEq for Limit<T, Predicate>[src]

impl<T, Predicate: FnMut(&T) -> bool> StructuralPartialEq for Limit<T, Predicate>[src]

Auto Trait Implementations

impl<T, Predicate> RefUnwindSafe for Limit<T, Predicate> where
    Predicate: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, Predicate> Send for Limit<T, Predicate> where
    Predicate: Send,
    T: Send

impl<T, Predicate> Sync for Limit<T, Predicate> where
    Predicate: Sync,
    T: Sync

impl<T, Predicate> Unpin for Limit<T, Predicate> where
    Predicate: Unpin,
    T: Unpin

impl<T, Predicate> UnwindSafe for Limit<T, Predicate> where
    Predicate: UnwindSafe,
    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> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

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

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.