summaryrefslogtreecommitdiff
path: root/src/sync/waiter.rs
blob: 656c42e06daa7b85abc0495270f73b09947fa433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
use futures::sync::oneshot;
use futures::Future;

pub trait Waiter {
    type Item: Send + 'static;
    type Error: From<Self::ConditionError> 
        + From<oneshot::Canceled> + From<()> + Send + 'static;
    type ConditionError: Send + Clone + 'static;

    fn blocked(&self) -> bool;
    fn condition_poller(&self) -> Box<Future<Item=(), Error=Self::ConditionError> + Send>;
    fn into_future(self) -> Box<Future<Item=Self::Item, Error=Self::Error> + Send>;
}