Struct scan_rules::ScanError
[−]
[src]
pub struct ScanError { pub at: ScanErrorAt, pub kind: ScanErrorKind, // some fields omitted }
Represents an error that occurred during scanning.
Depending on what happened, it could represent an actual scanning failure, a problem with the pattern, an underlying IO failure, or something else entirely.
Fields
at: ScanErrorAt
The rough cursor position at which this error occurred. This will typically be the position the input cursor was at when it began trying to scan a particular literal or value.
kind: ScanErrorKind
The kind of error that occurred.
Methods
impl ScanError
[src]
fn new(at: usize, kind: ScanErrorKind) -> Self
Construct a new ScanError
.
fn expected_end() -> Self
Shorthand for constructing an ExpectedEnd
error.
fn float(err: ParseFloatError) -> Self
Shorthand for constructing an Float
error.
fn int(err: ParseIntError) -> Self
Shorthand for constructing an Int
error.
fn io(err: Error) -> Self
Shorthand for constructing an Io
error.
fn literal_mismatch() -> Self
Shorthand for constructing a LiteralMismatch
error.
fn syntax(desc: &'static str) -> Self
Shorthand for constructing a Syntax
error.
fn syntax_no_message() -> Self
Shorthand for constructing a SyntaxNoMessage
error.
fn other<E: Into<Box<Error>>>(err: E) -> Self
Shorthand for constructing an Other
error.
fn furthest_along(self, other: Self) -> Self
Compare two ScanError
s, and return the one which occurred the furthest into the input cursor.
fn add_offset(self, bytes: usize) -> Self
Adds the given number of bytes
to the error's position.
This is used where an error has been generated by trying to scan a subslice of the original input, and the position needs to be corrected.
Trait Implementations
impl Debug for ScanError
[src]
impl<'a> Display for ScanError
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more