Skip to main content

barust/
lib.rs

1pub mod utils;
2pub mod widgets;
3
4pub mod statusbar;
5
6use thiserror::Error;
7#[derive(Debug, Error)]
8#[error(transparent)]
9pub enum BarustError {
10    Cairo(#[from] cairo::Error),
11    #[error("Draw was called without any regions defined")]
12    DrawBeforeUpdate,
13    Io(#[from] std::io::Error),
14    Widget(#[from] widgets::WidgetError),
15    Xcb(#[from] xcb::Error),
16}
17
18impl From<xcb::ConnError> for BarustError {
19    fn from(v: xcb::ConnError) -> Self {
20        Self::Xcb(xcb::Error::Connection(v))
21    }
22}
23
24impl From<xcb::ProtocolError> for BarustError {
25    fn from(v: xcb::ProtocolError) -> Self {
26        Self::Xcb(xcb::Error::Protocol(v))
27    }
28}
29
30pub type Result<T> = std::result::Result<T, BarustError>;