From 9f491d2d29b4593826e622107096812d12183d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Tue, 24 Aug 2021 22:14:04 +0200 Subject: [PATCH] add StatusDisplay struct --- src/debug.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/debug.rs b/src/debug.rs index 187d5dc..c57afba 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -1,4 +1,5 @@ use crate::entities::notification::{Notification, NotificationType}; +use crate::entities::status::Status; use std::fmt::{Display, Formatter}; use crate::entities::event::Event; @@ -52,8 +53,16 @@ impl<'a> Display for EventDisplay<'a> { write!(f, "FiltersChanged") } Event::Update(s) => { - write!(f, "Status {{ #{}, acct: @{}, status: «{}», vis: {:?} }}", s.id, s.account.acct, s.content, s.visibility ) + StatusDisplay(s).fmt(f) } } } } + +pub struct StatusDisplay<'a>(pub &'a Status); + +impl<'a> Display for StatusDisplay<'a> { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "Status {{ #{}, acct: @{}, status: «{}», vis: {:?} }}", self.0.id, self.0.account.acct, self.0.content, self.0.visibility ) + } +}