pub struct CompilationError { /* private fields */ }Expand description
Represents a compilation error with location information and error details.
Implementations§
Source§impl CompilationError
impl CompilationError
Sourcepub fn new(kind: ParseError, span: InputSpan, text: String) -> Self
pub fn new(kind: ParseError, span: InputSpan, text: String) -> Self
Creates a new CompilationError.
§Arguments
kind- The type of parse errorspan- Location information for the errortext- Additional error message text
Sourcepub fn from_pair(
kind: ParseError,
pair: &Pair<'_, Rule>,
exclude_string: bool,
) -> Self
pub fn from_pair( kind: ParseError, pair: &Pair<'_, Rule>, exclude_string: bool, ) -> Self
Creates a CompilationError from a Pest parser Pair.
§Arguments
kind- The type of parse errorpair- Reference to the Pest parser Pairexclude_string- Whether to exclude the parsed string from the error message
Sourcepub fn to_string_from_source(&self, source: &str) -> String
pub fn to_string_from_source(&self, source: &str) -> String
Formats the error message using the original source text.
§Arguments
source- The original source text
Sourcepub fn to_error_string(&self) -> String
pub fn to_error_string(&self) -> String
Returns a formatted error string without source context.
Trait Implementations§
Source§impl Debug for CompilationError
impl Debug for CompilationError
Auto Trait Implementations§
impl Freeze for CompilationError
impl RefUnwindSafe for CompilationError
impl Send for CompilationError
impl Sync for CompilationError
impl Unpin for CompilationError
impl UnwindSafe for CompilationError
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more