Struct tokio::runtime::time::handle::Handle

source ·
pub(crate) struct Handle {
    pub(super) time_source: TimeSource,
    pub(super) inner: Inner,
}
Expand description

Handle to time driver instance.

Fields§

§time_source: TimeSource§inner: Inner

Implementations§

source§

impl Handle

source

pub(crate) fn time_source(&self) -> &TimeSource

Returns the time source associated with this handle.

source

pub(super) fn is_shutdown(&self) -> bool

Checks whether the driver has been shutdown.

source

pub(crate) fn unpark(&self)

Track that the driver is being unparked

source§

impl Handle

source

fn process(&self, clock: &Clock)

Runs timer related logic, and returns the next wakeup time

source

fn process_at_time(&self, start: u32, now: u64)

source

fn process_at_sharded_time(&self, id: u32, now: u64) -> Option<u64>

source

unsafe fn clear_entry(&self, entry: NonNull<TimerShared>)

Removes a registered timer from the driver.

The timer will be moved to the cancelled state. Wakers will not be invoked. If the timer is already completed, this function is a no-op.

This function always acquires the driver lock, even if the entry does not appear to be registered.

SAFETY: The timer must not be registered with some other driver, and add_entry must not be called concurrently.

source

unsafe fn reregister( &self, unpark: &IoHandle, new_tick: u64, entry: NonNull<TimerShared>, )

Removes and re-adds an entry to the driver.

SAFETY: The timer must be either unregistered, or registered with this driver. No other threads are allowed to concurrently manipulate the timer at all (the current thread should hold an exclusive reference to the TimerEntry)

Trait Implementations§

source§

impl Debug for Handle

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Handle

§

impl RefUnwindSafe for Handle

§

impl Send for Handle

§

impl Sync for Handle

§

impl Unpin for Handle

§

impl UnwindSafe for Handle

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.

source§

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

§

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>,

§

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.