scheduled_channel

Crates.ioscheduled_channel
lib.rsscheduled_channel
version0.1.1
created_at2025-11-03 19:15:05.454558+00
updated_at2025-11-04 10:50:12.691085+00
descriptionA mpmc channel that allows specifying a timestamp for when a message is received
homepage
repositoryhttps://github.com/Funestia/scheduled_channel
max_upload_size
id1915131
size67,035
Florian (Funestia)

documentation

README

A scheduled channel.

A scheduled channel works like a normal mpmc channel but it has the option to supply messages with a timestamp they should be read at.

Example

use scheduled_channel::bounded;
use std::time::{Instant, Duration};

let (sender, receiver) = bounded(1000);

sender.send(0, None).unwrap();
sender.send(5, Some(Instant::now() + Duration::from_secs(5))).unwrap();
sender.send(4, Some(Instant::now() + Duration::from_secs(4))).unwrap();
sender.send(6, Some(Instant::now() + Duration::from_secs(6))).unwrap();
sender.send(3, Some(Instant::now() + Duration::from_secs(3))).unwrap();
sender.send(2, Some(Instant::now() + Duration::from_secs(2))).unwrap();
sender.send(1, None).unwrap();

for i in 0..=6 {
    assert_eq!(receiver.recv().unwrap(), i);
}
Commit count: 0

cargo fmt