Skip to content

Commit 6e68537

Browse files
committed
Use debug_builers for Debug impl
1 parent 065e96e commit 6e68537

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ keywords = ["database", "sql", "postgres"]
1111

1212
[dependencies]
1313
postgres = "0.8"
14+
debug-builders = "0.1"

src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333
#![doc(html_root_url="https://sfackler.github.io/rust-postgres-large-object/doc")]
3434

3535
extern crate postgres;
36+
extern crate debug_builders;
3637

38+
use debug_builders::DebugStruct;
39+
use postgres::{Oid, Error, Result, Transaction, GenericConnection};
3740
use std::cmp;
3841
use std::fmt;
3942
use std::i32;
4043
use std::io;
4144

42-
use postgres::{Oid, Error, Result, Transaction, GenericConnection};
43-
4445
/// An extension trait adding functionality to create and delete large objects.
4546
pub trait LargeObjectExt: GenericConnection {
4647
/// Creates a new large object, returning its `Oid`.
@@ -130,7 +131,10 @@ pub struct LargeObject<'a> {
130131

131132
impl<'a> fmt::Debug for LargeObject<'a> {
132133
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
133-
write!(fmt, "LargeObject {{ fd: {:?}, transaction: {:?} }}", self.fd, self.trans)
134+
DebugStruct::new(fmt, "LargeObject")
135+
.field("fd", &self.fd)
136+
.field("transaction", &self.trans)
137+
.finish()
134138
}
135139
}
136140

0 commit comments

Comments
 (0)