pub enum FilterError {
Show 20 variants
SyntaxError {
position: usize,
line: usize,
column: usize,
message: String,
suggestion: Option<String>,
},
UnexpectedEof {
position: usize,
expected: String,
},
InvalidChar {
char: char,
position: usize,
},
UnclosedString {
position: usize,
},
UnclosedParen {
position: usize,
},
InvalidEscape {
char: char,
position: usize,
},
InvalidNumber {
value: String,
position: usize,
},
TypeMismatch {
field: String,
expected: String,
actual: String,
},
IncompatibleTypes {
left_type: String,
right_type: String,
},
InvalidOperatorForType {
operator: String,
value_type: String,
},
UnknownField {
field: String,
},
DivisionByZero,
NullValue {
field: String,
},
IndexOutOfBounds {
index: usize,
length: usize,
},
InvalidExpression {
message: String,
},
NestingTooDeep {
max_depth: usize,
actual_depth: usize,
},
ExpressionTooComplex {
max_nodes: usize,
actual_nodes: usize,
},
InputTooLong {
max_length: usize,
actual_length: usize,
},
ArrayTooLarge {
max_elements: usize,
actual_elements: usize,
},
InvalidStrategy(String),
}Expand description
Filter error with position information.
Represents all possible errors that can occur during filter parsing and evaluation. Each error variant includes contextual information to help diagnose and fix the issue.
§Error Codes
Error codes follow a structured pattern for easy categorization:
E001-E099: Syntax errors (parsing)E101-E199: Type errors (type checking)E201-E299: Evaluation errors (runtime)E301-E399: Limit errors (resource constraints)
§Example
use edgevec::filter::FilterError;
let error = FilterError::SyntaxError {
position: 10,
line: 1,
column: 11,
message: "Expected operator".to_string(),
suggestion: Some("Did you mean '=' instead of ':'?".to_string()),
};
assert_eq!(error.code(), "E001");Variants§
SyntaxError
General syntax error during parsing.
This is the catch-all error for parser failures that don’t fit into more specific categories.
Fields
UnexpectedEof
Unexpected end of input while parsing.
The parser expected more tokens but reached the end of the string.
Fields
InvalidChar
Invalid character encountered during parsing.
The parser found a character that isn’t valid in filter expressions.
UnclosedString
Unclosed string literal.
A string literal was started but never closed with a matching quote.
UnclosedParen
Unclosed parenthesis.
An opening parenthesis was found but never closed.
InvalidEscape
Invalid escape sequence in string.
An escape sequence like \x was found that isn’t supported.
InvalidNumber
Invalid number literal.
A number was malformed (e.g., multiple decimal points).
TypeMismatch
Type mismatch in operation.
An operation was attempted with incompatible types.
Fields
IncompatibleTypes
Incompatible types for comparison.
Two values of incompatible types were compared.
InvalidOperatorForType
Invalid operator for type.
An operator was used with a type that doesn’t support it.
UnknownField
Unknown field reference.
A field was referenced that doesn’t exist in the metadata schema.
DivisionByZero
Division by zero during evaluation.
NullValue
Null value in non-nullable context.
IndexOutOfBounds
Array index out of bounds.
InvalidExpression
Invalid expression for evaluation.
A literal was used where a boolean expression was expected.
NestingTooDeep
Expression nesting too deep.
The filter expression exceeds the maximum allowed nesting depth. This limit prevents stack overflow during evaluation.
ExpressionTooComplex
Expression too complex.
The filter expression has too many nodes/operations.
InputTooLong
Input string too long.
The filter expression string exceeds the maximum allowed length.
Fields
ArrayTooLarge
Array literal too large.
An array literal in the filter has too many elements.
InvalidStrategy(String)
Invalid filter strategy configuration.
The filter strategy parameters are invalid (e.g., oversample < 1.0).
Implementations§
Source§impl FilterError
impl FilterError
Sourcepub fn code(&self) -> &'static str
pub fn code(&self) -> &'static str
Get the error code for WASM serialization.
Error codes follow a structured pattern:
E001-E099: Syntax errorsE101-E199: Type errorsE201-E299: Evaluation errorsE301-E399: Limit errors
§Example
use edgevec::filter::FilterError;
let error = FilterError::SyntaxError {
position: 0,
line: 1,
column: 1,
message: "test".to_string(),
suggestion: None,
};
assert_eq!(error.code(), "E001");Sourcepub fn is_syntax_error(&self) -> bool
pub fn is_syntax_error(&self) -> bool
Check if this is a syntax error.
Sourcepub fn is_type_error(&self) -> bool
pub fn is_type_error(&self) -> bool
Check if this is a type error.
Sourcepub fn is_evaluation_error(&self) -> bool
pub fn is_evaluation_error(&self) -> bool
Check if this is an evaluation error.
Sourcepub fn is_limit_error(&self) -> bool
pub fn is_limit_error(&self) -> bool
Check if this is a limit error.
Sourcepub fn position(&self) -> Option<(usize, usize, usize)>
pub fn position(&self) -> Option<(usize, usize, usize)>
Get the position information if available.
Returns (position, line, column) for errors that have position info.
Sourcepub fn suggestion(&self) -> Option<String>
pub fn suggestion(&self) -> Option<String>
Generate a helpful suggestion based on error type.
Returns a suggestion string that can help the user fix the error.
Trait Implementations§
Source§impl Clone for FilterError
impl Clone for FilterError
Source§fn clone(&self) -> FilterError
fn clone(&self) -> FilterError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FilterError
impl Debug for FilterError
Source§impl Display for FilterError
impl Display for FilterError
Source§impl Error for FilterError
impl Error for FilterError
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
Source§impl From<FilterError> for FilteredSearchError
impl From<FilterError> for FilteredSearchError
Source§fn from(e: FilterError) -> Self
fn from(e: FilterError) -> Self
Source§impl PartialEq for FilterError
impl PartialEq for FilterError
impl StructuralPartialEq for FilterError
Auto Trait Implementations§
impl Freeze for FilterError
impl RefUnwindSafe for FilterError
impl Send for FilterError
impl Sync for FilterError
impl Unpin for FilterError
impl UnwindSafe for FilterError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.