//! # very short description //! //! Short description //! //! Details //! //! ## Section 1 //! //! ## Section 2 //// ATTRIBUTES //////////////////////////////////////////////////////////////////////////////////// // we want docs #![warn(missing_docs)] #![warn(rustdoc::missing_crate_level_docs)] // we want Debug everywhere. #![warn(missing_debug_implementations)] // enable clippy's extra lints, the pedantic version #![warn(clippy::pedantic)] //// IMPORTS /////////////////////////////////////////////////////////////////////////////////////// use tracing::subscriber::SetGlobalDefaultError; //// TYPES ///////////////////////////////////////////////////////////////////////////////////////// /// a quick alias for a result with a [`LoggerError`] pub type Result = std::result::Result; //// CONSTANTS ///////////////////////////////////////////////////////////////////////////////////// //// STATICS /////////////////////////////////////////////////////////////////////////////////////// //// MACROS //////////////////////////////////////////////////////////////////////////////////////// //// ENUMS ///////////////////////////////////////////////////////////////////////////////////////// /// ## Errors for the [logger](crate::logger) pub enum Error { /// Bad IO operation IO(std::io::Error), /// Various errors raised when the messenger is used in a wrong way Usage(String), /// Could not assign logger as the global default SetGlobalDefaultFail(SetGlobalDefaultError), } //// STRUCTS /////////////////////////////////////////////////////////////////////////////////////// //// IMPLEMENTATION //////////////////////////////////////////////////////////////////////////////// impl From for Error { fn from(value: std::io::Error) -> Self { Error::IO(value) } } //////////////////////////////////////////////////////////////////////////////////////////////////// impl From for Error { fn from(value: SetGlobalDefaultError) -> Self { Error::SetGlobalDefaultFail(value) } } //////////////////////////////////////////////////////////////////////////////////////////////////// impl std::fmt::Debug for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Error::IO(e) => write!(f, ""), Error::Usage(e) => write!(f, ""), Error::SetGlobalDefaultFail(e) => write!(f, ""), } } } //////////////////////////////////////////////////////////////////////////////////////////////////// impl std::fmt::Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Error::IO(e) => write!(f, "IO Error {e}"), Error::Usage(e) => write!(f, "Usage Error {e}"), Error::SetGlobalDefaultFail(e) => write!(f, "SetGlobalDefaultFail {e}"), } } } //// PUBLIC FUNCTIONS ////////////////////////////////////////////////////////////////////////////// //// PRIVATE FUNCTIONS /////////////////////////////////////////////////////////////////////////////