Skip to content

Commit

Permalink
Merge pull request #128 from http-rs/upgrade-compile
Browse files Browse the repository at this point in the history
make it compile
  • Loading branch information
yoshuawuyts authored May 14, 2020
2 parents db030c5 + 22abcdf commit e8c7917
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,33 @@ cfg_unstable! {
use crate::upgrade;
}

#[cfg(not(feature = "unstable"))]
pin_project_lite::pin_project! {
/// An HTTP request.
///
/// # Examples
///
/// ```
/// use http_types::{Url, Method, Request};
///
/// let mut req = Request::new(Method::Get, Url::parse("https://example.com").unwrap());
/// req.set_body("Hello, Nori!");
/// ```
#[derive(Debug)]
pub struct Request {
method: Method,
url: Url,
headers: Headers,
version: Option<Version>,
trailers_sender: Option<sync::Sender<Trailers>>,
trailers_receiver: Option<sync::Receiver<Trailers>>,
#[pin]
body: Body,
local: TypeMap,
}
}

#[cfg(feature = "unstable")]
pin_project_lite::pin_project! {
/// An HTTP request.
///
Expand Down Expand Up @@ -69,7 +96,6 @@ impl Request {
#[cfg(not(feature = "unstable"))]
pub fn new(method: Method, url: Url) -> Self {
let (trailers_sender, trailers_receiver) = sync::channel(1);
let (upgrade_sender, upgrade_receiver) = sync::channel(1);
Self {
method,
url,
Expand Down Expand Up @@ -486,7 +512,9 @@ impl Clone for Request {
version: self.version.clone(),
trailers_sender: None,
trailers_receiver: None,
#[cfg(feature = "unstable")]
upgrade_sender: None,
#[cfg(feature = "unstable")]
upgrade_receiver: None,
body: Body::empty(),
local: TypeMap::new(),
Expand Down

0 comments on commit e8c7917

Please sign in to comment.