1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
use std::time::Duration; use getset::{CopyGetters, Getters}; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Getters, CopyGetters, Debug, Clone, PartialEq, Eq, Hash)] #[serde(default)] pub struct SessionConfig { #[serde(with = "humantime_serde")] #[get_copy = "pub"] timeout: Duration, #[get_copy = "pub"] retry_limit: usize, #[serde(with = "humantime_serde")] #[get_copy = "pub"] retry_interval: Duration, } impl Default for SessionConfig { fn default() -> Self { Self { timeout: Duration::from_secs(30), retry_limit: 4, retry_interval: Duration::from_secs(2), } } }