Skip to content

Xudong-Huang/may_future

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

may_future

Travis Build Status

Future runtime in may

Overview

may_future is a runtime library which allows to execute futures on the coroutine context. Specifically the block_on API of the runtime would not block the underlying worker thread that is scheduling the coroutine. It also supply a global static runtime named may_future::RT which is convenient to spawn or block_on futures at hand.

Internally it use the tokio runtime for implementation. This opens the possibility to integrate any features from the tokio stack.

Example

#![feature(async_await)]

use may::{coroutine, go};
use may_future::RT;

fn main() {
    RT.block_on(async {
        println!("hello world");
    });

    coroutine::scope(|s| {
        for i in 0..100 {
            go!(s, move || {
                RT.block_on(async {
                    println!("hello world from coroutine {}", i);
                });
            });
        }
    });
}

License

This project is licensed under either of

at your option.

About

run futures in may

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages