use async_std::sync::{Arc, Barrier};
use std::time::Duration;
#[derive(Clone, Debug)]
pub enum Interval {
Stepped,
Delay(f32),
Timed(Duration),
}
#[derive(Default)]
pub struct Target {
pub interval: Option<Interval>,
pub fence: Option<Box<dyn Fn(Arc<Barrier>) + Send + 'static>>,
}
impl Target {
pub fn set(&mut self, iv: Interval) -> &mut Self {
self.interval = Some(iv);
self
}
pub fn fence<F: 'static>(&mut self, f: F) -> &mut Self
where
F: Fn(Arc<Barrier>) + Send,
{
self.fence = Some(Box::new(f));
self
}
}