busmust/
lib.rs

1extern crate busmust_sys as ffi;
2
3use std::fmt;
4use dmgr::desc_from_error;
5
6mod call;
7mod util;
8pub mod dmgr;
9
10#[derive(Debug, Clone)]
11pub struct Error(ffi::BMStatus);
12
13pub type Result<T> = std::result::Result<T, Error>;
14
15impl fmt::Display for Error {
16    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
17        write!(f, "error: {:?} ({})", self, desc_from_error(self))
18    }
19}
20
21impl std::error::Error for Error {
22    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
23        None
24    }
25}