Struct preserves::value::text::reader::TextReader

source ·
pub struct TextReader<'de, 'src, N: NestedValue, Dec: DomainParse<N::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: NestedValue, Dec: DomainParse<N::Embedded>, S: BinarySource<'de>> TextReader<'de, 'src, N, Dec, S>

source

pub fn new(source: &'src mut S, dec: Dec) -> Self

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

source

pub fn toplevel_whitespace_mode(self, new_mode: ToplevelWhitespaceMode) -> Self

source

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

Retrieve the next IOValue in the input stream.

Trait Implementations§

source§

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

source§

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

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

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 mark(&mut self) -> Result<Self::Mark>

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

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

Seek the input to a previously-saved position.
source§

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

Get the next SAX-style event, discarding annotations. Read more
source§

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

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

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

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>

Retrieve the next parseable value, treating end-of-input as an error. Read more
source§

fn next_boolean(&mut self) -> ReaderResult<bool>

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

fn next_double(&mut self) -> ReaderResult<Double>

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

fn next_signedinteger(&mut self) -> ReaderResult<SignedInteger>

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

fn next_i8(&mut self) -> ReaderResult<i8>

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

fn next_u8(&mut self) -> ReaderResult<u8>

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

fn next_i16(&mut self) -> ReaderResult<i16>

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

fn next_u16(&mut self) -> ReaderResult<u16>

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

fn next_i32(&mut self) -> ReaderResult<i32>

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

fn next_u32(&mut self) -> ReaderResult<u32>

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

fn next_i64(&mut self) -> ReaderResult<i64>

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

fn next_u64(&mut self) -> ReaderResult<u64>

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

fn next_i128(&mut self) -> ReaderResult<i128>

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

fn next_u128(&mut self) -> ReaderResult<u128>

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

fn next_f64(&mut self) -> ReaderResult<f64>

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

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.
source§

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

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

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

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

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

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<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.