1
0
Fork 0
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:
Nikolay Kim 2017-11-28 19:51:39 -08:00
parent afeecea05f
commit e9bfab8012

View file

@ -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)