Trait preserves_schema::support::Reader

source ·
pub trait Reader<'de, N>
where N: NestedValue,
{ type Mark;
Show 26 methods // Required methods fn next(&mut self, read_annotations: bool) -> Result<Option<N>, Error>; fn mark(&mut self) -> Result<Self::Mark, Error>; fn restore(&mut self, mark: &Self::Mark) -> Result<(), Error>; fn next_token( &mut self, read_embedded_annotations: bool ) -> Result<Token<N>, Error>; fn next_annotations_and_token( &mut self ) -> Result<(Vec<N>, Token<N>), Error>; // Provided methods fn skip_value(&mut self) -> Result<(), Error> { ... } fn demand_next(&mut self, read_annotations: bool) -> Result<N, Error> { ... } fn next_boolean(&mut self) -> Result<bool, Error> { ... } fn next_double(&mut self) -> Result<Double, Error> { ... } fn next_signedinteger(&mut self) -> Result<SignedInteger, Error> { ... } fn next_i8(&mut self) -> Result<i8, Error> { ... } fn next_u8(&mut self) -> Result<u8, Error> { ... } fn next_i16(&mut self) -> Result<i16, Error> { ... } fn next_u16(&mut self) -> Result<u16, Error> { ... } fn next_i32(&mut self) -> Result<i32, Error> { ... } fn next_u32(&mut self) -> Result<u32, Error> { ... } fn next_i64(&mut self) -> Result<i64, Error> { ... } fn next_u64(&mut self) -> Result<u64, Error> { ... } fn next_i128(&mut self) -> Result<i128, Error> { ... } fn next_u128(&mut self) -> Result<u128, Error> { ... } fn next_f64(&mut self) -> Result<f64, Error> { ... } fn next_char(&mut self) -> Result<char, Error> { ... } fn next_str(&mut self) -> Result<Cow<'de, str>, Error> { ... } fn next_bytestring(&mut self) -> Result<Cow<'de, [u8]>, Error> { ... } fn next_symbol(&mut self) -> Result<Cow<'de, str>, Error> { ... } fn configured( self, read_annotations: bool ) -> ConfiguredReader<'de, N, Self> where Self: Sized { ... }
}
Expand description

Generic parser for Preserves.

Required Associated Types§

source

type Mark

Allows structured backtracking to an earlier stage in a parse. Useful for layering parser combinators atop a Reader.

Required Methods§

source

fn next(&mut self, read_annotations: bool) -> Result<Option<N>, Error>

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.

source

fn mark(&mut self) -> Result<Self::Mark, Error>

Retrieve a marker for the current position in the input.

source

fn restore(&mut self, mark: &Self::Mark) -> Result<(), Error>

Seek the input to a previously-saved position.

source

fn next_token( &mut self, read_embedded_annotations: bool ) -> Result<Token<N>, Error>

Get the next SAX-style event, discarding annotations.

The read_embedded_annotations controls whether annotations are also skipped on embedded values or not.

source

fn next_annotations_and_token(&mut self) -> Result<(Vec<N>, Token<N>), Error>

Get the next SAX-style event, plus a vector containing any annotations that preceded it.

Provided Methods§

source

fn skip_value(&mut self) -> Result<(), Error>

Skips the next available complete value. Yields an error if no such value exists.

source

fn demand_next(&mut self, read_annotations: bool) -> Result<N, Error>

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.

source

fn next_boolean(&mut self) -> Result<bool, Error>

Yields the next value, if it is a Boolean, or an error otherwise.

source

fn next_double(&mut self) -> Result<Double, Error>

Yields the next value, if it is a Double, or an error otherwise.

source

fn next_signedinteger(&mut self) -> Result<SignedInteger, Error>

Yields the next value, if it is a SignedInteger, or an error otherwise.

source

fn next_i8(&mut self) -> Result<i8, Error>

Yields the next value, if it is a SignedInteger that fits in i8, or an error otherwise.

source

fn next_u8(&mut self) -> Result<u8, Error>

Yields the next value, if it is a SignedInteger that fits in u8, or an error otherwise.

source

fn next_i16(&mut self) -> Result<i16, Error>

Yields the next value, if it is a SignedInteger that fits in i16, or an error otherwise.

source

fn next_u16(&mut self) -> Result<u16, Error>

Yields the next value, if it is a SignedInteger that fits in u16, or an error otherwise.

source

fn next_i32(&mut self) -> Result<i32, Error>

Yields the next value, if it is a SignedInteger that fits in i32, or an error otherwise.

source

fn next_u32(&mut self) -> Result<u32, Error>

Yields the next value, if it is a SignedInteger that fits in u32, or an error otherwise.

source

fn next_i64(&mut self) -> Result<i64, Error>

Yields the next value, if it is a SignedInteger that fits in i64, or an error otherwise.

source

fn next_u64(&mut self) -> Result<u64, Error>

Yields the next value, if it is a SignedInteger that fits in u64, or an error otherwise.

source

fn next_i128(&mut self) -> Result<i128, Error>

Yields the next value, if it is a SignedInteger that fits in i128, or an error otherwise.

source

fn next_u128(&mut self) -> Result<u128, Error>

Yields the next value, if it is a SignedInteger that fits in u128, or an error otherwise.

source

fn next_f64(&mut self) -> Result<f64, Error>

Yields the next value as an f64, if it is a Double, or an error otherwise.

source

fn next_char(&mut self) -> Result<char, Error>

Yields the next value as a char, if it is parseable by Value::to_char, or an error otherwise.

source

fn next_str(&mut self) -> Result<Cow<'de, str>, Error>

Yields the next value, if it is a String, or an error otherwise.

source

fn next_bytestring(&mut self) -> Result<Cow<'de, [u8]>, Error>

Yields the next value, if it is a ByteString, or an error otherwise.

source

fn next_symbol(&mut self) -> Result<Cow<'de, str>, Error>

Yields the next value, if it is a Symbol, or an error otherwise.

source

fn configured(self, read_annotations: bool) -> ConfiguredReader<'de, N, Self>
where Self: Sized,

Constructs a ConfiguredReader set with the given value for read_annotations.

Implementations on Foreign Types§

source§

impl<'r, 'de, N, R> Reader<'de, N> for &'r mut R
where N: NestedValue, R: Reader<'de, N>,

source§

fn next(&mut self, read_annotations: bool) -> Result<Option<N>, Error>

§

type Mark = <R as Reader<'de, N>>::Mark

source§

fn mark(&mut self) -> Result<<&'r mut R as Reader<'de, N>>::Mark, Error>

source§

fn restore( &mut self, mark: &<&'r mut R as Reader<'de, N>>::Mark ) -> Result<(), Error>

source§

fn next_token( &mut self, read_embedded_annotations: bool ) -> Result<Token<N>, Error>

source§

fn next_annotations_and_token(&mut self) -> Result<(Vec<N>, Token<N>), Error>

Implementors§

source§

impl<'de, 'src, N, Dec, S> Reader<'de, N> for PackedReader<'de, 'src, N, Dec, S>
where N: NestedValue, Dec: DomainDecode<<N as NestedValue>::Embedded>, S: BinarySource<'de>,

§

type Mark = <S as BinarySource<'de>>::Mark

source§

impl<'de, 'src, N, Dec, S> Reader<'de, N> for TextReader<'de, 'src, N, Dec, S>
where N: NestedValue, Dec: DomainParse<<N as NestedValue>::Embedded>, S: BinarySource<'de>,

§

type Mark = <S as BinarySource<'de>>::Mark