use futures::{Future, Stream};
use std::any::Any;
mod adaptors;
mod error;
mod manager;
mod task;
pub use adaptors::*;
pub use error::*;
pub use manager::*;
pub use task::{AsyncTask, Constraint, TaskInformation, TaskOutcome};
pub(crate) const DEFAULT_STREAM_CHANNEL_SIZE: usize = 20;
pub trait BkendMap<Bkend> {
fn map(backend: &Bkend) -> &Self;
}
pub trait BackendTask<Bkend>: Send + Any {
type Output: Send;
type MetadataType: PartialEq;
fn into_future(self, backend: &Bkend) -> impl Future<Output = Self::Output> + Send + 'static;
fn metadata() -> Vec<Self::MetadataType> {
vec![]
}
}
pub trait BackendStreamingTask<Bkend>: Send + Any {
type Output: Send;
type MetadataType: PartialEq;
fn into_stream(
self,
backend: &Bkend,
) -> impl Stream<Item = Self::Output> + Send + Unpin + 'static;
fn metadata() -> Vec<Self::MetadataType> {
vec![]
}
}