pub struct Cheap<S = SimpleSpan<usize>> { /* private fields */ }Expand description
A very cheap error type that tracks only the error span (SimpleSpan by default).
This type is most useful when you want fast parsing but do not particularly care about the quality of error messages.
§Examples
use chumsky::prelude::*;
let parser = just::<_, _, extra::Err<Cheap>>("+");
let error = parser.parse("-").into_errors()[0];
assert_eq!(error.span(), &SimpleSpan::new((), 0..1));Implementations§
Trait Implementations§
Source§impl<'de, S> Deserialize<'de> for Cheap<S>where
S: Deserialize<'de>,
impl<'de, S> Deserialize<'de> for Cheap<S>where
S: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a, I: Input<'a>, L> LabelError<'a, I, L> for Cheap<I::Span>
impl<'a, I: Input<'a>, L> LabelError<'a, I, L> for Cheap<I::Span>
Source§fn expected_found<E: IntoIterator<Item = L>>(
_expected: E,
_found: Option<MaybeRef<'a, I::Token>>,
span: I::Span,
) -> Self
fn expected_found<E: IntoIterator<Item = L>>( _expected: E, _found: Option<MaybeRef<'a, I::Token>>, span: I::Span, ) -> Self
Create a new error describing a conflict between expected inputs and that which was actually found. Read more
Source§fn merge_expected_found<E: IntoIterator<Item = L>>(
self,
expected: E,
found: Option<MaybeRef<'src, I::Token>>,
span: I::Span,
) -> Selfwhere
Self: Error<'src, I>,
fn merge_expected_found<E: IntoIterator<Item = L>>(
self,
expected: E,
found: Option<MaybeRef<'src, I::Token>>,
span: I::Span,
) -> Selfwhere
Self: Error<'src, I>,
Fast path for
a.merge(LabelError::expected_found(...)) that may incur less overhead by, for example, reusing allocations.Source§fn replace_expected_found<E: IntoIterator<Item = L>>(
self,
expected: E,
found: Option<MaybeRef<'src, I::Token>>,
span: I::Span,
) -> Self
fn replace_expected_found<E: IntoIterator<Item = L>>( self, expected: E, found: Option<MaybeRef<'src, I::Token>>, span: I::Span, ) -> Self
Fast path for
a = LabelError::expected_found(...) that may incur less overhead by, for example, reusing allocations.Source§fn label_with(&mut self, label: L)
fn label_with(&mut self, label: L)
Annotate the expected patterns within this parser with the given label. Read more
Source§fn in_context(&mut self, label: L, span: I::Span)
fn in_context(&mut self, label: L, span: I::Span)
Annotate this error, indicating that it occurred within the context denoted by the given label. Read more
Source§impl<S: Ord> Ord for Cheap<S>
impl<S: Ord> Ord for Cheap<S>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<S: PartialOrd> PartialOrd for Cheap<S>
impl<S: PartialOrd> PartialOrd for Cheap<S>
impl<S: Copy> Copy for Cheap<S>
impl<S: Eq> Eq for Cheap<S>
impl<S> StructuralPartialEq for Cheap<S>
Auto Trait Implementations§
impl<S> Freeze for Cheap<S>where
S: Freeze,
impl<S> RefUnwindSafe for Cheap<S>where
S: RefUnwindSafe,
impl<S> Send for Cheap<S>where
S: Send,
impl<S> Sync for Cheap<S>where
S: Sync,
impl<S> Unpin for Cheap<S>where
S: Unpin,
impl<S> UnsafeUnpin for Cheap<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Cheap<S>where
S: UnwindSafe,
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<'p, T> Seq<'p, T> for T
impl<'p, T> Seq<'p, T> for T
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> S::Spanned
fn with_span(self, span: S) -> S::Spanned
Invokes
WrappingSpan::make_wrapped to wrap an AST node in a span.