Epoch

Struct Epoch 

Source
pub struct Epoch { /* private fields */ }
Expand description

Epoch implements epoch based deferred execution

Implementations§

Source§

impl Epoch

Source

pub fn defer<F: FnOnce() + Send + Unpin + 'static>( &self, callback: F, ) -> CallbackRef<'_>

Schedule callback to be executed when all prior references have been returned. If callback is no bigger than usize, typically no heap allocation will be incurred. If there are no outstanding guards, callback will be called immediately.

Source

pub fn defer_waker(&self, waker: &Waker) -> CallbackRef<'_>

Same as defer but for a waker.

Source

pub fn guard(&self) -> EpochGuard<'_>

Takes a guard on the current epoch. Subsequent callbacks queued via defer are guaranteed not to be called before this guard is dropped.

Source

pub fn global() -> &'static Epoch

Returns a reference to the global Epoch instance.

Source

pub fn barrier(&self) -> impl Future<Output = ()> + '_

Waits for all previous guards to be released. The barrier is initialised when the future is created, not when it is first polled.

Trait Implementations§

Source§

impl Default for Epoch

Source§

fn default() -> Epoch

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.