Skip to content

Commit a2c2e19

Browse files
committed
add Debug trait for Lsn
1 parent bfff8bf commit a2c2e19

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tokio-postgres/src/types.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
#[doc(inline)]
66
pub use postgres_types::*;
77

8+
use std::fmt;
9+
810
/// Log Sequence Number for PostgreSQL Write-Ahead Log (transaction log).
9-
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
11+
#[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
1012
pub struct Lsn(u64);
1113

1214
impl From<&str> for Lsn {
@@ -38,3 +40,11 @@ impl From<Lsn> for String {
3840
format!("{:X}/{:X}", lsn.0 >> 32, lsn.0 & 0x00000000ffffffff)
3941
}
4042
}
43+
44+
impl fmt::Debug for Lsn {
45+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
46+
f.debug_tuple("Lsn")
47+
.field(&String::from(*self))
48+
.finish()
49+
}
50+
}

0 commit comments

Comments
 (0)