mirror of
https://github.com/actix/actix-web.git
synced 2024-12-27 02:20:33 +00:00
add deref for payload item
This commit is contained in:
parent
afeecea05f
commit
e9bfab8012
1 changed files with 15 additions and 0 deletions
|
@ -2,6 +2,7 @@ use std::{fmt, cmp};
|
|||
use std::rc::{Rc, Weak};
|
||||
use std::cell::RefCell;
|
||||
use std::collections::VecDeque;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use futures::{Async, Poll, Stream};
|
||||
use futures::task::{Task, current as current_task};
|
||||
|
@ -20,6 +21,20 @@ impl ResponseType for PayloadItem {
|
|||
type Error = ();
|
||||
}
|
||||
|
||||
impl Deref for PayloadItem {
|
||||
type Target = Bytes;
|
||||
|
||||
fn deref(&self) -> &Bytes {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut for PayloadItem {
|
||||
fn deref_mut(&mut self) -> &mut Bytes {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for PayloadItem {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt::Debug::fmt(&self.0, f)
|
||||
|
|
Loading…
Reference in a new issue