pub struct OracleSpsc<T> { /* private fields */ }Expand description
Oracle for crate::SpscRing: plain Vec bounded by capacity,
shift-on-pop FIFO.
Implementations§
Source§impl<T> OracleSpsc<T>
impl<T> OracleSpsc<T>
Sourcepub fn new(capacity: usize) -> Option<Self>
pub fn new(capacity: usize) -> Option<Self>
New empty oracle queue with capacity slots; None for capacity
0 (the real ring refuses CAP < 2 at compile time — power of two
and the CAP-1 sequence collision — so the oracle’s runtime bound
only needs to stay positive and generous).
Sourcepub fn push(&mut self, value: T) -> Result<(), T>
pub fn push(&mut self, value: T) -> Result<(), T>
Push one value; Err(value) when full — the push-back-on-full
contract the real ring’s try_push mirrors as Some(value).
§Errors
Returns Err(value) unchanged when the queue is full; the value is
not stored.
Trait Implementations§
Source§impl<T: Clone> Clone for OracleSpsc<T>
impl<T: Clone> Clone for OracleSpsc<T>
Auto Trait Implementations§
impl<T> Forget for OracleSpsc<T>
impl<T> Freeze for OracleSpsc<T>
impl<T> Move for OracleSpsc<T>
impl<T> RefUnwindSafe for OracleSpsc<T>where
T: RefUnwindSafe,
impl<T> Send for OracleSpsc<T>
impl<T> Sync for OracleSpsc<T>
impl<T> Unpin for OracleSpsc<T>
impl<T> UnsafeUnpin for OracleSpsc<T>
impl<T> UnwindSafe for OracleSpsc<T>where
RawVecInner: 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