pub struct BufferedInput<R>(/* private fields */);
Expand description
Input supporting a buffered read over a Read
implementation.
Implementations§
Source§impl<R: Read> BufferedInput<R>
impl<R: Read> BufferedInput<R>
Sourcepub fn new(source: R) -> Self
pub fn new(source: R) -> Self
Create a new BufferedInput
reading from the given source
.
Sourcepub fn with_capacity(source: R, capacity: usize) -> Self
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>
impl<R: Read> Input for BufferedInput<R>
Source§type BlockIterator<'a, 'r, IR, const N: usize> = BufferedInputBlockIterator<'a, 'r, R, IR, N>
where
Self: 'a,
IR: InputRecorder<BufferedInputBlock<N>> + 'r
type BlockIterator<'a, 'r, IR, const N: usize> = 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.Source§type Error = InputError
type Error = InputError
Type of errors that can occur when operating on this
Input
.Source§type Block<'a, const N: usize> = BufferedInputBlock<N>
where
Self: 'a
type Block<'a, const N: usize> = BufferedInputBlock<N> where Self: 'a
Type of the blocks returned by the
BlockIterator
.Source§fn leading_padding_len(&self) -> usize
fn leading_padding_len(&self) -> usize
Return the length of the padding added at the start of the input. Read more
Source§fn trailing_padding_len(&self) -> usize
fn trailing_padding_len(&self) -> usize
Return the length of the padding added at the end of the input. Read more
Source§fn iter_blocks<'i, 'r, IR, const N: usize>(
&'i self,
recorder: &'r IR,
) -> Self::BlockIterator<'i, 'r, IR, N>where
IR: InputRecorder<Self::Block<'i, N>>,
fn iter_blocks<'i, 'r, IR, const N: usize>(
&'i self,
recorder: &'r IR,
) -> Self::BlockIterator<'i, 'r, IR, N>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>
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>
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 moreSource§fn seek_non_whitespace_forward(
&self,
from: usize,
) -> Result<Option<(usize, u8)>, InputError>
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 moreSource§fn seek_non_whitespace_backward(&self, from: usize) -> Option<(usize, u8)>
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 is_member_match(
&self,
from: usize,
to: usize,
member: &StringPattern,
) -> Result<bool, Self::Error>
fn is_member_match( &self, from: usize, to: usize, member: &StringPattern, ) -> Result<bool, Self::Error>
Decide whether the slice of input between
from
(inclusive)
and to
(exclusive) matches the member
(comparing bitwise,
including double quotes delimiters). Read moreAuto Trait Implementations§
impl<R> !Freeze for BufferedInput<R>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more