MCPcopy Index your code
hub / github.com/dpc/mioco.pre-0.9

github.com/dpc/mioco.pre-0.9 @v0.8.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.8.1 ↗ · + Follow
352 symbols 1,243 edges 22 files 153 documented · 43%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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.

Extension points exported contracts — how you extend this code

Scheduler (Interface)
Coroutine Scheduler Custom implementations of this trait allow users to change the order in which Coroutines are being [5 …
src/mod.rs
EventedImpl (Interface)
Utility trait that simplifies implementing `Evented` If it's just a simple wrapper over `EventSourceTrait` [4 implementers]
src/evented.rs
Invoke (Interface)
(no doc) [1 implementers]
src/thunk.rs
SchedulerThread (Interface)
Scheduler thread [5 implementers]
src/mod.rs
EventSourceTrait (Interface)
Trait for coroutine event source From the perspective of the mioco event loop any event source can be (re-/de-)register [4 …
src/evented.rs
Evented (Interface)
Mioco event source. All types used as asynchronous event sources implement this trait. A generic implementation: `MioA [1 …
src/evented.rs
RcEventSourceTrait (Interface)
(no doc) [1 implementers]
src/evented.rs

Core symbols most depended-on inside this repo

clone
called by 76
src/sync/mpsc.rs
spawn
called by 64
src/mod.rs
lock
called by 44
src/sync/mod.rs
start_threads
called by 42
src/mod.rs
io_ref
called by 34
src/evented.rs
shared
called by 33
src/thread.rs
send
called by 24
src/udp.rs
sleep_ms
called by 18
src/mod.rs

Shape

Method 199
Function 106
Class 37
Interface 7
Enum 3

Languages

Rust100%

Modules by API surface

tests.rs76 symbols
src/mod.rs68 symbols
src/coroutine.rs39 symbols
src/evented.rs35 symbols
src/thread.rs30 symbols
src/sync/mpsc.rs20 symbols
src/udp.rs15 symbols
src/timer.rs15 symbols
src/sync/mod.rs15 symbols
src/tcp.rs11 symbols
src/unix.rs9 symbols
src/thunk.rs5 symbols

For agents

$ claude mcp add mioco.pre-0.9 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact