mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-28 20:14:13 +00:00
implement display trait
This commit is contained in:
parent
613b724c9e
commit
3d84195714
@ -1,6 +1,8 @@
|
|||||||
/// Global dependencies
|
// Global dependencies
|
||||||
use super::client::{status::Gemini, Status as Client};
|
use super::client::{status::Gemini, Status as Client};
|
||||||
|
use crate::tool::format_time;
|
||||||
use gtk::glib::DateTime;
|
use gtk::glib::DateTime;
|
||||||
|
use std::fmt::{Display, Formatter, Result};
|
||||||
|
|
||||||
/// `Page` status
|
/// `Page` status
|
||||||
pub enum Status {
|
pub enum Status {
|
||||||
@ -44,3 +46,34 @@ impl Status {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Display for Status {
|
||||||
|
fn fmt(&self, f: &mut Formatter) -> Result {
|
||||||
|
match self {
|
||||||
|
Self::Client(client) => {
|
||||||
|
write!(f, "{client}")
|
||||||
|
}
|
||||||
|
Self::Failure { time } => {
|
||||||
|
write!(f, "[{}] Failure", format_time(time))
|
||||||
|
}
|
||||||
|
Self::Input { time } => {
|
||||||
|
write!(f, "[{}] Input issue", format_time(time))
|
||||||
|
}
|
||||||
|
Self::Loading { time } => {
|
||||||
|
write!(f, "[{}] Loading...", format_time(time))
|
||||||
|
}
|
||||||
|
Self::New { time } => {
|
||||||
|
write!(f, "[{}] New page", format_time(time))
|
||||||
|
}
|
||||||
|
Self::SessionRestore { time } => {
|
||||||
|
write!(f, "[{}] Session restore...", format_time(time))
|
||||||
|
}
|
||||||
|
Self::SessionRestored { time } => {
|
||||||
|
write!(f, "[{}] Session restored", format_time(time))
|
||||||
|
}
|
||||||
|
Self::Success { time } => {
|
||||||
|
write!(f, "[{}] Success", format_time(time))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user