Name Description Size
channel.rs Thread safe communication channel implementing `Evented` 9899
deprecated
event_imp.rs 30057
io.rs 1032
lazycell.rs This crate provides a `LazyCell` struct which acts as a lazily filled `Cell`. With a `RefCell`, the inner contents cannot be borrowed for the lifetime of the entire object, but only of the borrows returned. A `LazyCell` is a variation on `RefCell` which allows borrows to be tied to the lifetime of the outer object. `AtomicLazyCell` is a variant that uses an atomic variable to manage coordination in a thread-safe fashion. The limitation of an `AtomicLazyCell` is that after it is initialized, it can't be modified. 16719
lib.rs A fast, low-level IO library for Rust focusing on non-blocking APIs, event notification, and other useful utilities for building high performance IO apps. # Features * Non-blocking TCP, UDP * I/O event notification queue backed by epoll, kqueue, and IOCP * Zero allocations at runtime * Platform specific extensions # Non-goals The following are specifically omitted from Mio and are left to the user or higher-level libraries. * File operations * Thread pools / multi-threaded event loop * Timers # Platforms Currently supported platforms: * Linux * OS X * Windows * FreeBSD * NetBSD * Android * iOS mio can handle interfacing with each of the event notification systems of the aforementioned platforms. The details of their implementation are further discussed in [`Poll`]. # Usage Using mio starts by creating a [`Poll`], which reads events from the OS and put them into [`Events`]. You can handle IO events from the OS with it. For more detail, see [`Poll`]. [`Poll`]: struct.Poll.html [`Events`]: struct.Events.html # Example ``` use mio::*; use mio::net::{TcpListener, TcpStream}; // Setup some tokens to allow us to identify which event is // for which socket. const SERVER: Token = Token(0); const CLIENT: Token = Token(1); let addr = "127.0.0.1:13265".parse().unwrap(); // Setup the server socket let server = TcpListener::bind(&addr).unwrap(); // Create a poll instance let poll = Poll::new().unwrap(); // Start listening for incoming connections poll.register(&server, SERVER, Ready::readable(), PollOpt::edge()).unwrap(); // Setup the client socket let sock = TcpStream::connect(&addr).unwrap(); // Register the socket poll.register(&sock, CLIENT, Ready::readable(), PollOpt::edge()).unwrap(); // Create storage for events let mut events = Events::with_capacity(1024); loop { poll.poll(&mut events, None).unwrap(); for event in events.iter() { match event.token() { SERVER => { // Accept and drop the socket immediately, this will close // the socket and notify the client of the EOF. let _ = server.accept(); } CLIENT => { // The server just shuts down the socket, let's just exit // from our event loop. return; } _ => unreachable!(), } } } ``` 9746
net
poll.rs 95905
sys
timer.rs Timer optimized for I/O related operations 15821
token.rs 5254
udp.rs Primitives for working with UDP The types provided in this module are non-blocking by default and are designed to be portable across all supported Mio platforms. As long as the [portability guidelines] are followed, the behavior should be identical no matter the target platform. [portability guidelines]: ../struct.Poll.html#portability 12042