Merge pull request #523 from hyperium/header-tm!
Rename tm! to __hyper__tm!, and export it, and rename deref!
This commit is contained in:
@@ -23,7 +23,7 @@ use header::parsing::{from_one_comma_delimited, fmt_comma_delimited};
|
|||||||
#[derive(PartialEq, Clone, Debug)]
|
#[derive(PartialEq, Clone, Debug)]
|
||||||
pub struct CacheControl(pub Vec<CacheDirective>);
|
pub struct CacheControl(pub Vec<CacheDirective>);
|
||||||
|
|
||||||
deref!(CacheControl => Vec<CacheDirective>);
|
__hyper__deref!(CacheControl => Vec<CacheDirective>);
|
||||||
|
|
||||||
impl Header for CacheControl {
|
impl Header for CacheControl {
|
||||||
fn header_name() -> &'static str {
|
fn header_name() -> &'static str {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use cookie::CookieJar;
|
|||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
pub struct Cookie(pub Vec<CookiePair>);
|
pub struct Cookie(pub Vec<CookiePair>);
|
||||||
|
|
||||||
deref!(Cookie => Vec<CookiePair>);
|
__hyper__deref!(Cookie => Vec<CookiePair>);
|
||||||
|
|
||||||
impl Header for Cookie {
|
impl Header for Cookie {
|
||||||
fn header_name() -> &'static str {
|
fn header_name() -> &'static str {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ macro_rules! bench_header(
|
|||||||
);
|
);
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! deref(
|
macro_rules! __hyper__deref {
|
||||||
($from:ty => $to:ty) => {
|
($from:ty => $to:ty) => {
|
||||||
impl ::std::ops::Deref for $from {
|
impl ::std::ops::Deref for $from {
|
||||||
type Target = $to;
|
type Target = $to;
|
||||||
@@ -96,9 +96,10 @@ macro_rules! deref(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
|
|
||||||
macro_rules! tm {
|
#[macro_export]
|
||||||
|
macro_rules! __hyper__tm {
|
||||||
($id:ident, $tm:ident{$($tf:item)*}) => {
|
($id:ident, $tm:ident{$($tf:item)*}) => {
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
mod $tm{
|
mod $tm{
|
||||||
@@ -165,7 +166,7 @@ macro_rules! header {
|
|||||||
$(#[$a])*
|
$(#[$a])*
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct $id(pub Vec<$item>);
|
pub struct $id(pub Vec<$item>);
|
||||||
deref!($id => Vec<$item>);
|
__hyper__deref!($id => Vec<$item>);
|
||||||
impl $crate::header::Header for $id {
|
impl $crate::header::Header for $id {
|
||||||
fn header_name() -> &'static str {
|
fn header_name() -> &'static str {
|
||||||
$n
|
$n
|
||||||
@@ -191,7 +192,7 @@ macro_rules! header {
|
|||||||
$(#[$a])*
|
$(#[$a])*
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct $id(pub Vec<$item>);
|
pub struct $id(pub Vec<$item>);
|
||||||
deref!($id => Vec<$item>);
|
__hyper__deref!($id => Vec<$item>);
|
||||||
impl $crate::header::Header for $id {
|
impl $crate::header::Header for $id {
|
||||||
fn header_name() -> &'static str {
|
fn header_name() -> &'static str {
|
||||||
$n
|
$n
|
||||||
@@ -217,7 +218,7 @@ macro_rules! header {
|
|||||||
$(#[$a])*
|
$(#[$a])*
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct $id(pub $value);
|
pub struct $id(pub $value);
|
||||||
deref!($id => $value);
|
__hyper__deref!($id => $value);
|
||||||
impl $crate::header::Header for $id {
|
impl $crate::header::Header for $id {
|
||||||
fn header_name() -> &'static str {
|
fn header_name() -> &'static str {
|
||||||
$n
|
$n
|
||||||
@@ -285,7 +286,7 @@ macro_rules! header {
|
|||||||
($id, $n) => ($item)*
|
($id, $n) => ($item)*
|
||||||
}
|
}
|
||||||
|
|
||||||
tm! { $id, $tm { $($tf)* }}
|
__hyper__tm! { $id, $tm { $($tf)* }}
|
||||||
};
|
};
|
||||||
($(#[$a:meta])*($id:ident, $n:expr) => ($item:ty)+ $tm:ident{$($tf:item)*}) => {
|
($(#[$a:meta])*($id:ident, $n:expr) => ($item:ty)+ $tm:ident{$($tf:item)*}) => {
|
||||||
header! {
|
header! {
|
||||||
@@ -293,7 +294,7 @@ macro_rules! header {
|
|||||||
($id, $n) => ($item)+
|
($id, $n) => ($item)+
|
||||||
}
|
}
|
||||||
|
|
||||||
tm! { $id, $tm { $($tf)* }}
|
__hyper__tm! { $id, $tm { $($tf)* }}
|
||||||
};
|
};
|
||||||
($(#[$a:meta])*($id:ident, $n:expr) => [$item:ty] $tm:ident{$($tf:item)*}) => {
|
($(#[$a:meta])*($id:ident, $n:expr) => [$item:ty] $tm:ident{$($tf:item)*}) => {
|
||||||
header! {
|
header! {
|
||||||
@@ -301,7 +302,7 @@ macro_rules! header {
|
|||||||
($id, $n) => [$item]
|
($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)*}) => {
|
($(#[$a:meta])*($id:ident, $n:expr) => {Any / ($item:ty)+} $tm:ident{$($tf:item)*}) => {
|
||||||
header! {
|
header! {
|
||||||
@@ -309,7 +310,7 @@ macro_rules! header {
|
|||||||
($id, $n) => {Any / ($item)+}
|
($id, $n) => {Any / ($item)+}
|
||||||
}
|
}
|
||||||
|
|
||||||
tm! { $id, $tm { $($tf)* }}
|
__hyper__tm! { $id, $tm { $($tf)* }}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ use cookie::CookieJar;
|
|||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
pub struct SetCookie(pub Vec<Cookie>);
|
pub struct SetCookie(pub Vec<Cookie>);
|
||||||
|
|
||||||
deref!(SetCookie => Vec<Cookie>);
|
__hyper__deref!(SetCookie => Vec<Cookie>);
|
||||||
|
|
||||||
impl Header for SetCookie {
|
impl Header for SetCookie {
|
||||||
fn header_name() -> &'static str {
|
fn header_name() -> &'static str {
|
||||||
|
|||||||
Reference in New Issue
Block a user