1use std::time::Duration;
2
3#[derive(Debug, Clone)]
4pub struct DelayConfig {
5 pub delay_ms: u64,
6 pub dynamic_header: Option<String>,
7}
8
9impl DelayConfig {
10 pub fn new(delay_ms: u64) -> Self {
11 Self {
12 delay_ms,
13 dynamic_header: None,
14 }
15 }
16
17 pub fn with_dynamic_header(mut self, header: impl Into<String>) -> Self {
18 self.dynamic_header = Some(header.into());
19 self
20 }
21
22 pub fn from_duration(duration: Duration) -> Self {
23 Self {
24 delay_ms: duration.as_millis() as u64,
25 dynamic_header: None,
26 }
27 }
28
29 pub fn from_duration_with_header(duration: Duration, header: impl Into<String>) -> Self {
30 Self {
31 delay_ms: duration.as_millis() as u64,
32 dynamic_header: Some(header.into()),
33 }
34 }
35}