mod.rs
Rust test marker or harnessimports http
SHA-256d86a9d05c4aa75e3af6132f9bfda4d62a752c6d591fc811c0cd66551b12042ce
MaleculeH₂(Cm₃Db)Md₂(InPa)
Evidence
18:9… need to define a custom header, it's easy to do while still taking
19//! advantage of the type system. Hyper includes a `header!` macro for defining
20//! many wrapper-style headers.
21//!
22//! ```
23//! #[macro_use] extern crate hyper;
24//! use hyper::header::Headers;
25//! header! { (XRequestGuid, "X-Request-Guid") => [String] }
26//!
27//! fn main () {
28//! let mut headers = Hea …
75:26… alue)
76//! }
77//! }
78//! ```
79use std::borrow::{Cow, ToOwned};
80#[cfg(feature = "compat")]
81use std::convert::From;
82use std::iter::{FromIterator, IntoIterator};
83use std::{mem, fmt};
84
85#[cfg(feature = "compat")]
86use http;
87
88use unicase::Ascii;
89
90use self::internals::{Item, VecMap, Entry};
91use self::sealed::HeaderClone;
92
93pub use self::shared::*;
94pub use self::common::*;
95pub use self::raw::Raw;
96use bytes::Bytes;
97
98mod common;
⋯7 lines
285:17… wncast_ref_unchecked<T: 'static>(&self) -> &T {
286 &*(mem::transmute::<*const _, (*const (), *const ())>(self).0 as *const T)
287 }
288
289 #[inline]
290 unsafe fn downcast_mut_unchecked<T: 'static>(&mut self) -> &mut T {
291 &mut * …
339:49… ying {:?}", s);
340 Cow::Owned(s.to_owned())
341 }
342
343 #[test]
344 fn test_literal_lens() {
345 $(
⋯5 lines
⋯4 lines
742}
743
744#[cfg(test)]
745mod tests {
746 use std::fmt;
747 use super::{Headers, Header, Raw, ContentLength, ContentType, Host, SetCookie};
748
749 #[cfg(feature = "nightly")]
750 use test::Bencher;
751
752 macro_rules! make_header {
753 ($name:expr, $value:expr) => ({
754 let mut he …