Files
tokio/README.md
T

72 lines
2.2 KiB
Markdown
Raw Normal View History

2016-08-26 14:30:46 -07:00
# tokio-core
2016-08-05 16:21:56 -07:00
2016-08-26 14:30:46 -07:00
Core I/O and event loop abstraction for asynchronous I/O in Rust built on
`futures` and `mio`.
2016-08-05 16:21:56 -07:00
2016-08-26 14:30:46 -07:00
[![Build Status](https://travis-ci.org/tokio-rs/tokio-core.svg?branch=master)](https://travis-ci.org/tokio-rs/tokio-core)
2016-08-26 14:57:55 -07:00
[![Build status](https://ci.appveyor.com/api/projects/status/caxmxbg8181kk9mq/branch/master?svg=true)](https://ci.appveyor.com/project/carllerche/tokio-core)
2016-08-05 16:21:56 -07:00
2017-01-09 16:40:16 -08:00
[Documentation](https://docs.rs/tokio-core)
2016-08-05 16:21:56 -07:00
## Usage
First, add this to your `Cargo.toml`:
```toml
[dependencies]
2016-09-09 18:15:15 -07:00
tokio-core = "0.1"
2016-08-05 16:21:56 -07:00
```
Next, add this to your crate:
```rust
2016-08-26 14:30:46 -07:00
extern crate tokio_core;
2016-08-05 16:21:56 -07:00
```
## Examples
There are a few small examples showing off how to use this library:
* [echo.rs] - a simple TCP echo server
* [socks5.rs] - an implementation of a SOCKSv5 proxy server
2016-09-02 23:22:27 -07:00
[echo.rs]: https://github.com/tokio-rs/tokio-core/blob/master/examples/echo.rs
2016-08-26 14:30:46 -07:00
[socks5.rs]: https://github.com/tokio-rs/tokio-socks5/blob/master/src/main.rs
2016-08-05 16:21:56 -07:00
2016-08-26 14:30:46 -07:00
## What is tokio-core?
2016-08-05 16:21:56 -07:00
2016-11-17 22:20:36 -08:00
This crate is a connection between `futures`, a zero-cost implementation of futures in
Rust, and `mio`, a crate for zero-cost asynchronous I/O. The types and
2016-08-26 14:30:46 -07:00
structures implemented in `tokio-core` implement `Future` and `Stream` traits
2016-11-17 22:20:36 -08:00
as appropriate. For example, connecting a TCP stream returns a `Future`
2016-08-26 14:30:46 -07:00
resolving to a TCP stream, and a TCP listener implements a stream of TCP
streams (accepted connections).
2016-08-05 16:21:56 -07:00
This crate also provides facilities such as:
* TCP streams
* TCP listeners
* UDP sockets
* Timeouts
* Data owned and local to the event loop
* An `Executor` implementation for a futures' `Task`
2016-08-26 14:30:46 -07:00
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.
2016-08-05 16:21:56 -07:00
2016-08-26 14:30:46 -07:00
[`tokio-tls`]: https://tokio-rs.github.io/tokio-tls
2016-08-05 16:21:56 -07:00
Check out the [documentation] for more information, and more coming here soon!
2016-08-26 14:30:46 -07:00
[documentation]: https://tokio-rs.github.io/tokio-core
2016-08-08 23:18:49 -07:00
# License
2016-08-26 14:30:46 -07:00
`tokio-core` is primarily distributed under the terms of both the MIT license
2016-08-08 23:18:49 -07:00
and the Apache License (Version 2.0), with portions covered by various BSD-like
licenses.
See LICENSE-APACHE, and LICENSE-MIT for details.