I just released Mio v0.5 to crates.io! For those who aren't familiar with it yet, Mio is a lightweight non-blocking IO library for Rust.
This is the first version with Windows support, so I would love help trying it out and finding bugs
Get it here: https://github.com/carllerche/mio
8 Likes
Harry
2
What is new in Mio v0.5 ?
@tshepang pointed out the changelog (though I know notice that I have to add the release date).
Windows support is the big thing There aren't really any more features to add to Mio before 1.0 Anything else should go in a higher level library IMO.
Any other internal changes @carllerche? I had a working server in 0.4.4, but in 0.5, my receive calls always return 0 bytes.
let mut buf = Vec::with_capacity(4096); match socket.recv_from(&mut buf) { Ok(Some((count, addr))) => { debug!("Received {} bytes from {}", count, addr); trace!("{:?}", buf); return Some((addr, buf)) }, Ok(None) => { debug!("Server socket not ready to receive"); return None}, Err(e) => { error!("Receive failed {:?}", e); return None}, };
e.g. Received 0 bytes from 127.0.0.1:58492
@carllerche I changed the Vec to let mut buf: [u8; 512] = [0;512];
and now I get the data. Expected?
ogeon
7
I'm assuming that recv_from
takes a slice. with_capacity
makes room for the vector, but it doesn't set its length, and slices can't grow.