1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
pub mod queue; pub mod actor; pub use queue::{AQueueItem,AQueue,QueueItem}; pub use actor::Actor; pub use aqueue_trait::async_trait as aqueue_trait; use std::error::Error; use crate::AError::*; use std::fmt::{Display, Formatter}; use std::fmt; #[derive(Debug)] pub enum AError{ StrErr(String), Other(Box<dyn Error+Send+Sync+'static>) } impl From<String> for AError{ fn from(msg: String) -> Self { StrErr(msg) } } impl From<&str> for AError{ fn from(msg: &str) -> Self { StrErr(msg.to_string()) } } impl Display for AError{ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self{ StrErr(ref msg)=>{ write!(f, "{}", msg) }, Other(err)=>{ write!(f, "{}", err) } } } } impl Error for AError{} pub type AResult<T>=Result<T,AError>;