Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unnecessary pin project #410

Merged
merged 1 commit into from
Mar 2, 2020
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
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ serde = "1.0.102"
serde_json = "1.0.41"
serde_qs = "0.5.0"
async-std = { version = "1.0.1", features = ["unstable"] }
pin-project-lite = "0.1.0"
mime = "0.3.14"
cookie = { version="0.12.0", features = ["percent-encode"]}

Expand Down
31 changes: 14 additions & 17 deletions src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,18 @@ use std::{str::FromStr, sync::Arc};
use crate::error::Error;
use crate::middleware::cookies::CookieData;

pin_project_lite::pin_project! {
/// An HTTP request.
///
/// The `Request` gives endpoints access to basic information about the incoming
/// request, route parameters, and various ways of accessing the request's body.
///
/// Requests also provide *extensions*, a type map primarily used for low-level
/// communication between middleware and endpoints.
#[derive(Debug)]
pub struct Request<State> {
pub(crate) state: Arc<State>,
#[pin]
pub(crate) request: http_service::Request,
pub(crate) route_params: Vec<Params>,
}
/// An HTTP request.
///
/// The `Request` gives endpoints access to basic information about the incoming
/// request, route parameters, and various ways of accessing the request's body.
///
/// Requests also provide *extensions*, a type map primarily used for low-level
/// communication between middleware and endpoints.
#[derive(Debug)]
pub struct Request<State> {
pub(crate) state: Arc<State>,
pub(crate) request: http_service::Request,
pub(crate) route_params: Vec<Params>,
}

impl<State> Request<State> {
Expand Down Expand Up @@ -311,11 +308,11 @@ impl<State> Request<State> {

impl<State> Read for Request<State> {
fn poll_read(
self: Pin<&mut Self>,
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &mut [u8],
) -> Poll<io::Result<usize>> {
let mut this = self.project();
let this = &mut *self;
Pin::new(this.request.body_mut()).poll_read(cx, buf)
}
}