TextReader

Struct TextReader 

Source
pub struct TextReader<'de, 'src, N, Dec, S>
where N: NestedValue, Dec: DomainParse<<N as NestedValue>::Embedded>, S: BinarySource<'de>,
{ pub source: &'src mut S, pub dec: Dec, pub toplevel_whitespace_mode: ToplevelWhitespaceMode, /* private fields */ }
Expand description

The text syntax Preserves reader.

Fields§

§source: &'src mut S

Underlying source of (utf8) bytes.

§dec: Dec

Decoder for producing Rust values embedded in the text.

§toplevel_whitespace_mode: ToplevelWhitespaceMode

Treatment of whitespace before a toplevel term.

Implementations§

Source§

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

Source

pub fn new(source: &'src mut S, dec: Dec) -> TextReader<'de, 'src, N, Dec, S>

Construct a new reader from a byte (utf8) source and embedded-value decoder.

Source

pub fn toplevel_whitespace_mode( self, new_mode: ToplevelWhitespaceMode, ) -> TextReader<'de, 'src, N, Dec, S>

Source

pub fn next_iovalue(&mut self, read_annotations: bool) -> Result<IOValue, Error>

Retrieve the next IOValue in the input stream.

Trait Implementations§

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>,

Source§

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

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

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

Retrieve the next parseable value or an indication of end-of-input. Read more
Source§

fn mark( &mut self, ) -> Result<<TextReader<'de, 'src, N, Dec, S> as Reader<'de, N>>::Mark, Error>

Retrieve a marker for the current position in the input.
Source§

fn restore( &mut self, mark: &<TextReader<'de, 'src, N, Dec, S> as Reader<'de, N>>::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. Read more
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.
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. Read more
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.

Auto Trait Implementations§

§

impl<'de, 'src, N, Dec, S> Freeze for TextReader<'de, 'src, N, Dec, S>
where Dec: Freeze,

§

impl<'de, 'src, N, Dec, S> RefUnwindSafe for TextReader<'de, 'src, N, Dec, S>

§

impl<'de, 'src, N, Dec, S> Send for TextReader<'de, 'src, N, Dec, S>
where Dec: Send, S: Send, N: Sync,

§

impl<'de, 'src, N, Dec, S> Sync for TextReader<'de, 'src, N, Dec, S>
where Dec: Sync, S: Sync, N: Sync,

§

impl<'de, 'src, N, Dec, S> Unpin for TextReader<'de, 'src, N, Dec, S>
where Dec: Unpin,

§

impl<'de, 'src, N, Dec, S> !UnwindSafe for TextReader<'de, 'src, N, Dec, S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<L, N> Codec<N> for L
where N: NestedValue,

Source§

fn parse<'a, T>(&'a self, value: &N) -> Result<T, ParseError>
where T: Parse<&'a L, N>,

Delegates to T::parse, using self as language and the given value as input.
Source§

fn unparse<'a, T>(&'a self, value: &T) -> N
where T: Unparse<&'a L, N>,

Delegates to value.unparse, using self as language.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more