pub trait Stack<T>: Default {
type PushReq: From<T> + Deref<Target = ManuallyDrop<T>>;
// Required methods
fn try_push(
&self,
req: Owned<Self::PushReq>,
guard: &Guard,
) -> Result<(), Owned<Self::PushReq>>;
fn try_pop(&self, guard: &Guard) -> Result<Option<T>, ()>;
fn is_empty(&self, guard: &Guard) -> bool;
// Provided methods
fn push(&self, t: T) { ... }
fn pop(&self) -> Option<T> { ... }
}
Expand description
Concurrent stack types.
Required Associated Types§
Sourcetype PushReq: From<T> + Deref<Target = ManuallyDrop<T>>
type PushReq: From<T> + Deref<Target = ManuallyDrop<T>>
Push request type.
Required Methods§
Sourcefn try_push(
&self,
req: Owned<Self::PushReq>,
guard: &Guard,
) -> Result<(), Owned<Self::PushReq>>
fn try_push( &self, req: Owned<Self::PushReq>, guard: &Guard, ) -> Result<(), Owned<Self::PushReq>>
Tries to push a value to the stack.
Returns Ok(())
if the push request is served; Err(req)
is CAS failed.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.