diff --git a/src/header/mod.rs b/src/header/mod.rs index 432d7ab6..27b66172 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -83,7 +83,7 @@ use std::{mem, fmt}; use unicase::Ascii; use self::internals::{Item, VecMap, Entry}; -use self::sealed::{GetType, HeaderClone}; +use self::sealed::HeaderClone; pub use self::shared::*; pub use self::common::*; @@ -101,7 +101,7 @@ pub mod parsing; /// /// This trait represents the construction and identification of headers, /// and contains trait-object unsafe methods. -pub trait Header: HeaderClone + GetType + Send + Sync { +pub trait Header: 'static + HeaderClone + Send + Sync { /// Returns the name of the header field this belongs to. /// /// This will become an associated constant once available. @@ -132,19 +132,8 @@ pub trait Header: HeaderClone + GetType + Send + Sync { } mod sealed { - use std::any::{Any, TypeId}; use super::Header; - #[doc(hidden)] - pub trait GetType: Any { - #[inline(always)] - fn get_type(&self) -> TypeId { - TypeId::of::() - } - } - - impl GetType for T {} - #[doc(hidden)] pub trait HeaderClone { fn clone_box(&self) -> Box
; @@ -156,23 +145,6 @@ mod sealed { Box::new(self.clone()) } } - - #[test] - fn test_get_type() { - use ::header::{ContentLength, UserAgent}; - - let len = ContentLength(5); - let agent = UserAgent::new("hyper"); - - assert_eq!(TypeId::of::(), len.get_type()); - assert_eq!(TypeId::of::(), agent.get_type()); - - let len: Box
= Box::new(len); - let agent: Box
= Box::new(agent); - - assert_eq!(TypeId::of::(), (*len).get_type()); - assert_eq!(TypeId::of::(), (*agent).get_type()); - } }