pub trait FdTimerCom: FdTimerRead {
// Required methods
fn new(
label: Cow<'static, str>,
timer_type: TimerType,
timer_flags: TimerFlags,
) -> TimerPortResult<Self>
where Self: Sized;
fn set_time<TIMERTYPE: ModeTimeType>(
&self,
timer_exp: TimerExpMode<TIMERTYPE>,
) -> TimerPortResult<()>;
fn unset_time(&self) -> TimerPortResult<()>;
fn set_nonblocking(&self, flag: bool) -> TimerPortResult<()>;
fn is_nonblocking(&self) -> TimerPortResult<bool>;
}Expand description
A common trait which is implemented by all timer realizationss for different OSes.
Required Methods§
Sourcefn new(
label: Cow<'static, str>,
timer_type: TimerType,
timer_flags: TimerFlags,
) -> TimerPortResult<Self>where
Self: Sized,
fn new(
label: Cow<'static, str>,
timer_type: TimerType,
timer_flags: TimerFlags,
) -> TimerPortResult<Self>where
Self: Sized,
Sourcefn set_time<TIMERTYPE: ModeTimeType>(
&self,
timer_exp: TimerExpMode<TIMERTYPE>,
) -> TimerPortResult<()>
fn set_time<TIMERTYPE: ModeTimeType>( &self, timer_exp: TimerExpMode<TIMERTYPE>, ) -> TimerPortResult<()>
Sets the timer. The timer starts immidiatly and working depending on the timer_exp mode.
In case of timer does not support TimerExpMode::IntervalDelayed nativly (on OS level), the
crate will store the interval part and set interval on first read() i.e after the delay
and remove the stored interval (or may not) from the inner field.
Sourcefn unset_time(&self) -> TimerPortResult<()>
fn unset_time(&self) -> TimerPortResult<()>
Unsets the timer. The timer stops immidiatly.
Sourcefn set_nonblocking(&self, flag: bool) -> TimerPortResult<()>
fn set_nonblocking(&self, flag: bool) -> TimerPortResult<()>
Sets the timer to non-blocking (on case if flag is true).
If the timer was inited with
TimerFlags::TFD_NONBLOCK, then this will not do anything.
Sourcefn is_nonblocking(&self) -> TimerPortResult<bool>
fn is_nonblocking(&self) -> TimerPortResult<bool>
Reads the FD’s flags and check if Fd is in non-blocking mode. May return error.
§Returns
-
true- FD is non-blocking -
false- FD is blocking
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.