pub enum OrUserError<T, U> {
Base(T),
User(U),
}Expand description
A value that may be an error or a user-generated error.
Variants§
Implementations§
Source§impl<T, U> OrUserError<T, U>
impl<T, U> OrUserError<T, U>
Sourcepub fn convert_with<E, F>(self, f: F) -> E
pub fn convert_with<E, F>(self, f: F) -> E
Converts this error into another error.
The new error type E must implement From<T>.
Additionally takes a closure allowing the user to decide how to convert the user error.
Source§impl<T> OrUserError<T, Infallible>
impl<T> OrUserError<T, Infallible>
Sourcepub fn into_base(self) -> T
pub fn into_base(self) -> T
Converts this error to T (the base error variant), given that U (the user error variant) is Infallible.
Source§impl<U> OrUserError<Infallible, U>
impl<U> OrUserError<Infallible, U>
Sourcepub fn into_user(self) -> U
pub fn into_user(self) -> U
Converts this error to U (the user error variant), given that T (the base error variant) is Infallible.
Trait Implementations§
Source§impl<T, U> Display for OrUserError<T, U>
impl<T, U> Display for OrUserError<T, U>
Source§impl<T, U> Error for OrUserError<T, U>
impl<T, U> Error for OrUserError<T, U>
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()
Auto Trait Implementations§
impl<T, U> Freeze for OrUserError<T, U>
impl<T, U> RefUnwindSafe for OrUserError<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for OrUserError<T, U>
impl<T, U> Sync for OrUserError<T, U>
impl<T, U> Unpin for OrUserError<T, U>
impl<T, U> UnsafeUnpin for OrUserError<T, U>where
T: UnsafeUnpin,
U: UnsafeUnpin,
impl<T, U> UnwindSafe for OrUserError<T, U>where
T: UnwindSafe,
U: 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