pub struct TreeDecoder<'de> { /* private fields */ }Expand description
A FormatDecoder that replays an owned token stream produced from a
Value tree.
Formats that parse their input into a Value first wrap that stream in
this type instead of re-implementing the full FormatDecoder contract.
The inner decoder borrows the owned stream for the lifetime of the
wrapper; object_key / string are re-lifetimed to the caller’s 'de.
Implementations§
Trait Implementations§
Source§impl<'de> FormatDecoder<'de> for TreeDecoder<'de>
impl<'de> FormatDecoder<'de> for TreeDecoder<'de>
Source§fn object_key(&mut self) -> Result<Option<Cow<'de, str>>, Self::Error>
fn object_key(&mut self) -> Result<Option<Cow<'de, str>>, Self::Error>
Read the next object key; returns
None on } (not consumed).Source§fn object_entry_sep(&mut self) -> Result<bool, Self::Error>
fn object_entry_sep(&mut self) -> Result<bool, Self::Error>
Object entry separator:
true if more entries follow, false at end.Source§fn array_has_more(&mut self) -> Result<bool, Self::Error>
fn array_has_more(&mut self) -> Result<bool, Self::Error>
Whether the array has more elements (
] not consumed).Source§fn array_entry_sep(&mut self) -> Result<bool, Self::Error>
fn array_entry_sep(&mut self) -> Result<bool, Self::Error>
Array entry separator:
true if more elements follow, false at end.Source§fn string(&mut self) -> Result<Cow<'de, str>, Self::Error>
fn string(&mut self) -> Result<Cow<'de, str>, Self::Error>
Read a string (may borrow the source).
Source§fn char(&mut self) -> Result<char, Self::Error>
fn char(&mut self) -> Result<char, Self::Error>
Read a single character (a one-scalar string).
Source§fn peek_token(&mut self) -> Result<Token<'de>, Self::Error>
fn peek_token(&mut self) -> Result<Token<'de>, Self::Error>
Peek the next token without consuming it (container-flatten support).
Source§fn next_token(&mut self) -> Result<Token<'de>, Self::Error>
fn next_token(&mut self) -> Result<Token<'de>, Self::Error>
Consume and return the next token.
Source§fn set_expecting(&mut self, _expecting: &'static str) -> Option<&'static str>
fn set_expecting(&mut self, _expecting: &'static str) -> Option<&'static str>
Set the human-readable description of the type currently being
decoded, so container-level type-mismatch errors (
begin_object /
begin_array hitting the wrong token) can name the expected type
instead of a bare structural token like '{'. Read moreSource§fn i8(&mut self) -> Result<i8, Self::Error>
fn i8(&mut self) -> Result<i8, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn i16(&mut self) -> Result<i16, Self::Error>
fn i16(&mut self) -> Result<i16, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn i32(&mut self) -> Result<i32, Self::Error>
fn i32(&mut self) -> Result<i32, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn i64(&mut self) -> Result<i64, Self::Error>
fn i64(&mut self) -> Result<i64, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn i128(&mut self) -> Result<i128, Self::Error>
fn i128(&mut self) -> Result<i128, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn isize(&mut self) -> Result<isize, Self::Error>
fn isize(&mut self) -> Result<isize, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn u8(&mut self) -> Result<u8, Self::Error>
fn u8(&mut self) -> Result<u8, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn u16(&mut self) -> Result<u16, Self::Error>
fn u16(&mut self) -> Result<u16, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn u32(&mut self) -> Result<u32, Self::Error>
fn u32(&mut self) -> Result<u32, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn u64(&mut self) -> Result<u64, Self::Error>
fn u64(&mut self) -> Result<u64, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn u128(&mut self) -> Result<u128, Self::Error>
fn u128(&mut self) -> Result<u128, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn usize(&mut self) -> Result<usize, Self::Error>
fn usize(&mut self) -> Result<usize, Self::Error>
Read a
$t (default: read a number and convert). Read moreSource§fn bytes(&mut self) -> Result<Cow<'de, [u8]>, Self::Error>
fn bytes(&mut self) -> Result<Cow<'de, [u8]>, Self::Error>
Read a byte sequence (may borrow the source). Read more
Source§fn map_key<K: for<'a> NsonDeserialize<'a>>(
&mut self,
) -> Result<Option<K>, Self::Error>
fn map_key<K: for<'a> NsonDeserialize<'a>>( &mut self, ) -> Result<Option<K>, Self::Error>
Read the next map key. Read more
Source§fn is_human_readable(&self) -> bool
fn is_human_readable(&self) -> bool
Whether this format produces human-readable output. Read more
Auto Trait Implementations§
impl<'de> Freeze for TreeDecoder<'de>
impl<'de> RefUnwindSafe for TreeDecoder<'de>
impl<'de> Send for TreeDecoder<'de>
impl<'de> Sync for TreeDecoder<'de>
impl<'de> Unpin for TreeDecoder<'de>
impl<'de> UnsafeUnpin for TreeDecoder<'de>
impl<'de> UnwindSafe for TreeDecoder<'de>
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