pub trait Parse: Sized {
Show 13 methods
// Required method
fn parse_in<C, E>(
parser: &mut Parser<C, E>,
context: Context,
) -> Result<(Self, usize), Error<E>>
where C: Iterator<Item = Result<DecodedChar, E>>;
// Provided methods
fn parse_slice(content: &[u8]) -> Result<(Self, CodeMap), Error> { ... }
fn parse_slice_with(
content: &[u8],
options: Options,
) -> Result<(Self, CodeMap), Error> { ... }
fn parse_str(content: &str) -> Result<(Self, CodeMap), Error> { ... }
fn parse_str_with(
content: &str,
options: Options,
) -> Result<(Self, CodeMap), Error> { ... }
fn parse_infallible_utf8<C>(chars: C) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = char> { ... }
fn parse_utf8_infallible_with<C>(
chars: C,
options: Options,
) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = char> { ... }
fn parse_utf8<C, E>(chars: C) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<char, E>> { ... }
fn parse_utf8_with<C, E>(
chars: C,
options: Options,
) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<char, E>> { ... }
fn parse_infallible<C>(chars: C) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = DecodedChar> { ... }
fn parse_infallible_with<C>(
chars: C,
options: Options,
) -> Result<(Self, CodeMap), Error>
where C: Iterator<Item = DecodedChar> { ... }
fn parse<C, E>(chars: C) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<DecodedChar, E>> { ... }
fn parse_with<C, E>(
chars: C,
options: Options,
) -> Result<(Self, CodeMap), Error<E>>
where C: Iterator<Item = Result<DecodedChar, E>> { ... }
}Expand description
Required Methods§
Sourcefn parse_in<C, E>(
parser: &mut Parser<C, E>,
context: Context,
) -> Result<(Self, usize), Error<E>>
fn parse_in<C, E>( parser: &mut Parser<C, E>, context: Context, ) -> Result<(Self, usize), Error<E>>
Parses a value in the middle of an ongoing parse, using parser and
the surrounding Context.
Returns the value along with the index of its code map fragment. This is the single method implementors must provide; everything else is a wrapper around it.
§Errors
Returns Error::Stream if the character stream yields an error, or
another Error variant if the input is not well-formed JSON.
Provided Methods§
Sourcefn parse_infallible_utf8<C>(chars: C) -> Result<(Self, CodeMap), Error>
fn parse_infallible_utf8<C>(chars: C) -> Result<(Self, CodeMap), Error>
Sourcefn parse_utf8_infallible_with<C>(
chars: C,
options: Options,
) -> Result<(Self, CodeMap), Error>
fn parse_utf8_infallible_with<C>( chars: C, options: Options, ) -> Result<(Self, CodeMap), Error>
Sourcefn parse_utf8<C, E>(chars: C) -> Result<(Self, CodeMap), Error<E>>
fn parse_utf8<C, E>(chars: C) -> Result<(Self, CodeMap), Error<E>>
Parses a value from a fallible iterator of UTF-8 characters.
Stream errors of type E are wrapped in Error::Stream.
§Errors
Returns Error::Stream if the character stream yields an error, or
another Error variant if the input is not well-formed JSON.
Sourcefn parse_utf8_with<C, E>(
chars: C,
options: Options,
) -> Result<(Self, CodeMap), Error<E>>
fn parse_utf8_with<C, E>( chars: C, options: Options, ) -> Result<(Self, CodeMap), Error<E>>
Parses a value from a fallible iterator of UTF-8 characters, with the
given options.
§Errors
Returns Error::Stream if the character stream yields an error, or
another Error variant if the input is not well-formed JSON.
Sourcefn parse_infallible<C>(chars: C) -> Result<(Self, CodeMap), Error>where
C: Iterator<Item = DecodedChar>,
fn parse_infallible<C>(chars: C) -> Result<(Self, CodeMap), Error>where
C: Iterator<Item = DecodedChar>,
Parses a value from an infallible iterator of decoded characters.
Unlike the utf8 variants, DecodedChar carries the byte length of
each character in the source encoding, so spans stay accurate when
the input is not UTF-8.
§Errors
Returns an Error if the input is not well-formed JSON.
Sourcefn parse_infallible_with<C>(
chars: C,
options: Options,
) -> Result<(Self, CodeMap), Error>where
C: Iterator<Item = DecodedChar>,
fn parse_infallible_with<C>(
chars: C,
options: Options,
) -> Result<(Self, CodeMap), Error>where
C: Iterator<Item = DecodedChar>,
Sourcefn parse<C, E>(chars: C) -> Result<(Self, CodeMap), Error<E>>
fn parse<C, E>(chars: C) -> Result<(Self, CodeMap), Error<E>>
Parses a value from a fallible iterator of decoded characters.
§Errors
Returns Error::Stream if the character stream yields an error, or
another Error variant if the input is not well-formed JSON.
Sourcefn parse_with<C, E>(
chars: C,
options: Options,
) -> Result<(Self, CodeMap), Error<E>>
fn parse_with<C, E>( chars: C, options: Options, ) -> Result<(Self, CodeMap), Error<E>>
Parses a value from a fallible iterator of decoded characters, with the
given options.
§Errors
Returns Error::Stream if the character stream yields an error, or
another Error variant if the input is not well-formed JSON.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".