bar app icons & tooltips

This commit is contained in:
galister
2026-01-05 15:45:19 +09:00
parent b86525d65d
commit b56aa1a8de
30 changed files with 291 additions and 129 deletions

53
wgui/src/log.rs Normal file
View File

@@ -0,0 +1,53 @@
use std::fmt::Debug;
pub trait LogErr {
fn log_err(self) -> Self;
fn log_err_with(self, additional: &str) -> Self;
fn log_warn(self) -> Self;
fn log_warn_with(self, additional: &str) -> Self;
}
impl<T, E> LogErr for Result<T, E>
where
E: Debug + Send + Sync + 'static,
{
fn log_warn(self) -> Result<T, E> {
match self {
Ok(ok) => Ok(ok),
Err(error) => {
log::warn!("{error:?}");
Err(error)
}
}
}
fn log_warn_with(self, additional: &str) -> Result<T, E> {
match self {
Ok(ok) => Ok(ok),
Err(error) => {
log::warn!("{additional}: {error:?}");
Err(error)
}
}
}
fn log_err(self) -> Result<T, E> {
match self {
Ok(ok) => Ok(ok),
Err(error) => {
log::error!("{error:?}");
Err(error)
}
}
}
fn log_err_with(self, additional: &str) -> Result<T, E> {
match self {
Ok(ok) => Ok(ok),
Err(error) => {
log::error!("{additional}: {error:?}");
Err(error)
}
}
}
}