cancellable-io
A crate implementing cancellable synchronous network I/O.
This crate exposes structs TcpStream, TcpListener and UdpSocket that are similar to their std::net variants, except that I/O operations can be cancelled through Canceller objects created with them.
Most methods work as they do in the std::net implementations, and you should refer to the original documentation for details and examples.
Main differences with the original std::net implementations :
- Methods that return a TcpStream, a TcpListener, or an UdpSocket also return a Canceller object.
- There are no peek() methods (yet?)
- TcpListener and UdpSocket
are not
Sync
(yet?)
Example
use *;
let = bind.unwrap;
let handle = spawn;
sleep;
canceller.cancel.unwrap;
handle.join.unwrap;
License: MIT/Apache-2.0