pub enum Error {
Parse {
position: usize,
message: String,
},
InvalidEscape {
char: char,
position: usize,
},
Unclosed {
kind: &'static str,
position: usize,
},
InvalidQuantifier {
position: usize,
message: String,
},
InvalidCharClass {
position: usize,
message: String,
},
InvalidFuzziness {
position: usize,
message: String,
},
InvalidBackreference {
group: usize,
position: usize,
message: String,
},
EmptyPattern,
TooComplex {
message: String,
},
Timeout {
duration: Duration,
},
}Expand description
The main error type for fuzzy regex operations.
Variants§
Parse
Error during pattern parsing.
Fields
InvalidEscape
Invalid escape sequence.
Fields
Unclosed
Unclosed group or bracket.
Fields
InvalidQuantifier
Invalid quantifier.
Fields
InvalidCharClass
Invalid character class.
Fields
InvalidFuzziness
Invalid fuzziness specification.
Fields
InvalidBackreference
Invalid backreference.
Fields
EmptyPattern
Empty pattern where one was required.
TooComplex
Pattern too complex (e.g., too many states).
Timeout
Match operation timed out.
Implementations§
Source§impl Error
impl Error
Sourcepub fn parse(position: usize, message: impl Into<String>) -> Self
pub fn parse(position: usize, message: impl Into<String>) -> Self
Create a parse error at a given position.
Sourcepub fn invalid_escape(char: char, position: usize) -> Self
pub fn invalid_escape(char: char, position: usize) -> Self
Create an invalid escape error.
Sourcepub fn unclosed(kind: &'static str, position: usize) -> Self
pub fn unclosed(kind: &'static str, position: usize) -> Self
Create an unclosed delimiter error.
Sourcepub fn invalid_quantifier(position: usize, message: impl Into<String>) -> Self
pub fn invalid_quantifier(position: usize, message: impl Into<String>) -> Self
Create an invalid quantifier error.
Sourcepub fn invalid_char_class(position: usize, message: impl Into<String>) -> Self
pub fn invalid_char_class(position: usize, message: impl Into<String>) -> Self
Create an invalid character class error.
Sourcepub fn invalid_fuzziness(position: usize, message: impl Into<String>) -> Self
pub fn invalid_fuzziness(position: usize, message: impl Into<String>) -> Self
Create an invalid fuzziness error.
Trait Implementations§
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)>
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()
impl Eq for Error
impl StructuralPartialEq for Error
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin 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