-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhello.rs
More file actions
40 lines (32 loc) · 904 Bytes
/
hello.rs
File metadata and controls
40 lines (32 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (c) 2018 Timo Savola. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// crate-type is cdylib
#![feature(generators, proc_macro_hygiene)]
extern crate futures_await as futures;
extern crate gain;
use futures::prelude::{await, *};
use gain::origin;
#[no_mangle]
pub fn main() {
gain::run(async_block! {
let _ = await!(origin::write(Vec::from("hello, world\n")));
Ok(())
});
}
#[no_mangle]
pub fn twice() {
let f = async_block! {
let _ = await!(origin::write(Vec::from("hello, world\n")));
let _ = await!(origin::write(Vec::from("hello, world\n")));
Ok(())
};
gain::run(f);
}
#[no_mangle]
pub fn hello_debug() {
gain::debug(gain::DEBUG_SEPARATOR);
gain::debug("hello");
gain::debug(gain::DEBUG_SEPARATOR);
gain::debug("world\n");
}