pub struct HandoffError<H> { /* private fields */ }Expand description
A consuming conversion that did not take effect, returned with the handle it was given.
Modelled on std::io::IntoInnerError: an operation that takes ownership
has nowhere to put the value back on failure, so it hands it to the caller
along with the reason. Receiving one means nothing was surrendered — the
handle is exactly as usable as it was before the call — so a caller that
only wants the error can discard it, and one that wants to retry can keep
it.
It deliberately does not implement Debug in terms of the handle, so that
unwrap() works on handles that are not themselves Debug.
Implementations§
Source§impl<H> HandoffError<H>
impl<H> HandoffError<H>
Sourcepub fn new(handle: H, error: impl Into<Error>) -> Self
pub fn new(handle: H, error: impl Into<Error>) -> Self
Pairs a handle with the reason its conversion did not happen.
Sourcepub fn into_handle(self) -> H
pub fn into_handle(self) -> H
Recovers the handle, discarding the reason.
Sourcepub fn into_error(self) -> Error
pub fn into_error(self) -> Error
Discards the handle, keeping the reason.
Sourcepub fn into_parts(self) -> (H, Error)
pub fn into_parts(self) -> (H, Error)
Splits into the recovered handle and the reason.
Trait Implementations§
Source§impl<H> Debug for HandoffError<H>
impl<H> Debug for HandoffError<H>
Source§impl<H> Display for HandoffError<H>
impl<H> Display for HandoffError<H>
Source§impl<H> Error for HandoffError<H>
impl<H> Error for HandoffError<H>
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<H> From<HandoffError<H>> for Error
impl<H> From<HandoffError<H>> for Error
Source§fn from(error: HandoffError<H>) -> Self
fn from(error: HandoffError<H>) -> Self
Auto Trait Implementations§
impl<H> Freeze for HandoffError<H>where
H: Freeze,
impl<H> RefUnwindSafe for HandoffError<H>where
H: RefUnwindSafe,
impl<H> Send for HandoffError<H>where
H: Send,
impl<H> Sync for HandoffError<H>where
H: Sync,
impl<H> Unpin for HandoffError<H>where
H: Unpin,
impl<H> UnsafeUnpin for HandoffError<H>where
H: UnsafeUnpin,
impl<H> UnwindSafe for HandoffError<H>where
H: 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
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