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:
@@ -1,5 +1,5 @@
|
||||
use std::fmt::{self, Display};
|
||||
use header::{self, Header, HeaderFormat, EntityTag, HttpDate};
|
||||
use header::{self, Header, EntityTag, HttpDate};
|
||||
|
||||
/// `If-Range` header, defined in [RFC7233](http://tools.ietf.org/html/rfc7233#section-3.2)
|
||||
///
|
||||
@@ -59,18 +59,16 @@ impl Header for IfRange {
|
||||
}
|
||||
fn parse_header(raw: &[Vec<u8>]) -> ::Result<IfRange> {
|
||||
let etag: ::Result<EntityTag> = header::parsing::from_one_raw_str(raw);
|
||||
if etag.is_ok() {
|
||||
return Ok(IfRange::EntityTag(etag.unwrap()));
|
||||
if let Ok(etag) = etag {
|
||||
return Ok(IfRange::EntityTag(etag));
|
||||
}
|
||||
let date: ::Result<HttpDate> = header::parsing::from_one_raw_str(raw);
|
||||
if date.is_ok() {
|
||||
return Ok(IfRange::Date(date.unwrap()));
|
||||
if let Ok(date) = date {
|
||||
return Ok(IfRange::Date(date));
|
||||
}
|
||||
Err(::Error::Header)
|
||||
}
|
||||
}
|
||||
|
||||
impl HeaderFormat for IfRange {
|
||||
fn fmt_header(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
|
||||
match *self {
|
||||
IfRange::EntityTag(ref x) => Display::fmt(x, f),
|
||||
|
||||
Reference in New Issue
Block a user