Skip to content

Scalable, coroutine-based, asynchronous IO handling library for Rust programming language. (aka MIO COroutines).

License

Notifications You must be signed in to change notification settings

SimonWoodburyForget/mioco

 
 

Repository files navigation

mioco

Travis CI Build Status App Veyor Build Status crates.io Gitter Chat
Documentation

Code snippet

fn main() {
    mioco::start(||{
        let addr = listend_addr();

        let listener = TcpListener::bind(&addr).unwrap();

        println!("Starting tcp echo server on {:?}", listener.local_addr().unwrap());

        loop {
            let mut conn = try!(listener.accept());

            mioco::spawn(move || {
                let mut buf = [0u8; 1024 * 16];
                loop {
                    let size = try!(conn.read(&mut buf));
                    if size == 0 {/* eof */ break; }
                    try!(conn.write_all(&mut buf[0..size]))
                }

                Ok(())
            });
        }
    });
}

Contributors welcome!

Mioco is looking for contributors. See Contributing page for details.

Introduction

Scalable, coroutine-based, asynchronous IO handling library for Rust programming language.

Mioco uses asynchronous event loop, to cooperatively switch between coroutines (aka. green threads), depending on data availability. You can think of mioco as of Node.js for Rust or Rust green threads on top of mio.

Read Documentation for details and features.

If you want to say hi, or need help use #mioco gitter.im.

To report a bug or ask for features use github issues.

Building & running

Note: You must be using nightly Rust release. If you're using multirust, which is highly recommended, switch with multirust default nightly command.

Standalone

To start test echo server:

cargo run --release --example echo

For daily work:

make all

In your project

In Cargo.toml:

[dependencies]
mioco = "*"

In your main.rs:

#[macro_use]
extern crate mioco;

Projects using mioco:

Send PR or drop a link on gitter.

Other

About

Scalable, coroutine-based, asynchronous IO handling library for Rust programming language. (aka MIO COroutines).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 97.3%
  • PowerShell 1.7%
  • Makefile 1.0%