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:
30
actix-framed/src/request.rs
Normal file
30
actix-framed/src/request.rs
Normal 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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user