pub struct ParseError {
pub line: usize,
pub col: usize,
pub code: String,
pub message: String,
}Expand description
An OML source string could not be parsed – raised by
crate::oml::read_oml, mirroring Python’s ParseError in
~/dev/omnist/omnist/errors.py. Carries the same “line N, col N: msg”
convention the Python reference’s scanner/parser produce.
Fields§
§line: usizeLine number where parsing failed (1-indexed).
col: usizeColumn number where parsing failed (1-indexed).
code: StringThe spec’s stable machine-readable code (omnist-spec §8.3.1, e.g.
parse.unexpected-token, parse.codec-syntax).
message: StringHuman-readable parse failure description.
Implementations§
Source§impl ParseError
impl ParseError
Sourcepub fn new(
line: usize,
col: usize,
code: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn new( line: usize, col: usize, code: impl Into<String>, message: impl Into<String>, ) -> Self
Construct a new ParseError with position coordinates and the
spec’s parse.* code.
Sourcepub fn codec_syntax(line: usize, col: usize, message: impl Into<String>) -> Self
pub fn codec_syntax(line: usize, col: usize, message: impl Into<String>) -> Self
Construct a parse.codec-syntax error (omnist-spec §8.3.1): input a
JSON/YAML/TOML/XML codec could not accept, whether malformed in its
own format or refused by a byte-level precondition the spec imposes
ahead of the codec (E-24).
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()
Source§impl From<ParseError> for OmnistError
impl From<ParseError> for OmnistError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Source§impl PartialEq for ParseError
impl PartialEq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnsafeUnpin for ParseError
impl UnwindSafe for ParseError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.