Module std::rt::uv

libuv and default rtio implementation. libuv and default rtio implementation. Bindings to libuv, along with the default implementation of std::rt::rtio.

UV types consist of the event loop (Loop), Watchers, Requests and Callbacks.

Watchers and Requests encapsulate pointers to uv handles, which have subtyping relationships with each other. This subtyping is reflected in the bindings with explicit or implicit coercions. For example, an upcast from TcpWatcher to StreamWatcher is done with tcp_watcher.as_stream(). In other cases a callback on a specific type of watcher will be passed a watcher of a supertype.

Currently all use of Request types (connect/write requests) are encapsulated in the bindings and don't need to be dealt with by the caller.

Safety note

Due to the complex lifecycle of uv handles, as well as compiler bugs, this module is not memory safe and requires explicit memory management, via close and delete methods.

Reexports

pub use self::pipe::Pipe;
pub use self::file::{FsRequest};
pub use self::async::AsyncWatcher;
pub use self::net::{StreamWatcher, TcpWatcher, UdpWatcher};
pub use self::process::Process;
pub use self::idle::IdleWatcher;
pub use self::timer::TimerWatcher;

Modules

addrinfo
async
file
idle
net
pipe
process
timer
uvio

The implementation of rtio for libuv The implementation of rtio for libuv

uvll

C bindings to libuv C bindings to libuv Low-level bindings to the libuv library.

Structs

Loop

XXX: Loop(*handle) is buggy with destructors. Normal structs with dtors may not be destructured, but tuple structs can, but the results are not correct.

UvError

Traits

NativeHandle

A type that wraps a native handle

Request
Watcher

The trait implemented by uv 'watchers' (handles). Watchers are non-owning wrappers around the uv handles and are not completely safe - there may be multiple instances for a single underlying handle. Watchers are generally created, then started, stoped and closeed, but due to their complex life cycle may not be entirely memory safe if used in unanticipated patterns.

WatcherInterop

Functions

slice_to_uv_buf

Borrow a slice to a Buf

status_to_maybe_uv_error

Given a uv handle, convert a callback status to a UvError

uv_error_to_io_error
vec_from_uv_buf

Transmute a Buf that was once a ~[u8] back to ~[u8]

vec_to_uv_buf

Transmute an owned vector to a Buf

Type Definitions

AllocCallback
AsyncCallback
Buf

The uv buffer type

ConnectionCallback
ExitCallback
FsCallback
IdleCallback
NullCallback
ReadCallback
TimerCallback
UdpReceiveCallback
UdpSendCallback