pub enum FragmentError {
NestingTooDeep(FlmDiagnostic),
Aborted(ParseError<FlmOrigin>),
WorkerThread(FlmDiagnostic),
}Expand description
The error that a parse returns when it cannot produce a tree.
A parse reports each problem in the source as a diagnostic and continues.
An error in the syntax of the document therefore never causes a
FragmentError. FragmentError::diagnostic returns a diagnostic that
reports the error, to be recorded in place of the missing tree.
Variants§
NestingTooDeep(FlmDiagnostic)
The content is nested too deeply, and the recursion guard stopped the
parse. The diagnostic has the condition NestingTooDeep and the
position at which the guard stopped the parse.
Aborted(ParseError<FlmOrigin>)
The parse was aborted because of an error in the program: a parser of an
extension broke a requirement of techy’s parser, or a method of the
language failed. The ParseError is the error with which techy
aborted the parse.
WorkerThread(FlmDiagnostic)
The parse did not run: the calling thread is not a worker thread, and
the operating system failed to create one. The diagnostic has the
condition WorkerThreadUnavailable and the position of the start of
the source.
Implementations§
Source§impl FragmentError
impl FragmentError
Sourcepub fn diagnostic(&self) -> FlmDiagnostic
pub fn diagnostic(&self) -> FlmDiagnostic
Returns the diagnostic, at error severity, that reports this error. A program records this diagnostic for a fragment that could not be parsed.
For NestingTooDeep and
WorkerThread, returns the diagnostic of
the variant. For Aborted, returns a
diagnostic with the condition AbortCondition, at the span of the
ParseError. This condition contains the identifier and the message
of the ParseError.
Trait Implementations§
Source§impl Debug for FragmentError
impl Debug for FragmentError
Source§impl Display for FragmentError
impl Display for FragmentError
Source§impl Error for FragmentError
impl Error for FragmentError
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
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for FragmentError
impl !UnwindSafe for FragmentError
impl Forget for FragmentError
impl Freeze for FragmentError
impl Move for FragmentError
impl Send for FragmentError
impl Sync for FragmentError
impl Unpin for FragmentError
impl UnsafeUnpin for FragmentError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
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> ⓘ
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> ⓘ
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