pub struct MechError2 {
pub program_range: Option<SourceRange>,
pub annotations: Vec<SourceRange>,
pub tokens: Vec<Token>,
pub compiler_location: Option<CompilerSourceRange>,
pub source: Option<Box<MechError2>>,
pub message: Option<String>,
/* private fields */
}Fields§
§program_range: Option<SourceRange>§annotations: Vec<SourceRange>§tokens: Vec<Token>§compiler_location: Option<CompilerSourceRange>§source: Option<Box<MechError2>>§message: Option<String>Implementations§
Source§impl MechError2
impl MechError2
pub fn new<K>(kind: K, message: Option<String>) -> MechError2where
K: MechErrorKind2 + 'static,
Sourcepub fn kind_as<K>(&self) -> Option<&K>where
K: MechErrorKind2 + 'static,
pub fn kind_as<K>(&self) -> Option<&K>where
K: MechErrorKind2 + 'static,
Get the kind as a specific type, if it matches
Sourcepub fn kind_message(&self) -> String
pub fn kind_message(&self) -> String
Get the runtime message (delegates to the underlying kind)
Sourcepub fn display_message(&self) -> String
pub fn display_message(&self) -> String
Optional helper that returns the message or the explicit message override
Sourcepub fn kind_downcast_ref<K>(&self) -> Option<&K>where
K: 'static,
pub fn kind_downcast_ref<K>(&self) -> Option<&K>where
K: 'static,
If you ever need downcast access to the concrete kind:
Sourcepub fn with_compiler_loc(self) -> MechError2
pub fn with_compiler_loc(self) -> MechError2
Add a compiler location annotation with the current location
Sourcepub fn with_specific_compiler_loc(self, loc: CompilerSourceRange) -> MechError2
pub fn with_specific_compiler_loc(self, loc: CompilerSourceRange) -> MechError2
Specify a particular compiler location
Sourcepub fn with_annotation(self, range: SourceRange) -> MechError2
pub fn with_annotation(self, range: SourceRange) -> MechError2
Add a source range annotation
Sourcepub fn with_annotations<I>(self, iter: I) -> MechError2where
I: IntoIterator<Item = SourceRange>,
pub fn with_annotations<I>(self, iter: I) -> MechError2where
I: IntoIterator<Item = SourceRange>,
Add multiple source range annotations
Sourcepub fn with_tokens<I>(self, iter: I) -> MechError2where
I: IntoIterator<Item = Token>,
pub fn with_tokens<I>(self, iter: I) -> MechError2where
I: IntoIterator<Item = Token>,
Add tokens related to this error
Sourcepub fn with_source(self, src: MechError2) -> MechError2
pub fn with_source(self, src: MechError2) -> MechError2
Set the source error that caused this one
Sourcepub fn primary_range(&self) -> Option<SourceRange>
pub fn primary_range(&self) -> Option<SourceRange>
Get the primary source range associated with this error
Sourcepub fn simple_message(&self) -> String
pub fn simple_message(&self) -> String
Get a simple message describing the error
Sourcepub fn full_chain_message(&self) -> String
pub fn full_chain_message(&self) -> String
Get a full chain message including all source errors
pub fn boxed(self) -> Box<MechError2>
Trait Implementations§
Source§impl Clone for MechError2
impl Clone for MechError2
Source§fn clone(&self) -> MechError2
fn clone(&self) -> MechError2
Returns a duplicate of the value. Read more
1.0.0 · 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 MechError2
impl Debug for MechError2
Source§impl From<Error> for MechError2
impl From<Error> for MechError2
Source§fn from(err: Error) -> MechError2
fn from(err: Error) -> MechError2
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for MechError2
impl !RefUnwindSafe for MechError2
impl Send for MechError2
impl Sync for MechError2
impl Unpin for MechError2
impl !UnwindSafe for MechError2
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.