Struct rsonpath::input::owned::OwnedBytes
source · pub struct OwnedBytes<B> { /* private fields */ }
Expand description
Input wrapping a buffer borrowable as a slice of bytes.
Implementations§
source§impl<B> OwnedBytes<B>
impl<B> OwnedBytes<B>
sourcepub fn new(bytes: B) -> Self
pub fn new(bytes: B) -> Self
Create a new instance of OwnedBytes
taking over the given buffer.
The input will be automatically padded internally, incurring at most
two times MAX_BLOCK_SIZE
of memory overhead.
Trait Implementations§
source§impl<B> From<B> for OwnedBytes<B>
impl<B> From<B> for OwnedBytes<B>
source§impl<B> Input for OwnedBytes<B>
impl<B> Input for OwnedBytes<B>
§type BlockIterator<'i, 'r, R, const N: usize> = BorrowedBytesBlockIterator<'r, TwoSidesPaddedInput<'i>, R, N>
where
Self: 'i,
R: InputRecorder<Self::Block<'i, N>> + 'r
type BlockIterator<'i, 'r, R, const N: usize> = BorrowedBytesBlockIterator<'r, TwoSidesPaddedInput<'i>, R, N> where Self: 'i, R: InputRecorder<Self::Block<'i, N>> + 'r
Type of the iterator used by
iter_blocks
, parameterized
by the lifetime of source input and the size of the block.§type Error = Infallible
type Error = Infallible
Type of errors that can occur when operating on this
Input
.§type Block<'i, const N: usize> = &'i [u8]
where
Self: 'i
type Block<'i, const N: usize> = &'i [u8] where Self: 'i
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, R, const N: usize>(
&'i self,
recorder: &'r R
) -> Self::BlockIterator<'i, 'r, R, N>where
R: InputRecorder<Self::Block<'i, N>>,
fn iter_blocks<'i, 'r, R, const N: usize>(
&'i self,
recorder: &'r R
) -> Self::BlockIterator<'i, 'r, R, N>where
R: 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)>, Self::Error>
fn seek_forward<const N: usize>( &self, from: usize, needles: [u8; N] ) -> Result<Option<(usize, u8)>, Self::Error>
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)>, Self::Error>
fn seek_non_whitespace_forward( &self, from: usize ) -> Result<Option<(usize, u8)>, Self::Error>
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: &JsonString
) -> Result<bool, Self::Error>
fn is_member_match( &self, from: usize, to: usize, member: &JsonString ) -> 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<B> RefUnwindSafe for OwnedBytes<B>where
B: RefUnwindSafe,
impl<B> Send for OwnedBytes<B>where
B: Send,
impl<B> Sync for OwnedBytes<B>where
B: Sync,
impl<B> Unpin for OwnedBytes<B>where
B: Unpin,
impl<B> UnwindSafe for OwnedBytes<B>where
B: 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