pub struct Epoch { /* private fields */ }
Expand description
Epoch
represents the period of time the global epoch value stays the same.
Epoch
rotates u8
values in a range of [0..3]
while the crate itself functions
correctly if the range is limited to [0..2]
. The one additional state is useful for users to
determine whether a certain memory chunk can be deallocated or not by using values returned
from Guard::epoch
, e.g., if an Owned
was retired in
epoch 1
, then the Owned
will become completely unreachable in epoch 0
.
Implementations§
source§impl Epoch
impl Epoch
sourcepub const fn next_generation(self) -> Epoch
pub const fn next_generation(self) -> Epoch
Returns a future Epoch
when the current readers will not be present.
The current Epoch
may lag behind the global epoch value by 1
, therefore this method
returns an Epoch
three epochs next to self
.
use sdd::Epoch;
let initial = Epoch::default();
let next_generation = initial.next_generation();
assert_eq!(next_generation, initial.next().next().next());
Trait Implementations§
source§impl Ord for Epoch
impl Ord for Epoch
source§impl PartialEq for Epoch
impl PartialEq for Epoch
source§impl PartialOrd for Epoch
impl PartialOrd for Epoch
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Epoch
impl Eq for Epoch
impl StructuralPartialEq for Epoch
Auto Trait Implementations§
impl Freeze for Epoch
impl RefUnwindSafe for Epoch
impl Send for Epoch
impl Sync for Epoch
impl Unpin for Epoch
impl UnwindSafe for Epoch
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)