Struct base::timer::Timer

source ·
pub struct Timer {
    pub(crate) handle: SafeDescriptor,
    pub(crate) interval: Option<Duration>,
}

Fields§

§handle: SafeDescriptor§interval: Option<Duration>

Implementations§

source§

impl Timer

source

pub fn try_clone(&self) -> Result<Timer, Error>

Creates a new Timer instance that shares the same underlying SafeDescriptor as the existing Timer instance.

source§

impl Timer

source

pub fn new() -> Result<Timer>

Creates a new timerfd. The timer is initally disarmed and must be armed by calling reset.

source

fn set_time( &mut self, dur: Option<Duration>, interval: Option<Duration> ) -> Result<()>

Trait Implementations§

source§

impl AsRawDescriptor for Timer

source§

fn as_raw_descriptor(&self) -> RawDescriptor

Returns the underlying raw descriptor. Read more
source§

impl AsRawFd for Timer

source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
source§

impl FromRawDescriptor for Timer

source§

unsafe fn from_raw_descriptor(handle: RawDescriptor) -> Self

Safety Read more
source§

impl IntoRawDescriptor for Timer

source§

impl TimerTrait for Timer

source§

fn reset_oneshot(&mut self, dur: Duration) -> Result<()>

Sets the timer to expire after dur without repeating. Cancels any existing timer.
source§

fn reset_repeating(&mut self, dur: Duration) -> Result<()>

Sets the timer to fire repeatedly at dur intervals. Cancels any existing timer.
source§

fn clear(&mut self) -> Result<()>

Disarms the timer.
source§

fn wait(&mut self) -> Result<()>

Waits until the timer expires.
source§

fn mark_waited(&mut self) -> Result<bool>

After a timer is triggered from an EventContext, mark the timer as having been waited for. If a timer is not marked waited, it will immediately trigger the event context again. This does not need to be called after calling Timer::wait. Read more
source§

fn resolution(&self) -> Result<Duration>

Returns the resolution of timers on the host.

Auto Trait Implementations§

§

impl RefUnwindSafe for Timer

§

impl Send for Timer

§

impl Sync for Timer

§

impl Unpin for Timer

§

impl UnwindSafe for Timer

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> AsRawDescriptors for T
where T: AsRawDescriptor,

source§

fn as_raw_descriptors(&self) -> Vec<i32>

Returns the underlying raw descriptors. 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.