[−][src]Struct swym::tx::Error
Error type indicating that the transaction has failed.
It is typical to route this error back to ThreadKey::rw
or ThreadKey::read
where the
transaction will be retried, however, this is not required.
Notes
Any additional operations on any TCell
that has returned Error
will continue to return
errors for the remainder of the transaction.
Methods
impl Error
[src]
pub const RETRY: Self
[src]
Error value requesting a retry of the current transaction.
Notes
Returning RETRY
to ThreadKey::read
or ThreadKey::rw
will immediately restart the
transaction. This can cause the thread to spin, hurting the performance of other
threads. In the future, the behavior of RETRY
may change.
Examples
use swym::{tcell::TCell, thread_key, tx::Error}; let thread_key = thread_key::get(); let locked = TCell::new(false); thread_key.rw(|tx| { if locked.get(tx, Default::default())? { Err(Error::RETRY) } else { Ok(locked.set(tx, true)?) } })
Trait Implementations
impl Eq for Error
[src]
impl PartialEq<Error> for Error
[src]
impl<T> From<SetError<T>> for Error
[src]
impl Debug for Error
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,