TimerDequeConsumer

Struct TimerDequeConsumer 

Source
pub struct TimerDequeConsumer<R, MODE>{ /* private fields */ }
Expand description

This type of the queue consumes the instance for which the timer is set. The item must be Send and Clone, std::sync::Arc. This is convinient when it is required to store the instance in the timer and retrive it when the timeout happens. This method allows to avoid for lookups in the lists and working directly with the stored items.

§Generics

R - an instance which should be stored on the timer dequeue. The instance must implement PartialEq, Eq, fmt::Debug, fmt::Display, Send.

MODE - a OrderedTimerDequeMode which defines the deque behaviour. There are two types of the operation:

  • [OrderdTimerDequeOnce] - after timeout the element is removed from the queue.

  • [OrderdTimerDequePeriodic] - after timeout the element timeout is extended until the item is not removed from the queue manually.

§Example

let mut time_list = 
    OrderedTimerDeque
        ::<DequeOnce, TimerDequeConsumer<u64, _>>
        ::new("test_label1".into(), 4, false, true)
           .unwrap();

or

let mut time_list = 
    OrderedTimerDeque
        ::<DequePeriodic, TimerDequeConsumer<u64, _>>
        ::new("test_label1".into(), 4, false, true)
           .unwrap();

Trait Implementations§

Source§

impl<R, MODE> Debug for TimerDequeConsumer<R, MODE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<R, MODE> Display for TimerDequeConsumer<R, MODE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<R, MODE> Ord for TimerDequeConsumer<R, MODE>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<MODE, R> OrderedTimerDequeHandle<MODE> for TimerDequeConsumer<R, MODE>

Source§

type TimerId = R

Input item.

Source§

type HandleRes = Vec<<TimerDequeConsumer<R, MODE> as OrderedTimerDequeHandle<MODE>>::TimerId>

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

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

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 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 into_timer_id(self) -> Option<Self::TimerId>

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

impl<MODE, R> OrderedTimerDequeInterf<MODE> for TimerDequeConsumer<R, MODE>

Source§

fn get_timeout_absolute(&self) -> AbsoluteTime

Returns the absolute time and the timer mode.
Source§

impl<R, MODE> PartialEq<R> for TimerDequeConsumer<R, MODE>

Source§

fn eq(&self, other: &R) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<R, MODE> PartialEq for TimerDequeConsumer<R, MODE>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<R, MODE> PartialOrd for TimerDequeConsumer<R, MODE>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<R, MODE> Eq for TimerDequeConsumer<R, MODE>

Auto Trait Implementations§

§

impl<R, MODE> Freeze for TimerDequeConsumer<R, MODE>
where R: Freeze, MODE: Freeze,

§

impl<R, MODE> RefUnwindSafe for TimerDequeConsumer<R, MODE>
where R: RefUnwindSafe, MODE: RefUnwindSafe,

§

impl<R, MODE> Send for TimerDequeConsumer<R, MODE>
where MODE: Send,

§

impl<R, MODE> Sync for TimerDequeConsumer<R, MODE>
where R: Sync, MODE: Sync,

§

impl<R, MODE> Unpin for TimerDequeConsumer<R, MODE>
where R: Unpin, MODE: Unpin,

§

impl<R, MODE> UnwindSafe for TimerDequeConsumer<R, MODE>
where R: UnwindSafe, MODE: UnwindSafe,

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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V