pub struct BufferedInput<R>(_);
Expand description

Input supporting a buffered read over a Read implementation.

Implementations§

source§

impl<R: Read> BufferedInput<R>

source

pub fn new(source: R) -> Self

Create a new BufferedInput reading from the given source.

source

pub fn with_capacity(source: R, capacity: usize) -> Self

Create a new BufferedInput reading from the given source, preallocating at least capacity bytes up front.

Trait Implementations§

source§

impl<R: Read> Input for BufferedInput<R>

§

type BlockIterator<'a, 'r, const N: usize, IR> = BufferedInputBlockIterator<'a, 'r, R, IR, N> where Self: 'a, IR: InputRecorder<BufferedInputBlock<N>> + 'r

Type of the iterator used by iter_blocks, parameterized by the lifetime of source input and the size of the block.
§

type Block<'a, const N: usize> = BufferedInputBlock<N> where Self: 'a

Type of the blocks returned by the BlockIterator.
source§

fn iter_blocks<'i, 'r, IR, const N: usize>( &'i self, recorder: &'r IR ) -> Self::BlockIterator<'i, 'r, N, IR>where IR: InputRecorder<Self::Block<'i, N>>,

Iterate over blocks of size N of the input. N has to be a power of two larger than 1.
source§

fn seek_backward(&self, from: usize, needle: u8) -> Option<usize>

Search for an occurrence of needle in the input, starting from from and looking back. Returns the index of the first occurrence or None if the needle was not found.
source§

fn seek_forward<const N: usize>( &self, from: usize, needles: [u8; N] ) -> Result<Option<(usize, u8)>, InputError>

Search for an occurrence of any of the needles in the input, starting from from and looking forward. Returns the index of the first occurrence and the needle found, or None if none of the needles were not found. Read more
source§

fn seek_non_whitespace_forward( &self, from: usize ) -> Result<Option<(usize, u8)>, InputError>

Search for the first byte in the input that is not ASCII whitespace starting from from. Returns a pair: the index of first such byte, and the byte itself; or None if no non-whitespace characters were found. Read more
source§

fn seek_non_whitespace_backward(&self, from: usize) -> Option<(usize, u8)>

Search for the first byte in the input that is not ASCII whitespace starting from from and looking back. Returns a pair: the index of first such byte, and the byte itself; or None if no non-whitespace characters were found.
source§

fn find_member( &self, from: usize, member: &JsonString ) -> Result<Option<usize>, InputError>

Search the input for the first occurrence of member name member (comparing bitwise, including double quotes delimiters) starting from from. Returns the index of the first occurrence, or None if no occurrence was found. Read more
source§

fn is_member_match(&self, from: usize, to: usize, member: &JsonString) -> bool

Decide whether the slice of input between from (inclusive) and to (exclusive) matches the member (comparing bitwise, including double quotes delimiters). Read more

Auto Trait Implementations§

§

impl<R> !RefUnwindSafe for BufferedInput<R>

§

impl<R> Send for BufferedInput<R>where R: Send,

§

impl<R> !Sync for BufferedInput<R>

§

impl<R> Unpin for BufferedInput<R>where R: Unpin,

§

impl<R> UnwindSafe for BufferedInput<R>where R: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.