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 PartialOrd for Epoch
impl PartialOrd for Epoch
impl 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