Skip to main content

BitBucket

Trait BitBucket 

Source
pub trait BitBucket: Default {
    // Required methods
    fn push(&mut self, bit: bool);
    fn pop(&mut self) -> bool;
    fn top(&self) -> bool;
}
Expand description

Trait for bit buckets - provides bit storage for JSON parser state. This trait is implemented for both integer and [T; N] types.

NOTE: BitBucket implementations do NOT implement depth tracking. This is the responsibility of the caller.

Required Methods§

Source

fn push(&mut self, bit: bool)

Pushes a bit (true for 1, false for 0) onto the stack.

Source

fn pop(&mut self) -> bool

Pops the top bit off the stack, returning it if the stack isn’t empty.

Source

fn top(&self) -> bool

Returns the top bit without removing it.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> BitBucket for T
where T: Shl<u8, Output = T> + Shr<u8, Output = T> + BitAnd<T, Output = T> + BitOr<Output = T> + PartialEq + Clone + Default + From<u8>,

Automatic implementation for builtin-types ( u8, u32 etc ). Any type that implements the required traits is automatically implemented for BitBucket.

Source§

impl<const N: usize, T> BitBucket for ArrayBitBucket<N, T>
where T: Shl<u8, Output = T> + Shr<u8, Output = T> + BitAnd<T, Output = T> + BitOr<Output = T> + PartialEq + Clone + From<u8> + Copy + Default,