Struct scan_rules::ScanError
[−]
[src]
pub struct ScanError<'a> { pub at: Cursor<'a>, 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: Cursor<'a>
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<'a> ScanError<'a>
[src]
fn new(at: Cursor<'a>, kind: ScanErrorKind) -> Self
Construct a new ScanError
.
fn expected_end(at: Cursor<'a>) -> Self
Shorthand for constructing an ExpectedEnd
error.
fn io(err: Error) -> Self
Shorthand for constructing an Io
error.
fn literal_mismatch(at: Cursor<'a>) -> Self
Shorthand for constructing a LiteralMismatch
error.
fn syntax(at: Cursor<'a>, desc: &'static str) -> Self
Shorthand for constructing a Syntax
error.
fn other<E: Into<Box<Error>>>(at: Cursor<'a>, 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 into_static(self) -> ScanError<'static>
Replace the borrowed components of the ScanError
with 'static
dummy values, allowing the error to escape beyond the lifetime of the original input data.
Trait Implementations
impl<'a> Debug for ScanError<'a>
[src]
impl<'a> Display for ScanError<'a>
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.