pub enum ChordParseError {
Empty,
UnterminatedAngle {
at: usize,
},
EmptyAngle {
at: usize,
},
UnknownName {
name: String,
at: usize,
},
DanglingModifier {
at: usize,
},
DuplicateModifier {
at: usize,
},
BodyTooLong {
name: String,
at: usize,
},
StrayClose {
at: usize,
},
}Expand description
Parse-side error variants. Detail-level so :bind-style error
messages can surface what was wrong.
Every at is the byte offset, in the string handed to the parser, of the
token that failed — the < of an angle token, or the character itself.
§Examples
use lattice_protocol::{ChordParseError, parse_chord_sequence};
assert_eq!(parse_chord_sequence(""), Err(ChordParseError::Empty));
assert_eq!(
parse_chord_sequence("g<C-w"),
Err(ChordParseError::UnterminatedAngle { at: 1 })
);
assert!(matches!(
parse_chord_sequence("<Foo>"),
Err(ChordParseError::UnknownName { .. })
));Variants§
Empty
String was empty.
UnterminatedAngle
<...> token had no closing >.
EmptyAngle
<...> token body was empty (<>).
UnknownName
<...> body referenced an unknown name (<Foo>, <F99>,
<C-S-X> where the body chunk after modifiers is
unrecognised).
Fields
DanglingModifier
Modifier prefix (C-, S-, M-) without a body (<C->).
DuplicateModifier
The same modifier appeared twice in one token (<C-C-x>).
BodyTooLong
Input that should be exactly one chord was longer. Raised only by
KeyChord::from_str, for trailing input after the first chord
("ab", "<Esc>x"); a multi-character body such as <C-foo>
reports Self::UnknownName instead.
StrayClose
Sequence parser saw a stray > (no matching <).
Trait Implementations§
Source§impl Clone for ChordParseError
impl Clone for ChordParseError
Source§fn clone(&self) -> ChordParseError
fn clone(&self) -> ChordParseError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChordParseError
impl Debug for ChordParseError
Source§impl Display for ChordParseError
impl Display for ChordParseError
impl Eq for ChordParseError
Source§impl Error for ChordParseError
impl Error for ChordParseError
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()
Source§impl PartialEq for ChordParseError
impl PartialEq for ChordParseError
impl StructuralPartialEq for ChordParseError
Auto Trait Implementations§
impl Freeze for ChordParseError
impl RefUnwindSafe for ChordParseError
impl Send for ChordParseError
impl Sync for ChordParseError
impl Unpin for ChordParseError
impl UnsafeUnpin for ChordParseError
impl UnwindSafe for ChordParseError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> ErrorExt for T
impl<T> ErrorExt for T
§fn and_raise<T>(self, context: T) -> Exn<T>
fn and_raise<T>(self, context: T) -> Exn<T>
§fn raise_erased(self) -> Exnwhere
Self: Sized,
fn raise_erased(self) -> Exnwhere
Self: Sized,
§fn raise_all<T, I>(self, sources: I) -> Exn<Self>where
Self: Sized,
T: Error + Send + Sync + 'static,
I: IntoIterator,
<I as IntoIterator>::Item: Into<Exn<T>>,
fn raise_all<T, I>(self, sources: I) -> Exn<Self>where
Self: Sized,
T: Error + Send + Sync + 'static,
I: IntoIterator,
<I as IntoIterator>::Item: Into<Exn<T>>,
sources as causes.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Pointee for T
impl<T> Pointee for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString]. Read more