pub struct LuxError {
pub message: String,
pub span: Span,
pub note: Option<String>,
pub learn: Option<(&'static str, &'static str)>,
}Expand description
An error with a message, the span it happened at, an optional note, and an
optional trail to a lux learn topic — a (topic, lure) pair, where the
lure is a one-line hint at why the idea is worth following.
Fields§
§message: String§span: Span§note: Option<String>§learn: Option<(&'static str, &'static str)>Implementations§
Source§impl LuxError
impl LuxError
pub fn new(message: impl Into<String>, span: Span) -> Self
Sourcepub fn with_note(self, note: impl Into<String>) -> Self
pub fn with_note(self, note: impl Into<String>) -> Self
Attach a hint about how to fix the problem.
Sourcepub fn with_learn(self, topic: &'static str, lure: &'static str) -> Self
pub fn with_learn(self, topic: &'static str, lure: &'static str) -> Self
Open a trail to the lux learn topic that teaches this, with a one-line
lure hinting at why it is worth following. Set it only where there is a
clean topic that genuinely covers the mistake; a self-evident fix needs
only a note, not a trail.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LuxError
impl RefUnwindSafe for LuxError
impl Send for LuxError
impl Sync for LuxError
impl Unpin for LuxError
impl UnsafeUnpin for LuxError
impl UnwindSafe for LuxError
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