rxrust 0.1.0

A Rust implementation of Reactive Extensions.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mod thread_scheduler;
pub use thread_scheduler::ThreadScheduler;

/// A Scheduler is an object to order task and schedule their execution.
pub trait Scheduler {
  fn schedule<T: Send + Sync + 'static, R: Send + Sync + 'static>(
    &self,
    task: impl FnOnce(Option<T>) -> R + Send + 'static,
    state: Option<T>,
  ) -> R;
}

/// Returns a Scheduler instance that creates a new thread for each unit of
/// work.
pub fn new_thread() -> ThreadScheduler { ThreadScheduler {} }