| Crates.io | scheduled_channel |
| lib.rs | scheduled_channel |
| version | 0.1.1 |
| created_at | 2025-11-03 19:15:05.454558+00 |
| updated_at | 2025-11-04 10:50:12.691085+00 |
| description | A mpmc channel that allows specifying a timestamp for when a message is received |
| homepage | |
| repository | https://github.com/Funestia/scheduled_channel |
| max_upload_size | |
| id | 1915131 |
| size | 67,035 |
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.
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);
}