Skip to main content

Bits

Struct Bits 

Source
pub struct Bits<I>(pub I, pub usize);
Expand description

Bit-level stream state over a byte stream.

Tuple Fields§

§0: I§1: usize

Trait Implementations§

Source§

impl<I: Clone> Clone for Bits<I>

Source§

fn clone(&self) -> Bits<I>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<I: Debug> Debug for Bits<I>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<I> Offset<<Bits<I> as Stream>::Checkpoint> for Bits<I>
where I: Stream<Token = u8> + Clone,

Source§

fn offset_from(&self, other: &<Bits<I> as Stream>::Checkpoint) -> usize

Offset between the first byte of start and the first byte of selfa Read more
Source§

impl<I> Offset for Bits<I>
where I: Offset,

Source§

fn offset_from(&self, start: &Self) -> usize

Offset between the first byte of start and the first byte of selfa Read more
Source§

impl<I: PartialEq> PartialEq for Bits<I>

Source§

fn eq(&self, other: &Bits<I>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I> Stream for Bits<I>
where I: Stream<Token = u8> + Clone,

Source§

type Token = bool

The smallest unit being parsed Read more
Source§

type Slice = (<I as Stream>::Slice, usize, usize)

Sequence of Tokens Read more
Source§

type IterOffsets = BitOffsets<I>

Iterate with the offset from the current location
Source§

type Checkpoint = Checkpoint<Bits<<I as Stream>::Checkpoint>, Bits<I>>

A parse location within the stream
Source§

fn iter_offsets(&self) -> Self::IterOffsets

Iterate with the offset from the current location
Source§

fn eof_offset(&self) -> usize

Returns the offset to the end of the input
Source§

fn next_token(&mut self) -> Option<Self::Token>

Split off the next token from the input
Source§

fn peek_token(&self) -> Option<Self::Token>

Split off the next token from the input
Source§

fn offset_for<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Token) -> bool,

Finds the offset of the next matching token
Source§

fn offset_at(&self, tokens: usize) -> Result<usize, Needed>

Get the offset for the number of tokens into the stream Read more
Source§

fn next_slice(&mut self, offset: usize) -> Self::Slice

Split off a slice of tokens from the input Read more
Source§

fn peek_slice(&self, offset: usize) -> Self::Slice

Split off a slice of tokens from the input
Source§

fn checkpoint(&self) -> Self::Checkpoint

Save the current parse location within the stream
Source§

fn reset(&mut self, checkpoint: &Self::Checkpoint)

Revert the stream to a prior Self::Checkpoint Read more
Source§

fn trace(&self, f: &mut Formatter<'_>) -> Result

Write out a single-line summary of the current parse location
Source§

unsafe fn next_slice_unchecked(&mut self, offset: usize) -> Self::Slice

Split off a slice of tokens from the input Read more
Source§

unsafe fn peek_slice_unchecked(&self, offset: usize) -> Self::Slice

Split off a slice of tokens from the input Read more
Source§

fn finish(&mut self) -> Self::Slice

Advance to the end of the stream
Source§

fn peek_finish(&self) -> Self::Slice
where Self: Clone,

Advance to the end of the stream
Source§

impl<I> StreamIsPartial for Bits<I>
where I: StreamIsPartial,

Source§

type PartialState = <I as StreamIsPartial>::PartialState

Whether the stream is currently partial or complete
Source§

fn complete(&mut self) -> Self::PartialState

Mark the stream is complete
Source§

fn restore_partial(&mut self, state: Self::PartialState)

Restore the stream back to its previous state
Source§

fn is_partial_supported() -> bool

Report whether the Stream is can ever be incomplete
Source§

fn is_partial(&self) -> bool

Report whether the Stream is currently incomplete
Source§

impl<I: Copy> Copy for Bits<I>

Source§

impl<I: Eq> Eq for Bits<I>

Source§

impl<I> StructuralPartialEq for Bits<I>

Auto Trait Implementations§

§

impl<I> Freeze for Bits<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for Bits<I>
where I: RefUnwindSafe,

§

impl<I> Send for Bits<I>
where I: Send,

§

impl<I> Sync for Bits<I>
where I: Sync,

§

impl<I> Unpin for Bits<I>
where I: Unpin,

§

impl<I> UnsafeUnpin for Bits<I>
where I: UnsafeUnpin,

§

impl<I> UnwindSafe for Bits<I>
where I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.