arcs_logging_rs/
structs.rs1use std::{fmt::{Display, Formatter}, sync::PoisonError};
2use log::SetLoggerError;
3
4#[derive(Debug)]
5pub struct PoisonErrorWrapper(String);
6
7impl Display for PoisonErrorWrapper {
8
9
10 fn fmt(&self, fmt: &mut Formatter) -> std::fmt::Result {
11 self.0.fmt(fmt)
12 }
13}
14impl std::error::Error for PoisonErrorWrapper {}
15
16
17impl<T> From<PoisonError<T>> for PoisonErrorWrapper
18where
19 T: std::fmt::Debug {
20 fn from(error: PoisonError<T>) -> Self {
21 Self(format!("{:?}", error.to_string()))
22 }
23}
24
25
26#[derive(Debug)]
27pub struct ErrorWrapper(SetLoggerError);
28
29impl Display for ErrorWrapper {
30 fn fmt(&self, fmt: &mut Formatter) -> std::fmt::Result {
31 self.0.fmt(fmt)
32 }
33}
34impl std::error::Error for ErrorWrapper {}
35
36impl From<SetLoggerError> for ErrorWrapper {
37 fn from(error: SetLoggerError) -> Self {
38 Self(error)
39 }
40}
41
42pub mod shortcuts {
43 pub use std::io::{
44 Error as IOError,
45 Result as IOResult,
46 };
47}