----- Original Message -----
> From: "Zack Corr" <[email protected]>
> To: "Graydon Hoare" <[email protected]>
> Cc: [email protected]
> Sent: Sunday, February 19, 2012 5:42:49 PM
> Subject: Re: [rust-dev] Why exactly do we need low-level libuv bindings?
> 
> This makes sense. I would be willing to help on the libuv bindings
> front, but let me get this straight before I go any further. An
> ideal setup of the low-level/high-level system would look like this:
> 
> std::uv - low-level bindings to the libuv C API.
> std::event/std::ev - high-level bindings to the event loop part
> (timers and such) of std::uv.
> std::fs - high-level bindings to fs functions of std::uv as well as
> other filesystem functions.
> std::net - high-level bindings to the networking parts of std::uv as
> well as other networking functions.

Possibly. I honestly haven't given much thought to what happens after we have 
the libuv bindings. As you suggest though, the libuv API itself is not very 
Rustlike, so maybe it does make sense to have another intermediate module, so

std::uv::raw - Literally the C API exposed to Rust with all the struct 
redefinitions, etc. that entails
std::uv - A friendlier API along the lines you suggested

Beyond that possibly the module layout you suggest makes sense. It's still a 
ways off and there's a lot of experimenting to do yet. Things that I imagine we 
will want to build off of uv include:

* async network I/O
* syncronous network I/O - With our task model we will have the luxury of 
presenting a synchronous API that is built around the asynchronous API. It will 
block individual tasks, but not any threads.
* async file I/O & sync file I/O
* timers - This is honestly the thing I want the most right now. There is 
literally no way to sleep for a specified duration in Rust.
* we will also want to structure things, I think, so that by default all these 
API's use some default event loop (which we have no mechanism to create yet), 
but can also be used with a supplied event loop. I've heard opposition to this 
idea though since it requires global state.

Probably all of this stuff will be promoted to core eventually.

fzzzy and I have been dabbling with libuv recently, and pfox has been trying to 
clean up the existing uv code this week. More hands would be welcome and I 
recommend stopping by IRC during work hours Pacific time to discuss plans.

> P.S.S. I would suggest that std::net IPv6 parsing and formatting uses
> the libuv wrapper for this, because IPv6 addresses are very
> complicated and using a low-level function for it that handles the
> many shortcuts in the addresses would work better.

Agreed that anything that uv supplies we should attempt to reuse.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to