pub struct LazyError(/* private fields */);Expand description
Error type for Lazy evaluation failures.
This error is returned when a thunk panics during evaluation.
Implementations§
Source§impl LazyError
impl LazyError
Sourcepub fn from_panic(payload: Box<dyn Any + Send + 'static>) -> Self
pub fn from_panic(payload: Box<dyn Any + Send + 'static>) -> Self
Creates a LazyError from a panic payload.
§Type Signature
Box (dyn Any + Send) -> LazyError
§Parameters
payload: The panic payload.
§Returns
A new LazyError.
§Examples
use fp_library::types::*;
let payload = Box::new("oops");
let error = LazyError::from_panic(payload);
assert_eq!(error.to_string(), "thunk panicked during evaluation: oops");Sourcepub fn panic_message(&self) -> Option<&str>
pub fn panic_message(&self) -> Option<&str>
Returns the panic message, if available.
§Type Signature
LazyError -> Option &str
§Returns
The panic message as a string slice, or None if no message was captured.
§Examples
use fp_library::types::*;
let payload = Box::new("oops");
let error = LazyError::from_panic(payload);
assert_eq!(error.panic_message(), Some("oops"));Trait Implementations§
Source§impl Error for LazyError
impl Error for LazyError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns 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 Ord for LazyError
impl Ord for LazyError
Source§impl PartialOrd for LazyError
impl PartialOrd for LazyError
impl Eq for LazyError
impl StructuralPartialEq for LazyError
Auto Trait Implementations§
impl Freeze for LazyError
impl RefUnwindSafe for LazyError
impl Send for LazyError
impl Sync for LazyError
impl Unpin for LazyError
impl UnwindSafe for LazyError
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<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 more