Skip to main content

skip_delay_channel

Function skip_delay_channel 

Source
pub fn skip_delay_channel<T: Ord>() -> (SkipDelaySender<T>, SkipDelayReceiver<T>)
Expand description

A MPSC queue of items with attached Instant that determines a deadline at which it should be yielded from the Stream side of the queue. The queue also has the cancellation ability: an item that has been pushed into the queue earlier can be canceled before it meets its deadline. A canceled item will then be skipped in the output stream.

The items are internally sorted based on their deadline. In a case when two items have equal deadlines, they are sorted according to their values; therefore, items must implement Ord.

If equal items are inserted, the deadline of the earlier one inserted is updated.