pub enum CelParserError {
PestError(Box<Error<Rule>>),
InvalidIntegerLiteral(String, ParseIntError),
InvalidUintLiteral(String, ParseIntError),
InvalidFloatLiteral(String, ParseFloatError),
InvalidEscapeSequence(String),
IncompleteEscapeSequence(String),
InvalidUnicodeEscape(String),
InvalidUtf8String(FromUtf8Error),
InternalError(String),
}Variants§
PestError(Box<Error<Rule>>)
InvalidIntegerLiteral(String, ParseIntError)
InvalidUintLiteral(String, ParseIntError)
InvalidFloatLiteral(String, ParseFloatError)
InvalidEscapeSequence(String)
IncompleteEscapeSequence(String)
InvalidUnicodeEscape(String)
InvalidUtf8String(FromUtf8Error)
InternalError(String)
Implementations§
Source§impl CelParserError
impl CelParserError
Sourcepub fn location(&self) -> Option<(usize, usize)>
pub fn location(&self) -> Option<(usize, usize)>
Returns the line and column number where the error occurred, if available.
This is useful for providing detailed feedback to users about syntax errors. The location is 1-indexed (line 1, column 1).
§Example
use rust_cel_parser::parse_cel_program;
let result = parse_cel_program("1 + & 2"); // Invalid operator
if let Err(e) = result {
if let Some((line, col)) = e.location() {
println!("Error at line {}, column {}: {}", line, col, e);
assert_eq!(line, 1);
assert_eq!(col, 5);
}
}Trait Implementations§
Source§impl Debug for CelParserError
impl Debug for CelParserError
Source§impl Display for CelParserError
impl Display for CelParserError
Source§impl Error for CelParserError
impl Error for CelParserError
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 From<FromUtf8Error> for CelParserError
impl From<FromUtf8Error> for CelParserError
Source§fn from(source: FromUtf8Error) -> Self
fn from(source: FromUtf8Error) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for CelParserError
impl RefUnwindSafe for CelParserError
impl Send for CelParserError
impl Sync for CelParserError
impl Unpin for CelParserError
impl UnwindSafe for CelParserError
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