Alex Crichton 6c045d31ac Reorganize the entire crate:
Renamed APIs

* Loop => reactor::Core
* LoopHandle => reactor::Handle
* LoopPin => reactor::Pinned
* TcpStream => net::TcpStream
* TcpListener => net::TcpListener
* UdpSocket => net::UdpSocket
* Sender => channel::Sender
* Receiver => channel::Receiver
* Timeout => reactor::Timeout
* ReadinessStream => reactor::PollEvented
* All `LoopHandle` methods to construct objects are now free functions on the
  associated types, e.g. `LoopHandle::tcp_listen` is now `TcpListener::bind`
* All APIs taking a `Handle` now take a `Handle` as the last argument
* All future-returning APIs now return concrete types instead of trait objects

Added APIs

* io::Io trait -- Read + Write + ability to poll

Removed without replacement:

* AddSource
* AddTimeout
* IoToken
* TimeoutToken

Closes #3
Closes #6
2016-09-07 22:12:14 -07:00
2016-09-07 22:12:14 -07:00
2016-09-07 22:12:14 -07:00
2016-09-07 22:12:14 -07:00
2016-08-26 14:44:01 -07:00
2016-08-26 14:45:55 -07:00
2016-09-01 22:14:26 -07:00
2016-08-26 14:56:21 -07:00
2016-08-26 14:56:21 -07:00

tokio-core

Core I/O and event loop abstraction for asynchronous I/O in Rust built on futures and mio.

Build Status Build status

Documentation

Usage

First, add this to your Cargo.toml:

[dependencies]
tokio-core = { git = "https://github.com/tokio-rs/tokio-core" }

Next, add this to your crate:

extern crate tokio_core;

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

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 Executor implementation 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.

S
Description
A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
Readme MIT
65 MiB
Languages
Rust 100%