diff --git a/atat/src/asynch/mod.rs b/atat/src/asynch/mod.rs index 8e3b6dc..6d3b046 100644 --- a/atat/src/asynch/mod.rs +++ b/atat/src/asynch/mod.rs @@ -35,3 +35,12 @@ pub trait AtatClient { Err(Error::Timeout) } } + +impl AtatClient for &mut T +where + T: AtatClient, +{ + async fn send(&mut self, cmd: &Cmd) -> Result { + T::send(self, cmd).await + } +} diff --git a/atat/src/config.rs b/atat/src/config.rs index 5dd08aa..eb83409 100644 --- a/atat/src/config.rs +++ b/atat/src/config.rs @@ -17,12 +17,7 @@ pub type GetTimeout = fn(Instant, Duration) -> Instant; impl Default for Config { fn default() -> Self { - Self { - cmd_cooldown: Duration::from_millis(20), - tx_timeout: Duration::from_millis(1000), - flush_timeout: Duration::from_millis(1000), - get_response_timeout, - } + Self::new() } } @@ -32,8 +27,13 @@ fn get_response_timeout(start: Instant, duration: Duration) -> Instant { impl Config { #[must_use] - pub fn new() -> Self { - Self::default() + pub const fn new() -> Self { + Self { + cmd_cooldown: Duration::from_millis(20), + tx_timeout: Duration::from_millis(1000), + flush_timeout: Duration::from_millis(1000), + get_response_timeout, + } } #[must_use]