----- Original Message -----
> From: "Jeffery Olson" <olson.jeff...@gmail.com>
> To: rust-dev@mozilla.org
> Sent: Monday, February 6, 2012 9:18:07 AM
> Subject: [rust-dev] net, libuv, etc
> 
> First of all, hello list. I'm pretty excited about rust and hope to
> have an opportunity to make contributions and learn.

There is definitely an opportunity to make a big impact implementing the uv 
bindings.
 
> I'm curious about the current state of the 'net' module and libuv.
> Looking at the docs, there's just some stubs around IPv4 stuff. I've
> heard around that there's interest in building the module atop libuv.
> Is libuv going to be a core dependency? Is there an existing wrapper?
> 
> I hope you will ship a low-level wrapper around libuv in the stdlib,
> as the event loop abstraction is pretty useful (beyond libuv's AIO).

That is what I would like as well: a low-level uv API that mirrors as close as 
possible the C API, then a high-level API for async I/O.

uv does two things that Rust can't cope with yet: blocking in native code, and 
calling C callbacks. Accomplishing either of these things from Rust currently 
requires writing a lot of C glue code. To that end we have a module in std 
called uvtmp that calls a bunch of wrapper functions in the runtime and 
presents an interface that is quite dissimilar to uv's API. The corresponding 
runtime code lives in src/rt/rust_uvtmp.cpp. This was hacked together quickly 
for the use of another project (called servo).

To allow blocking code we are going to add first class schedulers to the 
language, so if you want to start a uv event loop you can start up your own 
scheduler and take an entire thread to yourself. This is what I'm working on 
now and it should be usable this week. The bug ticket is here: 
https://github.com/mozilla/rust/issues/1721

The ticket for allowing callbacks from C into Rust is here: 
https://github.com/mozilla/rust/issues/1732

The bug ticket for the uv bindings is here: 
https://github.com/mozilla/rust/issues/10

As to how you can help us get to the end goal, probably there are three good 
options. First, you could implement callbacks from C to Rust. This is a pretty 
hairy change to both the compiler and the runtime, and we don't have an 
agreed-upon design, but I can help you with this if you want to pursue it.

The second thing you could do is review what's going in std::uvtmp and coax it 
into an API that properly mirrors the uv API, and redesign the runtime code and 
interface with a mind toward eliminating them when the aforementioned Rust 
features materialize.

I outlined in issue #10 a strategy for implementing the uv bindings that I 
think does not require C-to-Rust callbacks but still mirrors the uv API.

Come talk about it on IRC.

Regards,
Brian

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to