Crates.io | promiser |
lib.rs | promiser |
version | 0.0.5 |
source | src |
created_at | 2017-04-15 17:50:39.151851 |
updated_at | 2017-04-15 17:50:39.151851 |
description | promise sync primitive |
homepage | |
repository | https://github.com/viperscape/rust-promise |
max_upload_size | |
id | 10719 |
size | 10,207 |
for now use the git dependency in your Cargo.toml:
[dependencies.promise]
git = "https://github.com/viperscape/rust-promise.git"
example usage:
extern crate promise;
use promise::Promise;
use std::rand;
fn main () {
let (pt,pr) = Promise::new();
let bd = vec![rand::random::<u64>();1000];
pt.deliver(bd);
let v = pr.with(|x| x[999]); //copy value, returns inside of Result
println!("{:?}",v); //Ok(3654177790282180513)
}
These represent some basic benchmarking, real speeds could vary significantly.
test latch::tests::bench_latch ... bench: 45 ns/iter (+/- 0)
test promise::tests::bench_channel_linear ... bench: 758 ns/iter (+/- 7)
test promise::tests::bench_promise_linear ... bench: 1 ns/iter (+/- 0)