1 unstable release
Uses old Rust 2015
0.1.4 | Jan 12, 2018 |
---|---|
0.1.3 |
|
0.1.2 |
|
0.1.1 |
|
0.1.0 |
|
#13 in #work-in-progress
17KB
417 lines
Iryna
- work in progress
- based on mio
- for learning rust
TODO
- channel close detect
- shutdown server gracefully
- deserializer & delimiter
- initiative to send
DEMO
An echo service
use std;
use channel::*;
use acceptor::*;
#[test]
fn it_works() {
Acceptor::new()
.worker_count(4)
.bind("127.0.0.1", 9098)
.opt_nodelay(true)
.opt_send_buf_size(4096)
.opt_recv_buf_size(4096)
.on_receive(|ref mut ch| {
let sbuf: String = ch.read_test();
match sbuf.trim_right() {
"quit" => {
ch.close();
}
_ => {
ch.write(sbuf.as_bytes());
}
}
})
.on_ready(|ref mut ch| {
ch.write("Welcome.\n".as_bytes());
})
.accept();
std::thread::sleep_ms(100000);
}
Dependencies
~2MB
~31K SLoC