pub enum ParseError {
Show 14 variants
MissingSource {
input: String,
at: usize,
},
UnexpectedEnd {
input: String,
at: usize,
expected: &'static str,
},
UnexpectedChar {
input: String,
at: usize,
found: char,
expected: &'static str,
},
InvalidIdentifier {
input: String,
at: usize,
found: String,
},
EmptyKey {
input: String,
at: usize,
},
EmptyValue {
input: String,
at: usize,
},
InvalidEscape {
input: String,
at: usize,
},
UnclosedString {
input: String,
at: usize,
},
UnclosedList {
input: String,
at: usize,
},
UnclosedMap {
input: String,
at: usize,
},
TrailingComma {
input: String,
at: usize,
},
InvalidNumber {
input: String,
at: usize,
found: String,
},
TrailingInput {
input: String,
at: usize,
rest: String,
},
InvalidOnError {
input: String,
at: usize,
message: String,
},
}Expand description
Error while parsing a configuration source string.
Format: SOURCE [(OPTIONS)] [?] [:RESOURCE] — see the crate README for rules.
Display is one line by default; use {error:#} for the input snippet and caret.
§Examples
use tanzim_source::{Source, ParseError};
let error: ParseError = Source::parse("").unwrap_err();
assert_eq!(
error.to_string(),
"invalid configuration source at column 1: configuration source is required"
);Variants§
MissingSource
No source identifier (empty input or invalid start).
Fields
UnexpectedEnd
Input ended before a required token.
Fields
UnexpectedChar
Unexpected character at the current position.
Fields
InvalidIdentifier
Option or map key is not a valid identifier.
Fields
EmptyKey
Option or map key is empty.
Fields
EmptyValue
Option value is empty; use "" for an empty string.
Fields
InvalidEscape
Invalid escape sequence inside a quoted string.
Fields
UnclosedString
Quoted string has no closing ".
Fields
UnclosedList
List has no closing ].
Fields
UnclosedMap
Map or options block has no closing ).
Fields
TrailingComma
Comma with no following entry.
Fields
InvalidNumber
Token looks like a number but is not valid.
Fields
TrailingInput
Non-empty input after a complete configuration source.
Fields
InvalidOnError
The reserved on_error option is malformed (bad shape, unknown stage, or bad value).
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
impl Eq for ParseError
Source§impl Error for ParseError
impl Error for ParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()