Struct read_token::ReadToken [] [src]

pub struct ReadToken<'a> {
    pub src: &'a str,
    pub offset: usize,
}

Stores the state of parsing.

Fields

Source.

Character offset.

Methods

impl<'a> ReadToken<'a>
[src]

Creates a new ReadToken. The offset is in characters.

Consumes n characters.

Reads a raw string.

Read lines until closure returns None. Returns Ok(range) of the successful read lines. Returns Err(range) when expected new line.

Returns the difference in offset.

Returns an empty range at current offset.

Peek a number of characters ahead.

Reads an expected tag, returns character range and new state. Returns old state when fail to match tag.

Reads a token until any character in string or whitespace. Returns (range, None) if stopping at whitespace or end of characters. Returns (range, Some(x)) if stopping at a character.

Reads token until any character in string. Returns (new_state, range, None) if stopping at end of characters. Returns (new_state, range, Some(x)) if stopping at a character.

Reads whitespace.

Reads string with character escapes.

Reads number.

Parses string into a real string according to the JSON standard.

Assumes the string starts and ends with double-quotes. n is the number of characters to read and must be at least 2, because the string is surrounded by quotes.

Parses number from n characters.

Trait Implementations

impl<'a> Copy for ReadToken<'a>
[src]

impl<'a> Clone for ReadToken<'a>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> Debug for ReadToken<'a>
[src]

Formats the value using the given formatter.