ordq

Crates.ioordq
lib.rsordq
version0.2.0
sourcesrc
created_at2024-04-29 14:48:47.30816
updated_at2024-04-30 05:27:26.935371
descriptionOrder keeping job processing queue
homepagehttps://github.com/drmingdrmer
repositoryhttps://github.com/drmingdrmer/ordq
max_upload_size
id1224227
size23,004
张炎泼 (drmingdrmer)

documentation

https://docs.rs/ord

README

ordq

Order keeping job processing queue

Example:

struct Add;

impl ordq::Work for Add {
    type I = (i32, i32);
    type O = i32;

    fn run(&mut self, x: Self::I) -> Self::O {
        x.0 + x.1
    }
}

# fn test_jobq() {
let (tx, rx) = ordq::new(1024, vec![Add, Add]);

tx.send((1, 2));
tx.send((3, 4));

tx.close();

assert_eq!(rx.recv(), Some(Ok(3)));
assert_eq!(rx.recv(), Some(Ok(7)));
assert_eq!(rx.recv(), None);
assert_eq!(rx.recv(), None);
# }
Commit count: 6

cargo fmt