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