pub trait Reader<'de, N: NestedValue> {
type Mark;
Show 26 methods
// Required methods
fn next(&mut self, read_annotations: bool) -> Result<Option<N>>;
fn mark(&mut self) -> Result<Self::Mark>;
fn restore(&mut self, mark: &Self::Mark) -> Result<()>;
fn next_token(
&mut self,
read_embedded_annotations: bool,
) -> Result<Token<N>>;
fn next_annotations_and_token(&mut self) -> Result<(Vec<N>, Token<N>)>;
// Provided methods
fn skip_value(&mut self) -> Result<()> { ... }
fn demand_next(&mut self, read_annotations: bool) -> Result<N> { ... }
fn next_boolean(&mut self) -> ReaderResult<bool> { ... }
fn next_double(&mut self) -> ReaderResult<Double> { ... }
fn next_signedinteger(&mut self) -> ReaderResult<SignedInteger> { ... }
fn next_i8(&mut self) -> ReaderResult<i8> { ... }
fn next_u8(&mut self) -> ReaderResult<u8> { ... }
fn next_i16(&mut self) -> ReaderResult<i16> { ... }
fn next_u16(&mut self) -> ReaderResult<u16> { ... }
fn next_i32(&mut self) -> ReaderResult<i32> { ... }
fn next_u32(&mut self) -> ReaderResult<u32> { ... }
fn next_i64(&mut self) -> ReaderResult<i64> { ... }
fn next_u64(&mut self) -> ReaderResult<u64> { ... }
fn next_i128(&mut self) -> ReaderResult<i128> { ... }
fn next_u128(&mut self) -> ReaderResult<u128> { ... }
fn next_f64(&mut self) -> ReaderResult<f64> { ... }
fn next_char(&mut self) -> ReaderResult<char> { ... }
fn next_str(&mut self) -> ReaderResult<Cow<'de, str>> { ... }
fn next_bytestring(&mut self) -> ReaderResult<Cow<'de, [u8]>> { ... }
fn next_symbol(&mut self) -> ReaderResult<Cow<'de, str>> { ... }
fn configured(
self,
read_annotations: bool,
) -> ConfiguredReader<'de, N, Self> ⓘ
where Self: Sized { ... }
}
Expand description
Generic parser for Preserves.
Required Associated Types§
Required Methods§
sourcefn next(&mut self, read_annotations: bool) -> Result<Option<N>>
fn next(&mut self, read_annotations: bool) -> Result<Option<N>>
Retrieve the next parseable value or an indication of end-of-input.
Yields Ok(Some(...))
if a complete value is available, Ok(None)
if the end of
stream has been reached, or Err(...)
for parse or IO errors, including
incomplete/partial input. See also Reader::demand_next.
sourcefn mark(&mut self) -> Result<Self::Mark>
fn mark(&mut self) -> Result<Self::Mark>
Retrieve a marker for the current position in the input.
sourcefn restore(&mut self, mark: &Self::Mark) -> Result<()>
fn restore(&mut self, mark: &Self::Mark) -> Result<()>
Seek the input to a previously-saved position.
Provided Methods§
sourcefn skip_value(&mut self) -> Result<()>
fn skip_value(&mut self) -> Result<()>
Skips the next available complete value. Yields an error if no such value exists.
sourcefn demand_next(&mut self, read_annotations: bool) -> Result<N>
fn demand_next(&mut self, read_annotations: bool) -> Result<N>
Retrieve the next parseable value, treating end-of-input as an error.
Yields Ok(...)
if a complete value is available or Err(...)
for parse or IO errors,
including incomplete/partial input or end of stream. See also Reader::next.
sourcefn next_boolean(&mut self) -> ReaderResult<bool>
fn next_boolean(&mut self) -> ReaderResult<bool>
Yields the next value, if it is a Boolean
, or an error otherwise.
sourcefn next_double(&mut self) -> ReaderResult<Double>
fn next_double(&mut self) -> ReaderResult<Double>
Yields the next value, if it is a Double
, or an error otherwise.
sourcefn next_signedinteger(&mut self) -> ReaderResult<SignedInteger>
fn next_signedinteger(&mut self) -> ReaderResult<SignedInteger>
Yields the next value, if it is a SignedInteger
, or an error otherwise.
sourcefn next_i8(&mut self) -> ReaderResult<i8>
fn next_i8(&mut self) -> ReaderResult<i8>
Yields the next value, if it is a SignedInteger
that fits in i8, or an error
otherwise.
sourcefn next_u8(&mut self) -> ReaderResult<u8>
fn next_u8(&mut self) -> ReaderResult<u8>
Yields the next value, if it is a SignedInteger
that fits in u8, or an error
otherwise.
sourcefn next_i16(&mut self) -> ReaderResult<i16>
fn next_i16(&mut self) -> ReaderResult<i16>
Yields the next value, if it is a SignedInteger
that fits in i16, or an error
otherwise.
sourcefn next_u16(&mut self) -> ReaderResult<u16>
fn next_u16(&mut self) -> ReaderResult<u16>
Yields the next value, if it is a SignedInteger
that fits in u16, or an error
otherwise.
sourcefn next_i32(&mut self) -> ReaderResult<i32>
fn next_i32(&mut self) -> ReaderResult<i32>
Yields the next value, if it is a SignedInteger
that fits in i32, or an error
otherwise.
sourcefn next_u32(&mut self) -> ReaderResult<u32>
fn next_u32(&mut self) -> ReaderResult<u32>
Yields the next value, if it is a SignedInteger
that fits in u32, or an error
otherwise.
sourcefn next_i64(&mut self) -> ReaderResult<i64>
fn next_i64(&mut self) -> ReaderResult<i64>
Yields the next value, if it is a SignedInteger
that fits in i64, or an error
otherwise.
sourcefn next_u64(&mut self) -> ReaderResult<u64>
fn next_u64(&mut self) -> ReaderResult<u64>
Yields the next value, if it is a SignedInteger
that fits in u64, or an error
otherwise.
sourcefn next_i128(&mut self) -> ReaderResult<i128>
fn next_i128(&mut self) -> ReaderResult<i128>
Yields the next value, if it is a SignedInteger
that fits in i128, or an error
otherwise.
sourcefn next_u128(&mut self) -> ReaderResult<u128>
fn next_u128(&mut self) -> ReaderResult<u128>
Yields the next value, if it is a SignedInteger
that fits in u128, or an error
otherwise.
sourcefn next_f64(&mut self) -> ReaderResult<f64>
fn next_f64(&mut self) -> ReaderResult<f64>
Yields the next value as an f64, if it is a Double
, or an error otherwise.
sourcefn next_char(&mut self) -> ReaderResult<char>
fn next_char(&mut self) -> ReaderResult<char>
Yields the next value as a char, if it is parseable by Value::to_char, or an error otherwise.
sourcefn next_str(&mut self) -> ReaderResult<Cow<'de, str>>
fn next_str(&mut self) -> ReaderResult<Cow<'de, str>>
Yields the next value, if it is a String
, or an error otherwise.
sourcefn next_bytestring(&mut self) -> ReaderResult<Cow<'de, [u8]>>
fn next_bytestring(&mut self) -> ReaderResult<Cow<'de, [u8]>>
Yields the next value, if it is a ByteString
, or an error otherwise.
sourcefn next_symbol(&mut self) -> ReaderResult<Cow<'de, str>>
fn next_symbol(&mut self) -> ReaderResult<Cow<'de, str>>
Yields the next value, if it is a Symbol
, or an error otherwise.
sourcefn configured(self, read_annotations: bool) -> ConfiguredReader<'de, N, Self> ⓘwhere
Self: Sized,
fn configured(self, read_annotations: bool) -> ConfiguredReader<'de, N, Self> ⓘwhere
Self: Sized,
Constructs a ConfiguredReader set with the given value for read_annotations
.