mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-19 00:00:09 +02:00
Rename crate to tokio
This commit is contained in:
committed by
Alex Crichton
parent
25f30c91c4
commit
36aaaa1520
+2
-2
@@ -1,7 +1,7 @@
|
||||
## Examples of `tokio-core`
|
||||
|
||||
This directory contains a number of examples showcasing various capabilities of
|
||||
the `tokio_core` crate. Most of these examples also leverage the `futures` and
|
||||
the `tokio` crate. Most of these examples also leverage the `futures` and
|
||||
`tokio_io` crates, along with a number of other miscellaneous dependencies for
|
||||
various tasks.
|
||||
|
||||
@@ -15,7 +15,7 @@ A high level description of each example is:
|
||||
|
||||
* `hello` - a tiny server that simply writes "Hello!" to all connected clients
|
||||
and then terminates the connection, should help see how to create and
|
||||
initialize `tokio_core`.
|
||||
initialize `tokio`.
|
||||
* `echo` - this is your standard TCP "echo server" which simply accepts
|
||||
connections and then echos back any contents that are read from each connected
|
||||
client.
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@
|
||||
//! messages.
|
||||
|
||||
extern crate futures;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
|
||||
use std::collections::HashMap;
|
||||
@@ -30,8 +30,8 @@ use std::io::{Error, ErrorKind, BufReader};
|
||||
|
||||
use futures::Future;
|
||||
use futures::stream::{self, Stream};
|
||||
use tokio_core::net::TcpListener;
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::reactor::Core;
|
||||
use tokio_io::io;
|
||||
use tokio_io::AsyncRead;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
extern crate futures;
|
||||
extern crate futures_cpupool;
|
||||
extern crate flate2;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
|
||||
use std::io;
|
||||
@@ -30,8 +30,8 @@ use std::net::SocketAddr;
|
||||
|
||||
use futures::{Future, Stream, Poll};
|
||||
use futures_cpupool::CpuPool;
|
||||
use tokio_core::net::{TcpListener, TcpStream};
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use tokio::reactor::Core;
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use flate2::write::GzEncoder;
|
||||
|
||||
|
||||
+6
-6
@@ -15,7 +15,7 @@
|
||||
//! stdin/stdout to a server" to get up and running.
|
||||
|
||||
extern crate futures;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
extern crate bytes;
|
||||
|
||||
@@ -26,7 +26,7 @@ use std::thread;
|
||||
|
||||
use futures::sync::mpsc;
|
||||
use futures::{Sink, Future, Stream};
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio::reactor::Core;
|
||||
|
||||
fn main() {
|
||||
// Determine if we're going to run in TCP or UDP mode
|
||||
@@ -83,8 +83,8 @@ mod tcp {
|
||||
|
||||
use bytes::{BufMut, BytesMut};
|
||||
use futures::{Future, Stream};
|
||||
use tokio_core::net::TcpStream;
|
||||
use tokio_core::reactor::Handle;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::reactor::Handle;
|
||||
use tokio_io::AsyncRead;
|
||||
use tokio_io::codec::{Encoder, Decoder};
|
||||
|
||||
@@ -167,8 +167,8 @@ mod udp {
|
||||
|
||||
use bytes::BytesMut;
|
||||
use futures::{Future, Stream};
|
||||
use tokio_core::net::{UdpCodec, UdpSocket};
|
||||
use tokio_core::reactor::Handle;
|
||||
use tokio::net::{UdpCodec, UdpSocket};
|
||||
use tokio::reactor::Handle;
|
||||
|
||||
pub fn connect(&addr: &SocketAddr,
|
||||
handle: &Handle,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
extern crate futures;
|
||||
extern crate num_cpus;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
|
||||
use std::env;
|
||||
@@ -27,8 +27,8 @@ use futures::stream::Stream;
|
||||
use futures::sync::mpsc;
|
||||
use tokio_io::AsyncRead;
|
||||
use tokio_io::io::copy;
|
||||
use tokio_core::net::TcpStream;
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::reactor::Core;
|
||||
|
||||
fn main() {
|
||||
// First argument, the address to bind
|
||||
@@ -72,7 +72,7 @@ fn worker(rx: mpsc::UnboundedReceiver<net::TcpStream>) {
|
||||
let done = rx.for_each(move |socket| {
|
||||
// First up when we receive a socket we associate it with our event loop
|
||||
// using the `TcpStream::from_stream` API. After that the socket is not
|
||||
// a `tokio_core::net::TcpStream` meaning it's in nonblocking mode and
|
||||
// a `tokio::net::TcpStream` meaning it's in nonblocking mode and
|
||||
// ready to be used with Tokio
|
||||
let socket = TcpStream::from_stream(socket, &handle)
|
||||
.expect("failed to associate TCP stream");
|
||||
|
||||
@@ -12,14 +12,14 @@
|
||||
|
||||
extern crate futures;
|
||||
#[macro_use]
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
|
||||
use std::{env, io};
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use futures::{Future, Poll};
|
||||
use tokio_core::net::UdpSocket;
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio::net::UdpSocket;
|
||||
use tokio::reactor::Core;
|
||||
|
||||
struct Server {
|
||||
socket: UdpSocket,
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@
|
||||
//! should be able to see them all make progress simultaneously.
|
||||
|
||||
extern crate futures;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
|
||||
use std::env;
|
||||
@@ -28,8 +28,8 @@ use futures::Future;
|
||||
use futures::stream::Stream;
|
||||
use tokio_io::AsyncRead;
|
||||
use tokio_io::io::copy;
|
||||
use tokio_core::net::TcpListener;
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::reactor::Core;
|
||||
|
||||
fn main() {
|
||||
// Allow passing an address to listen on as the first argument of this
|
||||
|
||||
+3
-3
@@ -13,15 +13,15 @@
|
||||
|
||||
extern crate env_logger;
|
||||
extern crate futures;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
|
||||
use std::env;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use futures::stream::Stream;
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio_core::net::TcpListener;
|
||||
use tokio::reactor::Core;
|
||||
use tokio::net::TcpListener;
|
||||
|
||||
fn main() {
|
||||
env_logger::init().unwrap();
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
//! the echo server, and you'll be able to see data flowing between them.
|
||||
|
||||
extern crate futures;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
|
||||
use std::sync::Arc;
|
||||
@@ -27,8 +27,8 @@ use std::io::{self, Read, Write};
|
||||
|
||||
use futures::stream::Stream;
|
||||
use futures::{Future, Poll};
|
||||
use tokio_core::net::{TcpListener, TcpStream};
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use tokio::reactor::Core;
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use tokio_io::io::{copy, shutdown};
|
||||
|
||||
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
|
||||
extern crate env_logger;
|
||||
extern crate futures;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
|
||||
use std::env;
|
||||
@@ -27,8 +27,8 @@ use std::net::SocketAddr;
|
||||
use futures::Future;
|
||||
use futures::stream::{self, Stream};
|
||||
use tokio_io::IoFuture;
|
||||
use tokio_core::net::{TcpListener, TcpStream};
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio::net::{TcpListener, TcpStream};
|
||||
use tokio::reactor::Core;
|
||||
|
||||
fn main() {
|
||||
env_logger::init().unwrap();
|
||||
|
||||
+3
-3
@@ -40,7 +40,7 @@
|
||||
//! returning the previous value, if any.
|
||||
|
||||
extern crate futures;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
|
||||
use std::cell::RefCell;
|
||||
@@ -51,8 +51,8 @@ use std::env;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use futures::prelude::*;
|
||||
use tokio_core::net::TcpListener;
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::reactor::Core;
|
||||
use tokio_io::AsyncRead;
|
||||
use tokio_io::io::{lines, write_all};
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ extern crate num_cpus;
|
||||
extern crate serde_derive;
|
||||
extern crate serde_json;
|
||||
extern crate time;
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
extern crate tokio_io;
|
||||
|
||||
use std::env;
|
||||
@@ -35,8 +35,8 @@ use futures::sync::mpsc;
|
||||
use futures::{Stream, Future, Sink};
|
||||
use http::{Request, Response, StatusCode};
|
||||
use http::header::HeaderValue;
|
||||
use tokio_core::net::TcpStream;
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::reactor::Core;
|
||||
use tokio_io::codec::{Encoder, Decoder};
|
||||
use tokio_io::{AsyncRead};
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//! new message with a new destination. Overall, we then use this to construct a
|
||||
//! "ping pong" pair where two sockets are sending messages back and forth.
|
||||
|
||||
extern crate tokio_core;
|
||||
extern crate tokio;
|
||||
extern crate env_logger;
|
||||
extern crate futures;
|
||||
|
||||
@@ -14,8 +14,8 @@ use std::io;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
use futures::{Future, Stream, Sink};
|
||||
use tokio_core::net::{UdpSocket, UdpCodec};
|
||||
use tokio_core::reactor::Core;
|
||||
use tokio::net::{UdpSocket, UdpCodec};
|
||||
use tokio::reactor::Core;
|
||||
|
||||
pub struct LineCodec;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user