Enum Steal
enum Steal<T>
Possible outcomes of a steal operation.
Examples
There are lots of ways to chain results of steal operations together:
use ;
let collect = ;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Variants
-
Empty The queue was empty at the time of stealing.
-
Success(T) At least one task was successfully stolen.
-
Retry The steal operation needs to be retried.
Implementations
impl<T> Steal<T>
fn is_empty(self: &Self) -> boolReturns
trueif the queue was empty at the time of stealing.Examples
use ; assert!; assert!; assert!;fn is_success(self: &Self) -> boolReturns
trueif at least one task was stolen.Examples
use ; assert!; assert!; assert!;fn is_retry(self: &Self) -> boolReturns
trueif the steal operation needs to be retried.Examples
use ; assert!; assert!; assert!;fn success(self: Self) -> Option<T>Returns the result of the operation, if successful.
Examples
use ; assert_eq!; assert_eq!; assert_eq!;fn or_else<F>(self: Self, f: F) -> Steal<T> where F: FnOnce() -> Steal<T>If no task was stolen, attempts another steal operation.
Returns this steal result if it is
Success. Otherwise, closurefis invoked and then:- If the second steal resulted in
Success, it is returned. - If both steals were unsuccessful but any resulted in
Retry, thenRetryis returned. - If both resulted in
None, thenNoneis returned.
Examples
use ; assert_eq!; assert_eq!; assert_eq!; assert_eq!; assert_eq!;- If the second steal resulted in
impl<T> Any for Steal<T>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Steal<T>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Steal<T>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Steal<T>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> Debug for Steal<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> Freeze for Steal<T>
impl<T> From for Steal<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> FromIterator for Steal<T>
fn from_iter<I>(iter: I) -> Steal<T> where I: IntoIterator<Item = Steal<T>>Consumes items until a
Successis found and returns it.If no
Successwas found, but there was at least oneRetry, then returnsRetry. Otherwise,Emptyis returned.
impl<T> Pointable for Steal<T>
unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> RefUnwindSafe for Steal<T>
impl<T> Send for Steal<T>
impl<T> StructuralPartialEq for Steal<T>
impl<T> Sync for Steal<T>
impl<T> ToOwned for Steal<T>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> Unpin for Steal<T>
impl<T> UnsafeUnpin for Steal<T>
impl<T> UnwindSafe for Steal<T>
impl<T, U> Into for Steal<T>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Steal<T>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Steal<T>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T: $crate::clone::Clone> Clone for Steal<T>
fn clone(self: &Self) -> Steal<T>
impl<T: $crate::cmp::Eq> Eq for Steal<T>
impl<T: $crate::cmp::PartialEq> PartialEq for Steal<T>
fn eq(self: &Self, other: &Steal<T>) -> bool