pub struct Error { /* private fields */ }Expand description
An error of reading or of writing a value.
It has the message, and the path in the value, by field and index, which is added to as the error passes out of each field and element, so that it is built only when there is an error. An error of reading has the position in the text. An error in the value of a const has the position of the reference to it, and the const is named.
Implementations§
Source§impl Error
impl Error
Sourcepub fn at(pos: Pos, message: impl Into<String>) -> Error
pub fn at(pos: Pos, message: impl Into<String>) -> Error
An error at a position in the text that is read.
Sourcepub fn new(message: impl Into<String>) -> Error
pub fn new(message: impl Into<String>) -> Error
An error that has no position, as an error of writing has none.
Sourcepub fn step(self, step: Step) -> Error
pub fn step(self, step: Step) -> Error
The error with a step in front of its path, as it passes out of the value that the step leads to.
Sourcepub fn in_const(self, name: &str, pos: Pos) -> Error
pub fn in_const(self, name: &str, pos: Pos) -> Error
The error inside the value of a const, as it passes out of the reference to the const, at pos. The position
in the text of the const’s value means nothing to the reader of the message, so it is replaced by that of the
reference.
Trait Implementations§
Source§impl Display for Error
Shown as shapes[0].colour: in the value of const c: MESSAGE (line 3, col 12), with each part only if there is one.
impl Display for Error
Shown as shapes[0].colour: in the value of const c: MESSAGE (line 3, col 12), with each part only if there is one.
impl Eq for Error
Source§impl Error for Error
impl Error for Error
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()