From 1591f058c63a89c56e535a86e8dbc6ab9058da72 Mon Sep 17 00:00:00 2001 From: anastasia Date: Wed, 5 May 2021 16:38:32 +0300 Subject: [PATCH] implement Debug for Lsn type --- zenith_utils/src/lsn.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zenith_utils/src/lsn.rs b/zenith_utils/src/lsn.rs index 42cb6c46c3..38dab9a15e 100644 --- a/zenith_utils/src/lsn.rs +++ b/zenith_utils/src/lsn.rs @@ -10,7 +10,7 @@ use std::sync::atomic::{AtomicU64, Ordering}; pub const XLOG_BLCKSZ: u32 = 8192; /// A Postgres LSN (Log Sequence Number), also known as an XLogRecPtr -#[derive(Debug, Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] +#[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub struct Lsn(pub u64); /// We tried to parse an LSN from a string, but failed @@ -122,6 +122,12 @@ impl fmt::Display for Lsn { } } +impl fmt::Debug for Lsn { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{:X}/{:X}", self.0 >> 32, self.0 & 0xffffffff) + } +} + impl Add for Lsn { type Output = Lsn;