pub enum BorrowSwapResult<'a, T: Sync + Send + 'static, E: Sync + Send + 'static> {
BorrowSwapped(BorrowGuard<'a, T>),
CellWasEmpty(E),
}Expand description
Result enum to indicate the outcomes of a borrow_swap operation.
Variants§
BorrowSwapped(BorrowGuard<'a, T>)
Borrow swap succeeded and the returned guard should be used.
CellWasEmpty(E)
Cell was empty when the borrow swap operation was performed
Implementations§
Source§impl<'a, T: Sync + Send + 'static, E: Sync + Send + 'static> BorrowSwapResult<'a, T, E>
impl<'a, T: Sync + Send + 'static, E: Sync + Send + 'static> BorrowSwapResult<'a, T, E>
Sourcepub fn unwrap(self) -> BorrowGuard<'a, T>
pub fn unwrap(self) -> BorrowGuard<'a, T>
pub const fn is_ok(&self) -> bool
pub const fn is_err(&self) -> bool
Sourcepub fn unwrap_err(self) -> E
pub fn unwrap_err(self) -> E
Sourcepub fn map_err<X: Sync + Send + 'static>(
self,
f: impl FnOnce(E) -> X,
) -> BorrowSwapResult<'a, T, X>
pub fn map_err<X: Sync + Send + 'static>( self, f: impl FnOnce(E) -> X, ) -> BorrowSwapResult<'a, T, X>
Maps the type in the CellWasEmpty case. Does nothing for BorrowSwapped.
Sourcepub fn into_result(self) -> Result<BorrowGuard<'a, T>, E>
pub fn into_result(self) -> Result<BorrowGuard<'a, T>, E>
Trait Implementations§
Source§impl<T: Sync + Send + Debug + 'static, E: Sync + Send + Debug + 'static> Debug for BorrowSwapResult<'_, T, E>
impl<T: Sync + Send + Debug + 'static, E: Sync + Send + Debug + 'static> Debug for BorrowSwapResult<'_, T, E>
Source§impl<'a, T: Sync + Send + 'static, E: Sync + Send + 'static> From<BorrowSwapResult<'a, T, E>> for Result<BorrowGuard<'a, T>, E>
impl<'a, T: Sync + Send + 'static, E: Sync + Send + 'static> From<BorrowSwapResult<'a, T, E>> for Result<BorrowGuard<'a, T>, E>
Source§fn from(value: BorrowSwapResult<'a, T, E>) -> Self
fn from(value: BorrowSwapResult<'a, T, E>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a, T, E> Freeze for BorrowSwapResult<'a, T, E>where
E: Freeze,
impl<'a, T, E> RefUnwindSafe for BorrowSwapResult<'a, T, E>where
E: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, E> Send for BorrowSwapResult<'a, T, E>
impl<'a, T, E> Sync for BorrowSwapResult<'a, T, E>
impl<'a, T, E> Unpin for BorrowSwapResult<'a, T, E>where
E: Unpin,
impl<'a, T, E> UnwindSafe for BorrowSwapResult<'a, T, E>where
E: UnwindSafe,
T: 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