Futures hello world.
This commit is contained in:
parent
0d9cb1dcfa
commit
5de9bf9aee
3 changed files with 27 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
target
|
||||||
|
Cargo.lock
|
7
Cargo.toml
Normal file
7
Cargo.toml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[package]
|
||||||
|
name = "lab_ebml"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Tangent 128 <Tangent128@gmail.com>"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
futures = "^0.1.7"
|
18
src/lib.rs
Normal file
18
src/lib.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
extern crate futures;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
|
||||||
|
use futures::future::{ok, Future};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn hello_futures() {
|
||||||
|
let my_future = ok::<String, ()>("Hello".into())
|
||||||
|
.map(|hello| hello + ", Futures!");
|
||||||
|
|
||||||
|
let string_result = my_future.wait().unwrap();
|
||||||
|
|
||||||
|
assert_eq!(string_result, "Hello, Futures!");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue