OrderedTimerDequeHandle

Trait OrderedTimerDequeHandle 

Source
pub trait OrderedTimerDequeHandle<MODE: OrderedTimerDequeMode>:
    Ord
    + PartialOrd
    + PartialEq
    + PartialEq<Self::TimerId>
    + Eq
    + Debug
    + Display
    + OrderedTimerDequeInterf<MODE> {
    type TimerId: PartialEq + Eq + Display + Debug;
    type HandleRes: TimerTimeoutCollection<Self::TimerId>;

    // Required methods
    fn postpone(&mut self, postp_time: RelativeTime) -> TimerResult<()>;
    fn resched(&mut self, time: MODE) -> TimerResult<()>;
    fn handle(
        self,
        timer_self: &mut OrderTimerDeque<MODE, Self>,
        timer_ids: &mut Self::HandleRes,
    ) -> TimerResult<()>
       where Self: Sized;
    fn is_same(&self, other: &Self::TimerId) -> bool;
    fn into_timer_id(self) -> Option<Self::TimerId>;
}
Expand description

A standart interface for each deque type. Every deque type must implement this trait.

Required Associated Types§

Source

type TimerId: PartialEq + Eq + Display + Debug

A timer ID. Normally this is a uniq identificator of the item in the queue. i.e TimerDequeId.

Source

type HandleRes: TimerTimeoutCollection<Self::TimerId>

A collection which is used to collect the items which are removed from the queue due to timeout.

Required Methods§

Source

fn postpone(&mut self, postp_time: RelativeTime) -> TimerResult<()>

Postpones the timeout of the current instance. The postp_time is a RelativeTime i.e inroduces the offset.

Source

fn resched(&mut self, time: MODE) -> TimerResult<()>

Reschedules the current instance. This is different from the postpone as the instance is assagned with a new time. The MODE cannot be changed, only time.

Source

fn handle( self, timer_self: &mut OrderTimerDeque<MODE, Self>, timer_ids: &mut Self::HandleRes, ) -> TimerResult<()>
where Self: Sized,

A spefic code which is called during timeout routine handling. Normally is should store the result into the collection and reschedule the item if it is repeated.

Source

fn is_same(&self, other: &Self::TimerId) -> bool

Matches the current instance with provided other instances OrderedTimerDequeHandle::TimerId. But, the PartialEq<Self::TimerId> is implemented, so the == can be used to compare.

Source

fn into_timer_id(self) -> Option<Self::TimerId>

Attempts to acquire the OrderedTimerDequeHandle::TimerId by consuming the instance.

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§