async_callback_manager/
lib.rs1use futures::{Future, Stream};
2use std::any::Any;
3
4mod adaptors;
5mod error;
6mod manager;
7mod panicking_receiver_stream;
8mod task;
9
10pub use adaptors::*;
11pub use error::*;
12pub use manager::*;
13pub use panicking_receiver_stream::*;
14pub use task::{AsyncTask, Constraint, TaskInformation, TaskOutcome};
15
16pub(crate) const DEFAULT_STREAM_CHANNEL_SIZE: usize = 20;
19
20pub trait BkendMap<Bkend> {
21 fn map(backend: &Bkend) -> &Self;
22}
23
24pub trait BackendTask<Bkend>: Send + Any {
28 type Output: Send;
29 type MetadataType: PartialEq;
30 fn into_future(self, backend: &Bkend) -> impl Future<Output = Self::Output> + Send + 'static;
31 fn metadata() -> Vec<Self::MetadataType> {
34 vec![]
35 }
36}
37
38pub trait BackendStreamingTask<Bkend>: Send + Any {
42 type Output: Send;
43 type MetadataType: PartialEq;
44 fn into_stream(
45 self,
46 backend: &Bkend,
47 ) -> impl Stream<Item = Self::Output> + Send + Unpin + 'static;
48 fn metadata() -> Vec<Self::MetadataType> {
51 vec![]
52 }
53}