diff --git a/src/proto/client/mod.rs b/src/proto/client/mod.rs index 771f3441..1acd06a0 100644 --- a/src/proto/client/mod.rs +++ b/src/proto/client/mod.rs @@ -185,7 +185,7 @@ pub(crate) enum HeartbeatStatus { impl Client { /// Create new [`Client`] and connect to a Faktory server with a non-standard stream. - /// + /// /// Iternally, the `stream` will be buffered. In case you've got a `stream` that is _already_ /// buffered (and so it is `AsyncBufRead`), you will want to use [`Client::connect_with_buffered`] /// in order to avoid buffering the stream twice. @@ -199,7 +199,7 @@ impl Client { } /// Create new [`Client`] and connect to a Faktory server with a non-standard buffered stream. - /// + /// /// In case you've got a `stream` that is _not_ buffered just yet, you may want to use [`Client::connect_with`] /// that will do this buffering for you. pub async fn connect_with_buffered(stream: S, pwd: Option) -> Result diff --git a/src/proto/mod.rs b/src/proto/mod.rs index f52207e3..a0304ccb 100644 --- a/src/proto/mod.rs +++ b/src/proto/mod.rs @@ -38,6 +38,16 @@ pub trait Reconnect { async fn reconnect(&mut self) -> io::Result; } +#[async_trait::async_trait] +impl Reconnect for Box +where + S: Reconnect + Send, +{ + async fn reconnect(&mut self) -> io::Result { + (**self).reconnect().await + } +} + #[async_trait::async_trait] impl Reconnect for TokioStream { async fn reconnect(&mut self) -> io::Result {