add StatusDisplay struct

master
Ondřej Hruška 3 years ago
parent de38639fd1
commit 9f491d2d29
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 11
      src/debug.rs

@ -1,4 +1,5 @@
use crate::entities::notification::{Notification, NotificationType}; use crate::entities::notification::{Notification, NotificationType};
use crate::entities::status::Status;
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use crate::entities::event::Event; use crate::entities::event::Event;
@ -52,8 +53,16 @@ impl<'a> Display for EventDisplay<'a> {
write!(f, "FiltersChanged") write!(f, "FiltersChanged")
} }
Event::Update(s) => { 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 )
}
}

Loading…
Cancel
Save