futures-shuttle

Crates.iofutures-shuttle
lib.rsfutures-shuttle
version0.2.1
sourcesrc
created_at2018-03-14 16:27:54.885305
updated_at2018-04-07 05:20:40.533624
descriptionFutures-aware shuttle synchronization object
homepage
repositoryhttps://gitlab.com/imp/futures-shuttle-rs.git
max_upload_size
id55639
size28,895
Cyril Plisko (imp)

documentation

https://docs.rs/futures-shuttle

README

futures-shuttle

Build status

Futures-aware shuttle synchronization object

Creates a new shuttle synchronization object for sharing values between two asynchronous tasks. Each half can be separately owned and sent across tasks.

Examples

extern crate futures;
extern crate futures_shuttle;

use std::thread;

use futures_shuttle::shuttle;
use futures::*;

fn main() {
    let (mut left, mut right) = shuttle(42);

    assert!(left.is_mine());
    assert!(!right.is_mine());
    assert_eq!(left.get(), 42);
    left.set(84);
    left.send();
    assert!(!left.is_mine());
    assert!(right.is_mine());
    assert_eq!(right.get(), 84);
}
Commit count: 52

cargo fmt