Skip to content

Commit e9efb5f

Browse files
authored
Implement Debug for ConnectionBuilder (#448)
1 parent 94a4f07 commit e9efb5f

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

src/connection_builder.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::{
66
use async_rs::{Runtime, traits::*};
77
use std::io;
88

9+
#[derive(Debug)]
910
pub struct ConnectionBuilder<RK: RuntimeKit + Send + Sync + Clone + 'static> {
1011
runtime: Runtime<RK>,
1112
uri: UriBuilder,
@@ -14,7 +15,7 @@ pub struct ConnectionBuilder<RK: RuntimeKit + Send + Sync + Clone + 'static> {
1415
}
1516
pub type DefaultConnectionBuilder = ConnectionBuilder<runtime::DefaultRuntimeKit>;
1617

17-
#[derive(Clone, Default)]
18+
#[derive(Debug, Clone, Default)]
1819
enum UriBuilder {
1920
Str(String),
2021
Uri(AMQPUri),

src/connection_properties.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use crate::{
33
types::{AMQPValue, FieldTable, LongString, ShortString},
44
};
55
use backon::ExponentialBuilder;
6+
use std::fmt;
67
use std::sync::Arc;
78

89
#[derive(Clone)]
@@ -69,3 +70,14 @@ impl ConnectionProperties {
6970
self
7071
}
7172
}
73+
74+
impl fmt::Debug for ConnectionProperties {
75+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
76+
f.debug_struct("ConnectionProperties")
77+
.field("locale", &self.locale)
78+
.field("client_properties", &self.client_properties)
79+
.field("backoff", &self.backoff)
80+
.field("auto_recover", &self.auto_recover)
81+
.finish()
82+
}
83+
}

0 commit comments

Comments
 (0)