#mio #asynchronous #coroutine #async #fiber

mioco

Scalable, asynchronous IO coroutine-based handling (aka MIO COroutines)

13 releases (8 breaking)

Uses old Rust 2015

0.8.1 Aug 21, 2016
0.7.0 Jun 25, 2016
0.4.1 Mar 20, 2016
0.2.0-pre1 Nov 4, 2015
0.0.4 Jul 4, 2015

#4 in #fiber

Download history 21/week @ 2020-12-25 55/week @ 2021-01-01 52/week @ 2021-01-08 69/week @ 2021-01-15 50/week @ 2021-01-22 46/week @ 2021-01-29 49/week @ 2021-02-05 72/week @ 2021-02-12 55/week @ 2021-02-19 44/week @ 2021-02-26 33/week @ 2021-03-05 42/week @ 2021-03-12 59/week @ 2021-03-19 64/week @ 2021-03-26 61/week @ 2021-04-02 39/week @ 2021-04-09

206 downloads per month
Used in colerr

MPL-2.0 license

165KB
4K SLoC

mioco

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

Code snippet

    mioco::start(|| -> io::Result<()> {
        let addr = listend_addr();

        let listener = try!(TcpListener::bind(&addr));

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

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

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

                Ok(())
            });
        }
    }).unwrap().unwrap();

This trivial code scales very well. See benchmarks.

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 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

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.

Dependencies

~4.5MB
~96K SLoC