Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/header/common/cache_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use header::parsing::{from_one_comma_delimited, fmt_comma_delimited};
#[derive(PartialEq, Clone, Debug)]
pub struct CacheControl(pub Vec<CacheDirective>);

deref!(CacheControl => Vec<CacheDirective>);
__hyper__deref!(CacheControl => Vec<CacheDirective>);

impl Header for CacheControl {
fn header_name() -> &'static str {
Expand Down
2 changes: 1 addition & 1 deletion src/header/common/cookie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use cookie::CookieJar;
#[derive(Clone, PartialEq, Debug)]
pub struct Cookie(pub Vec<CookiePair>);

deref!(Cookie => Vec<CookiePair>);
__hyper__deref!(Cookie => Vec<CookiePair>);

impl Header for Cookie {
fn header_name() -> &'static str {
Expand Down
21 changes: 11 additions & 10 deletions src/header/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ macro_rules! bench_header(
);

#[macro_export]
macro_rules! deref(
macro_rules! __hyper__deref {
($from:ty => $to:ty) => {
impl ::std::ops::Deref for $from {
type Target = $to;
Expand All @@ -96,9 +96,10 @@ macro_rules! deref(
}
}
}
);
}

macro_rules! tm {
#[macro_export]
macro_rules! __hyper__tm {
($id:ident, $tm:ident{$($tf:item)*}) => {
#[allow(unused_imports)]
mod $tm{
Expand Down Expand Up @@ -165,7 +166,7 @@ macro_rules! header {
$(#[$a])*
#[derive(Clone, Debug, PartialEq)]
pub struct $id(pub Vec<$item>);
deref!($id => Vec<$item>);
__hyper__deref!($id => Vec<$item>);
impl $crate::header::Header for $id {
fn header_name() -> &'static str {
$n
Expand All @@ -191,7 +192,7 @@ macro_rules! header {
$(#[$a])*
#[derive(Clone, Debug, PartialEq)]
pub struct $id(pub Vec<$item>);
deref!($id => Vec<$item>);
__hyper__deref!($id => Vec<$item>);
impl $crate::header::Header for $id {
fn header_name() -> &'static str {
$n
Expand All @@ -217,7 +218,7 @@ macro_rules! header {
$(#[$a])*
#[derive(Clone, Debug, PartialEq)]
pub struct $id(pub $value);
deref!($id => $value);
__hyper__deref!($id => $value);
impl $crate::header::Header for $id {
fn header_name() -> &'static str {
$n
Expand Down Expand Up @@ -285,31 +286,31 @@ macro_rules! header {
($id, $n) => ($item)*
}

tm! { $id, $tm { $($tf)* }}
__hyper__tm! { $id, $tm { $($tf)* }}
};
($(#[$a:meta])*($id:ident, $n:expr) => ($item:ty)+ $tm:ident{$($tf:item)*}) => {
header! {
$(#[$a])*
($id, $n) => ($item)+
}

tm! { $id, $tm { $($tf)* }}
__hyper__tm! { $id, $tm { $($tf)* }}
};
($(#[$a:meta])*($id:ident, $n:expr) => [$item:ty] $tm:ident{$($tf:item)*}) => {
header! {
$(#[$a])*
($id, $n) => [$item]
}

tm! { $id, $tm { $($tf)* }}
__hyper__tm! { $id, $tm { $($tf)* }}
};
($(#[$a:meta])*($id:ident, $n:expr) => {Any / ($item:ty)+} $tm:ident{$($tf:item)*}) => {
header! {
$(#[$a])*
($id, $n) => {Any / ($item)+}
}

tm! { $id, $tm { $($tf)* }}
__hyper__tm! { $id, $tm { $($tf)* }}
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/header/common/set_cookie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use cookie::CookieJar;
#[derive(Clone, PartialEq, Debug)]
pub struct SetCookie(pub Vec<Cookie>);

deref!(SetCookie => Vec<Cookie>);
__hyper__deref!(SetCookie => Vec<Cookie>);

impl Header for SetCookie {
fn header_name() -> &'static str {
Expand Down