1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

add actix-framed

This commit is contained in:
Nikolay Kim
2019-04-10 15:06:27 -07:00
parent 52aebb3bca
commit 8dc4a88aa6
11 changed files with 909 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
use actix_codec::Framed;
use actix_http::{h1::Codec, Request};
use crate::state::State;
pub struct FramedRequest<Io, S = ()> {
req: Request,
framed: Framed<Io, Codec>,
state: State<S>,
}
impl<Io, S> FramedRequest<Io, S> {
pub fn new(req: Request, framed: Framed<Io, Codec>, state: State<S>) -> Self {
Self { req, framed, state }
}
}
impl<Io, S> FramedRequest<Io, S> {
pub fn request(&self) -> &Request {
&self.req
}
pub fn request_mut(&mut self) -> &mut Request {
&mut self.req
}
pub fn into_parts(self) -> (Request, Framed<Io, Codec>, State<S>) {
(self.req, self.framed, self.state)
}
}