mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-31 17:07:01 +02:00
upgrade to tokio 0.2
This commit is contained in:
@@ -80,12 +80,12 @@ impl fmt::Display for CacheControl {
|
||||
}
|
||||
|
||||
impl IntoHeaderValue for CacheControl {
|
||||
type Error = header::InvalidHeaderValueBytes;
|
||||
type Error = header::InvalidHeaderValue;
|
||||
|
||||
fn try_into(self) -> Result<header::HeaderValue, Self::Error> {
|
||||
let mut writer = Writer::new();
|
||||
let _ = write!(&mut writer, "{}", self);
|
||||
header::HeaderValue::from_shared(writer.take())
|
||||
header::HeaderValue::from_maybe_shared(writer.take())
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -462,12 +462,12 @@ impl ContentDisposition {
|
||||
}
|
||||
|
||||
impl IntoHeaderValue for ContentDisposition {
|
||||
type Error = header::InvalidHeaderValueBytes;
|
||||
type Error = header::InvalidHeaderValue;
|
||||
|
||||
fn try_into(self) -> Result<header::HeaderValue, Self::Error> {
|
||||
let mut writer = Writer::new();
|
||||
let _ = write!(&mut writer, "{}", self);
|
||||
header::HeaderValue::from_shared(writer.take())
|
||||
header::HeaderValue::from_maybe_shared(writer.take())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -768,9 +768,8 @@ mod tests {
|
||||
Mainstream browsers like Firefox (gecko) and Chrome use UTF-8 directly as above.
|
||||
(And now, only UTF-8 is handled by this implementation.)
|
||||
*/
|
||||
let a =
|
||||
HeaderValue::from_str("form-data; name=upload; filename=\"文件.webp\"")
|
||||
.unwrap();
|
||||
let a = HeaderValue::from_str("form-data; name=upload; filename=\"文件.webp\"")
|
||||
.unwrap();
|
||||
let a: ContentDisposition = ContentDisposition::from_raw(&a).unwrap();
|
||||
let b = ContentDisposition {
|
||||
disposition: DispositionType::FormData,
|
||||
@@ -884,7 +883,11 @@ mod tests {
|
||||
assert!(ContentDisposition::from_raw(&a).is_err());
|
||||
|
||||
let a = HeaderValue::from_static("inline; filename=\"\"");
|
||||
assert!(ContentDisposition::from_raw(&a).expect("parse cd").get_filename().expect("filename").is_empty());
|
||||
assert!(ContentDisposition::from_raw(&a)
|
||||
.expect("parse cd")
|
||||
.get_filename()
|
||||
.expect("filename")
|
||||
.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@@ -3,7 +3,7 @@ use std::str::FromStr;
|
||||
|
||||
use crate::error::ParseError;
|
||||
use crate::header::{
|
||||
HeaderValue, IntoHeaderValue, InvalidHeaderValueBytes, Writer, CONTENT_RANGE,
|
||||
HeaderValue, IntoHeaderValue, InvalidHeaderValue, Writer, CONTENT_RANGE,
|
||||
};
|
||||
|
||||
header! {
|
||||
@@ -198,11 +198,11 @@ impl Display for ContentRangeSpec {
|
||||
}
|
||||
|
||||
impl IntoHeaderValue for ContentRangeSpec {
|
||||
type Error = InvalidHeaderValueBytes;
|
||||
type Error = InvalidHeaderValue;
|
||||
|
||||
fn try_into(self) -> Result<HeaderValue, Self::Error> {
|
||||
let mut writer = Writer::new();
|
||||
let _ = write!(&mut writer, "{}", self);
|
||||
HeaderValue::from_shared(writer.take())
|
||||
HeaderValue::from_maybe_shared(writer.take())
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ use std::fmt::{self, Display, Write};
|
||||
use crate::error::ParseError;
|
||||
use crate::header::{
|
||||
self, from_one_raw_str, EntityTag, Header, HeaderName, HeaderValue, HttpDate,
|
||||
IntoHeaderValue, InvalidHeaderValueBytes, Writer,
|
||||
IntoHeaderValue, InvalidHeaderValue, Writer,
|
||||
};
|
||||
use crate::httpmessage::HttpMessage;
|
||||
|
||||
@@ -96,12 +96,12 @@ impl Display for IfRange {
|
||||
}
|
||||
|
||||
impl IntoHeaderValue for IfRange {
|
||||
type Error = InvalidHeaderValueBytes;
|
||||
type Error = InvalidHeaderValue;
|
||||
|
||||
fn try_into(self) -> Result<HeaderValue, Self::Error> {
|
||||
let mut writer = Writer::new();
|
||||
let _ = write!(&mut writer, "{}", self);
|
||||
HeaderValue::from_shared(writer.take())
|
||||
HeaderValue::from_maybe_shared(writer.take())
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -164,13 +164,13 @@ macro_rules! header {
|
||||
}
|
||||
}
|
||||
impl $crate::http::header::IntoHeaderValue for $id {
|
||||
type Error = $crate::http::header::InvalidHeaderValueBytes;
|
||||
type Error = $crate::http::header::InvalidHeaderValue;
|
||||
|
||||
fn try_into(self) -> Result<$crate::http::header::HeaderValue, Self::Error> {
|
||||
use std::fmt::Write;
|
||||
let mut writer = $crate::http::header::Writer::new();
|
||||
let _ = write!(&mut writer, "{}", self);
|
||||
$crate::http::header::HeaderValue::from_shared(writer.take())
|
||||
$crate::http::header::HeaderValue::from_maybe_shared(writer.take())
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -200,13 +200,13 @@ macro_rules! header {
|
||||
}
|
||||
}
|
||||
impl $crate::http::header::IntoHeaderValue for $id {
|
||||
type Error = $crate::http::header::InvalidHeaderValueBytes;
|
||||
type Error = $crate::http::header::InvalidHeaderValue;
|
||||
|
||||
fn try_into(self) -> Result<$crate::http::header::HeaderValue, Self::Error> {
|
||||
use std::fmt::Write;
|
||||
let mut writer = $crate::http::header::Writer::new();
|
||||
let _ = write!(&mut writer, "{}", self);
|
||||
$crate::http::header::HeaderValue::from_shared(writer.take())
|
||||
$crate::http::header::HeaderValue::from_maybe_shared(writer.take())
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -236,7 +236,7 @@ macro_rules! header {
|
||||
}
|
||||
}
|
||||
impl $crate::http::header::IntoHeaderValue for $id {
|
||||
type Error = $crate::http::header::InvalidHeaderValueBytes;
|
||||
type Error = $crate::http::header::InvalidHeaderValue;
|
||||
|
||||
fn try_into(self) -> Result<$crate::http::header::HeaderValue, Self::Error> {
|
||||
self.0.try_into()
|
||||
@@ -285,13 +285,13 @@ macro_rules! header {
|
||||
}
|
||||
}
|
||||
impl $crate::http::header::IntoHeaderValue for $id {
|
||||
type Error = $crate::http::header::InvalidHeaderValueBytes;
|
||||
type Error = $crate::http::header::InvalidHeaderValue;
|
||||
|
||||
fn try_into(self) -> Result<$crate::http::header::HeaderValue, Self::Error> {
|
||||
use std::fmt::Write;
|
||||
let mut writer = $crate::http::header::Writer::new();
|
||||
let _ = write!(&mut writer, "{}", self);
|
||||
$crate::http::header::HeaderValue::from_shared(writer.take())
|
||||
$crate::http::header::HeaderValue::from_maybe_shared(writer.take())
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user