Skip to main content

layer_client/
restart.rs

1use std::time::Duration;
2
3pub trait ConnectionRestartPolicy: Send + Sync + 'static {
4    fn restart_interval(&self) -> Option<Duration>;
5}
6
7pub struct NeverRestart;
8
9impl ConnectionRestartPolicy for NeverRestart {
10    fn restart_interval(&self) -> Option<Duration> {
11        None
12    }
13}
14
15pub struct FixedInterval {
16    pub interval: Duration,
17}
18
19impl ConnectionRestartPolicy for FixedInterval {
20    fn restart_interval(&self) -> Option<Duration> {
21        Some(self.interval)
22    }
23}