ayun_core/
lib.rs

1pub mod error;
2pub mod support;
3pub mod traits;
4
5cfg_if::cfg_if! {
6    if #[cfg(feature = "eyre")]{
7        pub type AnyError = eyre::Report;
8    }else if #[cfg(feature = "anyhow")]{
9        pub type AnyError = anyhow::Error;
10    }else{
11        pub type AnyError = BoxError;
12    }
13}
14
15pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
16
17pub type BoxFuture<'a, T = ()> =
18    std::pin::Pin<Box<dyn std::future::Future<Output = T> + Send + 'a>>;
19
20pub type BoxClosure<T = ()> = Box<dyn Fn() -> T + Send + Sync>;
21
22pub type BoxCallback<P = (), R = ()> = Box<dyn Fn(P) -> R + Send + Sync>;
23
24pub type Closure<T = ()> = std::sync::Arc<dyn Fn() -> T + Send + Sync>;
25
26pub type Callback<P = (), R = ()> = std::sync::Arc<dyn Fn(P) -> R + Send + Sync>;
27
28pub type Instance = std::sync::Arc<dyn std::any::Any + Send + Sync>;
29
30pub type Result<T, E = AnyError> = std::result::Result<T, E>;
31
32pub type SharedString = std::borrow::Cow<'static, str>;
33
34// re-export
35pub use async_trait::async_trait;
36pub use cfg_if::cfg_if;