Skip to content

Commit 6fd69df

Browse files
committed
Make requested changes
1 parent 369427b commit 6fd69df

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

tokio-postgres/src/row.rs

-49
Original file line numberDiff line numberDiff line change
@@ -100,59 +100,10 @@ pub struct Row {
100100
ranges: Vec<Option<Range<usize>>>,
101101
}
102102

103-
/// A macro to map pg types to rust types, for debug display.
104-
macro_rules! debug_row_type {
105-
($this:expr; $map:expr; $idx:expr; $name:expr; $type:expr; $($pg_ty:tt => $ty:ty),*) => {
106-
match $type {
107-
$(
108-
&Type::$pg_ty => match <$ty as FromSql>::from_sql_nullable(
109-
&Type::$pg_ty,
110-
$this.0.col_buffer($idx),
111-
) {
112-
Ok(val) => $map.entry(&$name, &val),
113-
Err(_) => $map.entry(&$name, &"<error>"),
114-
},
115-
)*
116-
_ => $map.entry(&$name, &"<opaque type>"),
117-
}
118-
}
119-
}
120-
121103
impl fmt::Debug for Row {
122104
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
123-
// Provides debug impl for row contents.
124-
struct RowData<'a>(&'a Row);
125-
126-
impl fmt::Debug for RowData<'_> {
127-
#[allow(clippy::match_ref_pats)]
128-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
129-
let mut map = f.debug_map();
130-
for (idx, col) in self.0.columns().iter().enumerate() {
131-
debug_row_type!(self; map; idx; col.name(); col.type_();
132-
BOOL => bool,
133-
INT2 => i16,
134-
INT4 => i32,
135-
INT8 => i64,
136-
FLOAT4 => f32,
137-
FLOAT8 => f64,
138-
VARCHAR => String,
139-
BPCHAR => String,
140-
TEXT => String,
141-
JSON => String,
142-
XML => String,
143-
TIMESTAMPTZ => std::time::SystemTime,
144-
TIMESTAMP => std::time::SystemTime,
145-
BYTEA => Vec<u8>
146-
// More types could be added here.
147-
);
148-
}
149-
map.finish()
150-
}
151-
}
152-
153105
f.debug_struct("Row")
154106
.field("columns", &self.columns())
155-
.field("data", &RowData(self))
156107
.finish()
157108
}
158109
}

0 commit comments

Comments
 (0)