[−][src]Struct dangerous::Expected
A catch-all error for all expected errors supported in this crate.
- Enable the
full-context
feature (enabled by default), for full-context stacks. - It is generally recommended for better performance to box
Expected
if the structures being returned from parsing are smaller than or equal to~128 bytes
. This is because theExpected
structure is160 - 184 bytes
large on 64 bit systems and successful parses may be hindered by the time to move theResult<T, Expected>
value. By boxingExpected
the size becomes only8 bytes
. When in doubt, write a benchmark.
See crate::error
for additional documentation around the error system.
Implementations
impl<'i, S> Expected<'i, S> where
S: ContextStack,
[src]
S: ContextStack,
pub fn display(&self) -> ErrorDisplay<'_, Self>
[src]
Returns an ErrorDisplay
for formatting.
Trait Implementations
impl<'i, S> Debug for Expected<'i, S> where
S: ContextStack,
[src]
S: ContextStack,
impl<'i, S> Details<'i> for Expected<'i, S> where
S: ContextStack,
[src]
S: ContextStack,
pub fn input(&self) -> Input<'i>
[src]
pub fn span(&self) -> Input<'i>
[src]
pub fn expected(&self) -> Option<Input<'_>>
[src]
pub fn description(&self, f: &mut dyn Write) -> Result
[src]
pub fn context_stack(&self) -> &dyn ContextStack
[src]
impl<'i, S> Display for Expected<'i, S> where
S: ContextStack,
[src]
S: ContextStack,
impl<'i, S> Error for Expected<'i, S> where
S: ContextStack,
[src]
S: ContextStack,
pub fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
pub fn backtrace(&self) -> Option<&Backtrace>
[src]
pub fn description(&self) -> &str
1.0.0[src]
pub fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
impl<'i, S> From<Expected<'i, S>> for Invalid where
S: ContextStack,
[src]
S: ContextStack,
impl<'i, S> From<ExpectedLength<'i>> for Expected<'i, S> where
S: ContextStackBuilder,
[src]
S: ContextStackBuilder,
pub fn from(err: ExpectedLength<'i>) -> Self
[src]
impl<'i, S> From<ExpectedValid<'i>> for Expected<'i, S> where
S: ContextStackBuilder,
[src]
S: ContextStackBuilder,
pub fn from(err: ExpectedValid<'i>) -> Self
[src]
impl<'i, S> From<ExpectedValue<'i>> for Expected<'i, S> where
S: ContextStackBuilder,
[src]
S: ContextStackBuilder,
pub fn from(err: ExpectedValue<'i>) -> Self
[src]
impl<'i, S> NoInteriorMut for Expected<'i, S> where
S: NoInteriorMut,
[src]
S: NoInteriorMut,
impl<'i, S> ToRetryRequirement for Expected<'i, S>
[src]
pub fn to_retry_requirement(&self) -> Option<RetryRequirement>
[src]
pub fn is_fatal(&self) -> bool
[src]
impl<'i, S> WithContext<'i> for Expected<'i, S> where
S: ContextStackBuilder,
[src]
S: ContextStackBuilder,
pub fn with_context<C>(mut self: Self, input: Input<'i>, context: C) -> Self where
C: Context,
[src]
C: Context,
Auto Trait Implementations
impl<'i, S> RefUnwindSafe for Expected<'i, S> where
S: RefUnwindSafe,
[src]
S: RefUnwindSafe,
impl<'i, S> Send for Expected<'i, S> where
S: Send,
[src]
S: Send,
impl<'i, S> Sync for Expected<'i, S> where
S: Sync,
[src]
S: Sync,
impl<'i, S> Unpin for Expected<'i, S> where
S: Unpin,
[src]
S: Unpin,
impl<'i, S> UnwindSafe for Expected<'i, S> where
S: UnwindSafe,
[src]
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Guarded for T where
T: NoInteriorMut,
[src]
T: NoInteriorMut,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,