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