#[non_exhaustive]pub struct ExpressionError {
pub description: String,
pub start: i32,
pub end: i32,
}Expand description
What is wrong with an expression, and where.
The positions are indices into the expression text that was checked: start
is where the error begins and end is the first character past it, so the
pair slices the offending span.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.description: StringThe engine’s description of the error.
start: i32Index in the expression where the error begins.
end: i32Index of the first character beyond the error.
Implementations§
Source§impl ExpressionError
impl ExpressionError
Sourcepub fn span<'text>(&self, expression: &'text str) -> Option<&'text str>
pub fn span<'text>(&self, expression: &'text str) -> Option<&'text str>
The part of expression the engine flagged, when the reported span
falls inside it.
A caller underlining the error in a panel wants the span rather than the
indices. Returns None if the span is not a valid range within the text,
which is what the engine reports when the error has no single location.
Trait Implementations§
Source§impl Clone for ExpressionError
impl Clone for ExpressionError
Source§fn clone(&self) -> ExpressionError
fn clone(&self) -> ExpressionError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExpressionError
impl Debug for ExpressionError
Source§impl Display for ExpressionError
impl Display for ExpressionError
impl Eq for ExpressionError
Source§impl Error for ExpressionError
impl Error for ExpressionError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for ExpressionError
impl PartialEq for ExpressionError
impl StructuralPartialEq for ExpressionError
Auto Trait Implementations§
impl Freeze for ExpressionError
impl RefUnwindSafe for ExpressionError
impl Send for ExpressionError
impl Sync for ExpressionError
impl Unpin for ExpressionError
impl UnsafeUnpin for ExpressionError
impl UnwindSafe for ExpressionError
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