[][src]Enum json5format::Error

pub enum Error {
    Configuration(String),
    Parse(Option<Location>, String),
    Internal(Option<Location>, String),
    TestFailure(Option<Location>, String),
}

Errors produced by the json5format library.

Variants

Configuration(String)

A formatter configuration option was invalid.

A syntax error was encountered while parsing a JSON5 document.

Internal(Option<Location>, String)

The parser or formatter entered an unexpected state. An Error::Internal likely indicates there is a software bug in the json5format library.

TestFailure(Option<Location>, String)

This error is only produced by internal test functions to indicate a test result did not match expectations.

Implementations

impl Error[src]

pub fn configuration(err: impl Display) -> Self[src]

Return a configuration error.

Arguments

  • err - The error message.

pub fn parse(location: Option<Location>, err: impl Display) -> Self[src]

Return a parsing error.

Arguments

  • location - Optional location in the JSON5 document where the error was detected.
  • err - The error message.

pub fn internal(location: Option<Location>, err: impl Into<String>) -> Self[src]

Return an internal error (indicating an error in the software implementation itself).

Arguments

  • location - Optional location in the JSON5 document where the error was detected, which might be available if the error occurred while parsing the document.
  • err - The error message.

pub fn test_failure(location: Option<Location>, err: impl Into<String>) -> Self[src]

Return a TestFailure error.

Arguments

  • location - Optional Rust source code location where the test failed.
  • err - The error message.

Trait Implementations

impl Debug for Error[src]

impl Display for Error[src]

impl Error for Error[src]

Auto Trait Implementations

impl RefUnwindSafe for Error

impl Send for Error

impl Sync for Error

impl Unpin for Error

impl UnwindSafe for Error

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.