Misc renames (#202)

This patch renames a number of types and functions making
the API more consistent.

* `Server` -> `Connection`
* `Client` -> `SendRequest`
* `Respond` -> `SendResponse`.

It also moves the handshake fns off of `Connection` and make
them free fns in the module. And `Connection::builder` is removed
in favor of `Builder::new`.
This commit is contained in:
Carl Lerche
2018-01-02 17:02:17 -08:00
committed by GitHub
parent 26e7a2d416
commit d0b5b6246a
17 changed files with 299 additions and 306 deletions

View File

@@ -8,7 +8,7 @@ extern crate tokio_core;
extern crate tokio_rustls;
extern crate webpki_roots;
use h2::client::Client;
use h2::client;
use futures::*;
use http::{Method, Request};
@@ -64,7 +64,7 @@ pub fn main() {
let tls = io_dump::Dump::to_stdout(tls);
println!("Starting client handshake");
Client::handshake(tls)
client::handshake(tls)
})
.then(|res| {
let (mut client, h2) = res.unwrap();

View File

@@ -5,7 +5,7 @@ extern crate http;
extern crate io_dump;
extern crate tokio_core;
use h2::client::{Client};
use h2::client;
use h2::RecvStream;
use futures::*;
@@ -55,7 +55,7 @@ pub fn main() {
let tcp = tcp.then(|res| {
let tcp = io_dump::Dump::to_stdout(res.unwrap());
Client::handshake(tcp)
client::handshake(tcp)
}).then(|res| {
let (mut client, h2) = res.unwrap();

View File

@@ -5,7 +5,7 @@ extern crate h2;
extern crate http;
extern crate tokio_core;
use h2::server::Server;
use h2::server;
use bytes::*;
use futures::*;
@@ -28,7 +28,7 @@ pub fn main() {
// let socket = io_dump::Dump::to_stdout(socket);
let connection = Server::handshake(socket)
let connection = server::handshake(socket)
.and_then(|conn| {
println!("H2 connection bound");

View File

@@ -5,7 +5,7 @@ extern crate h2;
extern crate http;
extern crate tokio_core;
use h2::server::Server;
use h2::server;
use bytes::*;
use futures::*;
@@ -27,7 +27,7 @@ pub fn main() {
let server = listener.incoming().for_each(move |(socket, _)| {
// let socket = io_dump::Dump::to_stdout(socket);
let connection = Server::handshake(socket)
let connection = server::handshake(socket)
.and_then(|conn| {
println!("H2 connection bound");