1use core::{
12 fmt,
13 panic::{RefUnwindSafe, UnwindSafe},
14};
15use derive_more::{Deref, DerefMut};
16
17crate::cfg::async_executor! {
18 if {
19 type ExecutorInner<'a> = async_executor::Executor<'a>;
20 type LocalExecutorInner<'a> = async_executor::LocalExecutor<'a>;
21 } else {
22 type ExecutorInner<'a> = crate::edge_executor::Executor<'a, 64>;
23 type LocalExecutorInner<'a> = crate::edge_executor::LocalExecutor<'a, 64>;
24 }
25}
26
27crate::cfg::multi_threaded! {
28 pub use async_task::FallibleTask;
29}
30
31#[derive(Deref, DerefMut, Default)]
38pub struct Executor<'a>(ExecutorInner<'a>);
39
40#[derive(Deref, DerefMut, Default)]
48pub struct LocalExecutor<'a>(LocalExecutorInner<'a>);
49
50impl Executor<'_> {
51 #[expect(clippy::allow_attributes, reason = "This lint may not always trigger.")]
53 #[allow(dead_code, reason = "not all feature flags require this function")]
54 pub const fn new() -> Self {
55 Self(ExecutorInner::new())
56 }
57}
58
59impl LocalExecutor<'_> {
60 #[expect(clippy::allow_attributes, reason = "This lint may not always trigger.")]
62 #[allow(dead_code, reason = "not all feature flags require this function")]
63 pub const fn new() -> Self {
64 Self(LocalExecutorInner::new())
65 }
66}
67
68impl UnwindSafe for Executor<'_> {}
69
70impl RefUnwindSafe for Executor<'_> {}
71
72impl UnwindSafe for LocalExecutor<'_> {}
73
74impl RefUnwindSafe for LocalExecutor<'_> {}
75
76impl fmt::Debug for Executor<'_> {
77 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
78 f.debug_struct("Executor").finish()
79 }
80}
81
82impl fmt::Debug for LocalExecutor<'_> {
83 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
84 f.debug_struct("LocalExecutor").finish()
85 }
86}