FdTimerCom

Trait FdTimerCom 

Source
pub trait FdTimerCom {
    // Required methods
    fn new(
        label: Cow<'static, str>,
        timer_type: TimerType,
        timer_flags: TimerFlags,
    ) -> TimerPortResult<Self>
       where Self: Sized;
    fn read(&self) -> TimerPortResult<TimerReadRes<u64>>;
    fn set_time<TIMERTYPE: ModeTimeType>(
        &self,
        timer_exp: TimerExpMode<TIMERTYPE>,
    ) -> TimerPortResult<()>;
    fn unset_time(&self) -> TimerPortResult<()>;
}
Expand description

A common trait which is implemented by all timer realizationss for different OSes.

Required Methods§

Source

fn new( label: Cow<'static, str>, timer_type: TimerType, timer_flags: TimerFlags, ) -> TimerPortResult<Self>
where Self: Sized,

Creates new isntance of the timer.

§Arguments
  • label - a Cow string which defines a title of the timer for identification.

  • timer_type - a TimerType a clock source

  • timer_flags - a TimerFlags configuration of the timer’s FD.

§Returns

A Result is retuned with instance on success.

Source

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).

Source

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.

Source

fn unset_time(&self) -> TimerPortResult<()>

Unsets the timer. The timer stops immidiatly.

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.

Implementors§