mod batch_fn;
pub mod cached;
pub mod non_cached;
mod runtime;
pub use batch_fn::BatchFn;
use std::{future::Future, pin::Pin};
pub trait WaitForWorkFn:
Fn() -> Pin<Box<dyn Future<Output = ()> + Send + Sync>> + Send + Sync + 'static
{
}
impl<T> WaitForWorkFn for T where
T: Fn() -> Pin<Box<dyn Future<Output = ()> + Send + Sync>> + Send + Sync + 'static
{
}
pub(crate) fn yield_fn(count: usize) -> impl WaitForWorkFn {
move || {
Box::pin(async move {
for _ in 0..count {
runtime::yield_now().await;
}
})
}
}