pub struct UnescapedChunk<'a> { /* private fields */ }
Expand description
A chunk of a JSON-unescaped byte slice, separating the literal part from the unescaped character.
This struct is yielded by the Unescape
iterator.
Implementations§
Source§impl<'a> UnescapedChunk<'a>
impl<'a> UnescapedChunk<'a>
Sourcepub const fn literal(&self) -> &'a [u8] ⓘ
pub const fn literal(&self) -> &'a [u8] ⓘ
Returns the literal part of the chunk, which is a slice of the original bytes.
Sourcepub fn display_utf8(&self) -> DisplayUnescapedChunk<'_>
pub fn display_utf8(&self) -> DisplayUnescapedChunk<'_>
Returns a displayable wrapper that will format the chunk as a UTF-8 string.
If the literal part of the chunk contains invalid UTF-8 sequences, this
will result in a fmt::Error
.
Sourcepub fn display_utf8_lossy(&self) -> DisplayUnescapedChunk<'_>
pub fn display_utf8_lossy(&self) -> DisplayUnescapedChunk<'_>
Returns a displayable wrapper that will format the chunk as a lossy UTF-8 string.
Any invalid UTF-8 sequences in the literal part of the chunk will be replaced with the U+FFFD replacement character.
Trait Implementations§
Source§impl<'a> Clone for UnescapedChunk<'a>
impl<'a> Clone for UnescapedChunk<'a>
Source§fn clone(&self) -> UnescapedChunk<'a>
fn clone(&self) -> UnescapedChunk<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> Debug for UnescapedChunk<'a>
impl<'a> Debug for UnescapedChunk<'a>
Source§impl<'a> Extend<UnescapedChunk<'a>> for Vec<u8>
Extends a byte vector with an iterator of unescaped chunks.
impl<'a> Extend<UnescapedChunk<'a>> for Vec<u8>
Extends a byte vector with an iterator of unescaped chunks.
Source§fn extend<I: IntoIterator<Item = UnescapedChunk<'a>>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = UnescapedChunk<'a>>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a> FromIterator<UnescapedChunk<'a>> for Vec<u8>
Collects an iterator of unescaped chunks into a byte vector.
impl<'a> FromIterator<UnescapedChunk<'a>> for Vec<u8>
Collects an iterator of unescaped chunks into a byte vector.
Source§fn from_iter<I: IntoIterator<Item = UnescapedChunk<'a>>>(iter: I) -> Vec<u8> ⓘ
fn from_iter<I: IntoIterator<Item = UnescapedChunk<'a>>>(iter: I) -> Vec<u8> ⓘ
Creates a value from an iterator. Read more
Source§impl<'a> PartialEq for UnescapedChunk<'a>
impl<'a> PartialEq for UnescapedChunk<'a>
impl<'a> Copy for UnescapedChunk<'a>
impl<'a> Eq for UnescapedChunk<'a>
impl<'a> StructuralPartialEq for UnescapedChunk<'a>
Auto Trait Implementations§
impl<'a> Freeze for UnescapedChunk<'a>
impl<'a> RefUnwindSafe for UnescapedChunk<'a>
impl<'a> Send for UnescapedChunk<'a>
impl<'a> Sync for UnescapedChunk<'a>
impl<'a> Unpin for UnescapedChunk<'a>
impl<'a> UnwindSafe for UnescapedChunk<'a>
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