feat(lib): switch to non-blocking (asynchronous) IO
BREAKING CHANGE: This breaks a lot of the Client and Server APIs. Check the documentation for how Handlers can be used for asynchronous events.
This commit is contained in:
@@ -66,7 +66,7 @@ macro_rules! bench_header(
|
||||
use test::Bencher;
|
||||
use super::*;
|
||||
|
||||
use header::{Header, HeaderFormatter};
|
||||
use header::{Header};
|
||||
|
||||
#[bench]
|
||||
fn bench_parse(b: &mut Bencher) {
|
||||
@@ -79,7 +79,7 @@ macro_rules! bench_header(
|
||||
#[bench]
|
||||
fn bench_format(b: &mut Bencher) {
|
||||
let val: $ty = Header::parse_header(&$value[..]).unwrap();
|
||||
let fmt = HeaderFormatter(&val);
|
||||
let fmt = ::header::HeaderFormatter(&val);
|
||||
b.iter(|| {
|
||||
format!("{}", fmt);
|
||||
});
|
||||
@@ -222,15 +222,13 @@ macro_rules! header {
|
||||
fn parse_header(raw: &[Vec<u8>]) -> $crate::Result<Self> {
|
||||
$crate::header::parsing::from_comma_delimited(raw).map($id)
|
||||
}
|
||||
}
|
||||
impl $crate::header::HeaderFormat for $id {
|
||||
fn fmt_header(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
$crate::header::parsing::fmt_comma_delimited(f, &self.0[..])
|
||||
}
|
||||
}
|
||||
impl ::std::fmt::Display for $id {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
use $crate::header::HeaderFormat;
|
||||
use $crate::header::Header;
|
||||
self.fmt_header(f)
|
||||
}
|
||||
}
|
||||
@@ -250,15 +248,13 @@ macro_rules! header {
|
||||
fn parse_header(raw: &[Vec<u8>]) -> $crate::Result<Self> {
|
||||
$crate::header::parsing::from_comma_delimited(raw).map($id)
|
||||
}
|
||||
}
|
||||
impl $crate::header::HeaderFormat for $id {
|
||||
fn fmt_header(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
$crate::header::parsing::fmt_comma_delimited(f, &self.0[..])
|
||||
}
|
||||
}
|
||||
impl ::std::fmt::Display for $id {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
use $crate::header::HeaderFormat;
|
||||
use $crate::header::Header;
|
||||
self.fmt_header(f)
|
||||
}
|
||||
}
|
||||
@@ -277,8 +273,6 @@ macro_rules! header {
|
||||
fn parse_header(raw: &[Vec<u8>]) -> $crate::Result<Self> {
|
||||
$crate::header::parsing::from_one_raw_str(raw).map($id)
|
||||
}
|
||||
}
|
||||
impl $crate::header::HeaderFormat for $id {
|
||||
fn fmt_header(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
::std::fmt::Display::fmt(&**self, f)
|
||||
}
|
||||
@@ -313,8 +307,6 @@ macro_rules! header {
|
||||
}
|
||||
$crate::header::parsing::from_comma_delimited(raw).map($id::Items)
|
||||
}
|
||||
}
|
||||
impl $crate::header::HeaderFormat for $id {
|
||||
fn fmt_header(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
match *self {
|
||||
$id::Any => f.write_str("*"),
|
||||
@@ -325,7 +317,7 @@ macro_rules! header {
|
||||
}
|
||||
impl ::std::fmt::Display for $id {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
use $crate::header::HeaderFormat;
|
||||
use $crate::header::Header;
|
||||
self.fmt_header(f)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user