Code Monkey home page Code Monkey logo

mioco's Introduction

mioco

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

mioco's People

Contributors

3hren avatar blabaere avatar canndrew avatar d-unsed avatar dpc avatar drakulix avatar euclio avatar hjr3 avatar jeremyjh avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.