libmactime2/
filter.rs

1use std::sync::mpsc::{Sender, Receiver};
2
3use chrono_tz::Tz;
4
5#[derive(Copy, Clone)]
6pub struct RunOptions {
7    pub strict_mode: bool,
8    pub src_zone: Tz
9}
10
11pub trait Provider<To, R>: Joinable<R> {
12    fn get_receiver(&mut self) -> Receiver<To>;
13}
14
15pub trait Consumer<From> {
16    fn with_receiver(previous: Receiver<From>, options: RunOptions) -> Self;
17}
18
19pub trait Filter<From, To, R> : Consumer<From> + Provider<To, R> {
20    fn worker(reader: Receiver<From>, tx: Sender<To>, options: RunOptions);
21}
22
23pub trait Joinable<R> {
24    fn join(&mut self) -> std::thread::Result<R>;
25}
26
27pub trait Runnable {
28    fn run(&mut self);
29}
30
31pub trait Sorter<T>: Runnable + Joinable<T> {}