Enum pex::StopBecause
source · pub enum StopBecause {
Uninitialized,
ExpectEOF {
position: usize,
},
ExpectRepeats {
min: usize,
current: usize,
position: usize,
},
MissingCharacterRange {
start: char,
end: char,
position: usize,
},
MissingCharacterSet {
expected: &'static str,
position: usize,
},
MissingString {
message: &'static str,
position: usize,
},
MustBe {
message: &'static str,
position: usize,
},
ShouldNotBe {
message: &'static str,
position: usize,
},
Custom(CustomError<'static>),
}Expand description
Stop reason, contains the minimum information needed to express an error.
Variants§
Uninitialized
This error is not initialized
ExpectEOF
Expect end of string
ExpectRepeats
Fields
Expect repeats pattern
MissingCharacterRange
Fields
Expect some character or character range in range
MissingCharacterSet
Fields
Expect some character
MissingString
Fields
Expect some string
MustBe
Fields
Must be some pattern
ShouldNotBe
Fields
Should not be some pattern
Custom(CustomError<'static>)
A custom error message
Implementations§
source§impl StopBecause
impl StopBecause
sourcepub const fn must_be<T>(
message: &'static str,
position: usize
) -> Result<T, StopBecause>
pub const fn must_be<T>( message: &'static str, position: usize ) -> Result<T, StopBecause>
Create a new StopBecause::MustBe error
sourcepub const fn expect_eof<T>(position: usize) -> Result<T, StopBecause>
pub const fn expect_eof<T>(position: usize) -> Result<T, StopBecause>
Create a new StopBecause::ExpectEof error
sourcepub const fn missing_character<T>(
expected: char,
position: usize
) -> Result<T, StopBecause>
pub const fn missing_character<T>( expected: char, position: usize ) -> Result<T, StopBecause>
Create a new StopBecause::MissingCharacter error
sourcepub const fn missing_character_range<T>(
start: char,
end: char,
position: usize
) -> Result<T, StopBecause>
pub const fn missing_character_range<T>( start: char, end: char, position: usize ) -> Result<T, StopBecause>
Create a new StopBecause::MissingCharacterRange error
sourcepub const fn missing_character_set<T>(
expected: &'static str,
position: usize
) -> Result<T, StopBecause>
pub const fn missing_character_set<T>( expected: &'static str, position: usize ) -> Result<T, StopBecause>
Create a new StopBecause::MissingCharacter error
sourcepub const fn missing_string<T>(
message: &'static str,
position: usize
) -> Result<T, StopBecause>
pub const fn missing_string<T>( message: &'static str, position: usize ) -> Result<T, StopBecause>
Create a new StopBecause::MissingString error
sourcepub const fn custom_error<T>(
message: &'static str,
start: usize,
end: usize
) -> Result<T, StopBecause>
pub const fn custom_error<T>( message: &'static str, start: usize, end: usize ) -> Result<T, StopBecause>
Create a new CustomError
Trait Implementations§
source§impl Clone for StopBecause
impl Clone for StopBecause
source§fn clone(&self) -> StopBecause
fn clone(&self) -> StopBecause
Returns a copy 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 StopBecause
impl Debug for StopBecause
source§impl Default for StopBecause
impl Default for StopBecause
source§impl Display for StopBecause
impl Display for StopBecause
source§impl Error for StopBecause
impl Error for StopBecause
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl From<CharTryFromError> for StopBecause
impl From<CharTryFromError> for StopBecause
source§fn from(_: CharTryFromError) -> Self
fn from(_: CharTryFromError) -> Self
Converts to this type from the input type.
source§impl From<CustomError<'static>> for StopBecause
impl From<CustomError<'static>> for StopBecause
source§fn from(value: CustomError<'static>) -> Self
fn from(value: CustomError<'static>) -> Self
Converts to this type from the input type.
source§impl From<ParseFloatError> for StopBecause
impl From<ParseFloatError> for StopBecause
source§fn from(_: ParseFloatError) -> Self
fn from(_: ParseFloatError) -> Self
Converts to this type from the input type.
source§impl From<ParseIntError> for StopBecause
impl From<ParseIntError> for StopBecause
source§fn from(_: ParseIntError) -> Self
fn from(_: ParseIntError) -> Self
Converts to this type from the input type.
source§impl Hash for StopBecause
impl Hash for StopBecause
source§impl PartialEq<StopBecause> for StopBecause
impl PartialEq<StopBecause> for StopBecause
source§fn eq(&self, other: &StopBecause) -> bool
fn eq(&self, other: &StopBecause) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl Copy for StopBecause
impl Eq for StopBecause
impl StructuralEq for StopBecause
impl StructuralPartialEq for StopBecause
Auto Trait Implementations§
impl RefUnwindSafe for StopBecause
impl Send for StopBecause
impl Sync for StopBecause
impl Unpin for StopBecause
impl UnwindSafe for StopBecause
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