mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 16:02:59 +01:00
add HttpMessage impl &mut T
This commit is contained in:
parent
96477d42cb
commit
200cae19a9
@ -270,6 +270,37 @@ pub trait HttpMessage: Sized {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, T> HttpMessage for &'a mut T
|
||||||
|
where
|
||||||
|
T: HttpMessage,
|
||||||
|
{
|
||||||
|
type Stream = T::Stream;
|
||||||
|
|
||||||
|
fn headers(&self) -> &HeaderMap {
|
||||||
|
(**self).headers()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Mutable reference to the message's headers.
|
||||||
|
fn headers_mut(&mut self) -> &mut HeaderMap {
|
||||||
|
(**self).headers_mut()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Message payload stream
|
||||||
|
fn take_payload(&mut self) -> Payload<Self::Stream> {
|
||||||
|
(**self).take_payload()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Request's extensions container
|
||||||
|
fn extensions(&self) -> Ref<Extensions> {
|
||||||
|
(**self).extensions()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Mutable reference to a the request's extensions container
|
||||||
|
fn extensions_mut(&self) -> RefMut<Extensions> {
|
||||||
|
(**self).extensions_mut()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Stream to read request line by line.
|
/// Stream to read request line by line.
|
||||||
pub struct Readlines<T: HttpMessage> {
|
pub struct Readlines<T: HttpMessage> {
|
||||||
stream: Payload<T::Stream>,
|
stream: Payload<T::Stream>,
|
||||||
|
Loading…
Reference in New Issue
Block a user