traits into `Codec` A previous commit refactored such that `Encode` and `Decode` are implemented directly on the types being encoded or decoded. This was thought to be less expressive but more convenient than having a separate notion of a (stateful) encoder or decoder. However, there are certain situations where the approach is just too limiting: you're required to implemented `Decode` and `Encode` for types you don't "own" and can't newtype. This commit moves back to a setup where `Self` represents the encoder/decoder state; it also merges the two traits into a single `Codec` trait, since they are currently always used together.
tokio-core
Core I/O and event loop abstraction for asynchronous I/O in Rust built on
futures and mio.
Usage
First, add this to your Cargo.toml:
[dependencies]
tokio-core = "0.1"
Next, add this to your crate:
extern crate tokio_core;
Examples
There are a few small examples showing off how to use this library:
What is tokio-core?
This crate is a connection futures, a zero-cost implementation of futures in
Rust, and mio and a crate for zero-cost asynchronous I/O. The types and
structures implemented in tokio-core implement Future and Stream traits
as appropriate. For example connecting a TCP stream returns a Future
resolving to a TCP stream, and a TCP listener implements a stream of TCP
streams (accepted connections).
This crate also provides facilities such as:
- TCP streams
- TCP listeners
- UDP sockets
- Timeouts
- Data owned and local to the event loop
- An
Executorimplementation for a futures'Task
The intention of tokio-core is to provide a concrete implementation for crates
built on top of asynchronous I/O. For example you can easily turn a TCP stream
into a TLS/SSL stream with the tokio-tls crate or use the combinators to
compose working with data on sockets.
Check out the documentation for more information, and more coming here soon!
License
tokio-core is primarily distributed under the terms of both the MIT license
and the Apache License (Version 2.0), with portions covered by various BSD-like
licenses.
See LICENSE-APACHE, and LICENSE-MIT for details.