mioco
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 { break; }
let _ = try!(conn.write_all(&mut buf[0..size]));
}
Ok(())
});
}
}).unwrap().unwrap();
Introduction
Structured, composable logging for Rust
Read Documentation for details and features.
If you want to say hi, or need help use #dpc gitter.im.
To report a bug or ask for features use github issues.
Building & running
If you need to install Rust, use rustup.
In your project
In Cargo.toml:
[dependencies]
slog = "*"
In your main.rs:
extern crate slog;