pub struct TimerFd(/* private fields */);Expand description
A common abstract type for the timer which is a main instance.
§Implements
This instance implements:
-
[TimerFdMioCompat] and [mio::event::Source] - if the
feature = enable_mio_compatis enabled.
§Multithread
A MT-safe, read-only. MT-access is implemented on OS level, so no mutexes or other sync is implemented.
§Poll
-
A built-in crate::TimerPoll can be used.
-
An external crate MIO [TimerFdMioCompat] if
feature = enable_mio_compatis enabled. -
User implemented poll. The FD can be aquired via AsRawFd AsFd.
§Async
A Future is implemented.
§Examples
ⓘ
let timer =
TimerFd::new(Cow::Borrowed("test"), TimerType::CLOCK_REALTIME,
TimerFlags::empty()).unwrap();
timer Implementations§
Source§impl TimerFd
impl TimerFd
pub fn new( label: Cow<'static, str>, timer_type: TimerType, timer_flags: TimerFlags, ) -> TimerPortResult<Self>
Sourcepub fn get_timer(&self) -> &TimerFdInternal ⓘ
pub fn get_timer(&self) -> &TimerFdInternal ⓘ
Borrows non-muntable reference to the timer. A Deref is implemented for this purpose, but the function was left for compat.
Trait Implementations§
Source§impl AsFd for TimerFd
impl AsFd for TimerFd
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor. Read more
Source§impl FdTimerMarker for TimerFd
impl FdTimerMarker for TimerFd
fn clone_timer(&self) -> TimerFd ⓘ
fn get_strong_count(&self) -> usize
Source§impl FdTimerRead for TimerFd
impl FdTimerRead for TimerFd
Source§fn read(&self) -> TimerPortResult<TimerReadRes<u64>>
fn read(&self) -> TimerPortResult<TimerReadRes<u64>>
Attempts to read the timer. The realization is different on different OS. The main purpose
is to check if timer is ready (ended). Read more
Source§impl Future for &TimerFd
impl Future for &TimerFd
Source§type Output = Result<TimerReadRes<u64>, TimerPortableErr>
type Output = Result<TimerReadRes<u64>, TimerPortableErr>
The type of value produced on completion.
Source§impl Future for TimerFd
impl Future for TimerFd
Source§type Output = Result<TimerReadRes<u64>, TimerPortableErr>
type Output = Result<TimerReadRes<u64>, TimerPortableErr>
The type of value produced on completion.
impl Eq for TimerFd
Auto Trait Implementations§
impl Freeze for TimerFd
impl RefUnwindSafe for TimerFd
impl Send for TimerFd
impl Sync for TimerFd
impl Unpin for TimerFd
impl UnwindSafe for TimerFd
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<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more