Implement display for UserStatus

This commit is contained in:
kozabrada123 2023-06-10 16:56:50 +02:00
parent 3db9114ecf
commit 17194a2fcc
2 changed files with 6 additions and 1 deletions

View File

@ -8,7 +8,6 @@ use futures_util::stream::SplitStream;
use futures_util::SinkExt;
use futures_util::StreamExt;
use native_tls::TlsConnector;
use serde_json::value::RawValue;
use std::sync::Arc;
use tokio::net::TcpStream;
use tokio::sync::mpsc::error::TryRecvError;

View File

@ -13,6 +13,12 @@ pub enum UserStatus {
Invisible,
}
impl std::fmt::Display for UserStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", serde_json::to_string(self).unwrap())
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
#[serde(rename_all = "lowercase")]