Skip to content

Commit

Permalink
impl Debug for MultiplexedConnection & Pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
elpiel committed Aug 20, 2022
1 parent 7b67951 commit f576da6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions redis/src/aio.rs
@@ -1,6 +1,8 @@
//! Adds experimental async IO support to redis.
use async_trait::async_trait;
use std::collections::VecDeque;
use std::fmt;
use std::fmt::Debug;
use std::io;
use std::mem;
use std::net::SocketAddr;
Expand Down Expand Up @@ -623,6 +625,17 @@ impl<SinkItem, I, E> Clone for Pipeline<SinkItem, I, E> {
}
}

impl<SinkItem, I, E> Debug for Pipeline<SinkItem, I, E>
where
SinkItem: Debug,
I: Debug,
E: Debug,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Pipeline").field(&self.0).finish()
}
}

pin_project! {
struct PipelineSink<T, I, E> {
#[pin]
Expand Down Expand Up @@ -847,6 +860,15 @@ pub struct MultiplexedConnection {
db: i64,
}

impl Debug for MultiplexedConnection {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("MultiplexedConnection")
.field("pipeline", &self.pipeline)
.field("db", &self.db)
.finish()
}
}

impl MultiplexedConnection {
/// Constructs a new `MultiplexedConnection` out of a `AsyncRead + AsyncWrite` object
/// and a `ConnectionInfo`
Expand Down

0 comments on commit f576da6

Please sign in to comment.