pub trait TimerDequeueSignal {
type TimerQueueID: Eq + PartialEq + Display + Debug;
type TimeoutErr: Display + Debug;
// Required method
fn get_id(&self) -> Self::TimerQueueID;
// Provided methods
fn sig_timeout(self) -> Result<(), Self::TimeoutErr>
where Self: Sized { ... }
async fn a_sig_timeout(self) -> Result<(), Self::TimeoutErr>
where Self: Sized { ... }
}Expand description
A trait which should be implemented on the struct which will be provided
to timer dequeue. The trait implements the uniqid and signalling. There
are two realizations: sig_timeout for sync and a_sig_timeout for
async. Both functions must use any methods to send signal but it must
never block the thread!
Required Associated Types§
Sourcetype TimerQueueID: Eq + PartialEq + Display + Debug
type TimerQueueID: Eq + PartialEq + Display + Debug
A uniq id type. It is used to identify the instance.
Sourcetype TimeoutErr: Display + Debug
type TimeoutErr: Display + Debug
Error type returned by the signal functions.
Required Methods§
Sourcefn get_id(&self) -> Self::TimerQueueID
fn get_id(&self) -> Self::TimerQueueID
This function should return the uniq id of the instance.
Provided Methods§
Sourcefn sig_timeout(self) -> Result<(), Self::TimeoutErr>where
Self: Sized,
fn sig_timeout(self) -> Result<(), Self::TimeoutErr>where
Self: Sized,
This function should notify i.e send signal or whatever. The important condition is not to block the thread.
Sourceasync fn a_sig_timeout(self) -> Result<(), Self::TimeoutErr>where
Self: Sized,
async fn a_sig_timeout(self) -> Result<(), Self::TimeoutErr>where
Self: Sized,
This function should notify i.e send signal or whatever. The important condition is not to block the thread.