Skip to content

Commit 6f5a048

Browse files
committed
Impl Debug
1 parent eb06ffb commit 6f5a048

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/lib.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@
3636

3737
extern crate postgres;
3838

39-
use std::old_io::{self, IoResult, IoError, IoErrorKind, SeekStyle};
40-
use std::i32;
41-
use std::slice::bytes;
4239
use std::cmp;
40+
use std::fmt;
41+
use std::i32;
4342
use std::num::FromPrimitive;
43+
use std::old_io::{self, IoResult, IoError, IoErrorKind, SeekStyle};
44+
use std::slice::bytes;
4445

4546
use postgres::{Oid, Error, Result, Transaction, GenericConnection};
4647

@@ -69,6 +70,7 @@ impl<T: GenericConnection> LargeObjectExt for T {
6970
///
7071
/// Note that Postgres currently does not make any distinction between the
7172
/// `Write` and `ReadWrite` modes.
73+
#[derive(Debug)]
7274
pub enum Mode {
7375
/// An object opened in this mode may only be read from.
7476
Read,
@@ -134,6 +136,12 @@ pub struct LargeObject<'a> {
134136
finished: bool,
135137
}
136138

139+
impl<'a> fmt::Debug for LargeObject<'a> {
140+
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
141+
write!(fmt, "LargeObject {{ fd: {:?}, transaction: {:?} }}", self.fd, self.trans)
142+
}
143+
}
144+
137145
#[unsafe_destructor]
138146
impl<'a> Drop for LargeObject<'a> {
139147
fn drop(&mut self) {

0 commit comments

Comments
 (0)