pub struct Error { /* private fields */ }
Implementations§
Source§impl Error
impl Error
Sourcepub fn new(kind: ErrorKind, position: usize) -> Error
pub fn new(kind: ErrorKind, position: usize) -> Error
Constructs a new error with the error kind and the position.
§Arguments
kind
- The value of the error. Maintaining the value allows for the messages to be controlled across execution.
position
- The position where the error occurred.
Sourcepub fn message_only(kind: ErrorKind) -> Error
pub fn message_only(kind: ErrorKind) -> Error
Constructs a new error with the error kind and no position.
§Arguments
kind
- The value of the error. Maintaining the value allows for the messages to be controlled across execution.
Sourcepub fn prettify(self, input: &str) -> String
pub fn prettify(self, input: &str) -> String
This function generates a pretty version of the error, with arrows pointing to the exact location of the error. This function also consumes the error, therefore, it should be the last thing called.
§Arguments
input
- The input for the program. This is not maintained with every error because the input might be different.
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnwindSafe for Error
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
Mutably borrows from an owned value. Read more