1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-27 07:19:04 +02:00

upgrade to tokio 0.2

This commit is contained in:
Nikolay Kim
2019-12-05 23:35:43 +06:00
parent b45c6cd66b
commit 205a964d8f
72 changed files with 764 additions and 555 deletions

View File

@ -1,7 +1,7 @@
use std::fmt::{self, Display, Write};
use std::str::FromStr;
use crate::header::{HeaderValue, IntoHeaderValue, InvalidHeaderValueBytes, Writer};
use crate::header::{HeaderValue, IntoHeaderValue, InvalidHeaderValue, Writer};
/// check that each char in the slice is either:
/// 1. `%x21`, or
@ -157,12 +157,12 @@ impl FromStr for EntityTag {
}
impl IntoHeaderValue for EntityTag {
type Error = InvalidHeaderValueBytes;
type Error = InvalidHeaderValue;
fn try_into(self) -> Result<HeaderValue, Self::Error> {
let mut wrt = Writer::new();
write!(wrt, "{}", self).unwrap();
HeaderValue::from_shared(wrt.take())
HeaderValue::from_maybe_shared(wrt.take())
}
}

View File

@ -3,8 +3,8 @@ use std::io::Write;
use std::str::FromStr;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use bytes::{BufMut, BytesMut};
use http::header::{HeaderValue, InvalidHeaderValueBytes};
use bytes::{buf::BufMutExt, BytesMut};
use http::header::{HeaderValue, InvalidHeaderValue};
use crate::error::ParseError;
use crate::header::IntoHeaderValue;
@ -58,12 +58,12 @@ impl From<SystemTime> for HttpDate {
}
impl IntoHeaderValue for HttpDate {
type Error = InvalidHeaderValueBytes;
type Error = InvalidHeaderValue;
fn try_into(self) -> Result<HeaderValue, Self::Error> {
let mut wrt = BytesMut::with_capacity(29).writer();
write!(wrt, "{}", self.0.rfc822()).unwrap();
HeaderValue::from_shared(wrt.get_mut().take().freeze())
HeaderValue::from_maybe_shared(wrt.get_mut().split().freeze())
}
}