diff --git a/src/style.rs b/src/style.rs index bead76da..b8f147a7 100644 --- a/src/style.rs +++ b/src/style.rs @@ -21,6 +21,7 @@ use std::env; use glib::object::ObjectExt; +use util::Warn; /// Gathers stuff defined in C or called by C pub mod c { @@ -61,22 +62,6 @@ pub mod c { // not Adwaita, but rather fall back to default const DEFAULT_THEME_NAME: &str = ""; -/// Sugar for logging errors in results -trait Warn { - type Value; - fn ok_warn(self, msg: &str) -> Option; -} - -impl Warn for Result { - type Value = T; - fn ok_warn(self, msg: &str) -> Option { - self.map_err(|e| { - eprintln!("{}: {}", msg, e); - e - }).ok() - } -} - struct GtkTheme { name: String, variant: Option, diff --git a/src/util.rs b/src/util.rs index 1a86330d..891e9d28 100644 --- a/src/util.rs +++ b/src/util.rs @@ -177,6 +177,22 @@ impl Borrow> for Pointer { } } +/// Sugar for logging errors in results +pub trait Warn { + type Value; + fn ok_warn(self, msg: &str) -> Option; +} + +impl Warn for Result { + type Value = T; + fn ok_warn(self, msg: &str) -> Option { + self.map_err(|e| { + eprintln!("{}: {}", msg, e); + e + }).ok() + } +} + pub trait WarningHandler { /// Handle a warning fn handle(&mut self, warning: &str);