24 Apr 2016

Version 0.2.0 of the Good Job Event Loop is now live on crates.io. The major change in this release is that all of the I/O code has been split out into a separate crate called gjio. The main gj crate still defines the core Promise and EventLoop structures, but gjio implements all the specifics about how events are received from the outside world. The EventPort trait is the hook that allows gj to use those specifics. If for whatever reason you decide you don’t like gjio, you can write your own EventPort impelemention and still use gj.

As I’ve moved the gj::io module into its own crate, I’ve taken the opportunity to iterate somewhat on the design. Probably the most prominent change is that the methods of AsyncRead and AsyncWrite now take self by reference rather than by move, which I think is an ergnomonic win. Judge for yourself by checking out the old version and the new version of a TCP echo example.

A notable under-the-hood change is that, unlike the old gj:io module, the new gjio crate implements its own custom low level system specific code for calling the non-blocking I/O interfaces of Linux, OSX, and Windows. Doing so requires less code than you might think, especially because native nonblocking I/O model on Windows is a good match for the completion-based interfaces of gjio’s AsyncRead and AsyncWrite.

-- posted by dwrensha

capnproto-rust on github
more posts