Bytes reader should be Send

This commit is contained in:
Carl Lerche
2016-06-19 21:32:18 +01:00
parent 270d2e2844
commit 3ca009577b
4 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -295,7 +295,7 @@ impl<T: io::Write> WriteExt for T {
* *
*/ */
impl Buf for Box<Buf+'static> { impl Buf for Box<Buf+Send+'static> {
fn remaining(&self) -> usize { fn remaining(&self) -> usize {
(**self).remaining() (**self).remaining()
} }
@@ -313,7 +313,7 @@ impl Buf for Box<Buf+'static> {
} }
} }
impl fmt::Debug for Box<Buf+'static> { impl fmt::Debug for Box<Buf+Send+'static> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "Box<Buf> {{ remaining: {} }}", self.remaining()) write!(fmt, "Box<Buf> {{ remaining: {} }}", self.remaining())
} }
@@ -409,7 +409,7 @@ macro_rules! impl_read {
impl_read!(ByteBuf); impl_read!(ByteBuf);
impl_read!(ROByteBuf); impl_read!(ROByteBuf);
impl_read!(RopeBuf); impl_read!(RopeBuf);
impl_read!(Box<Buf+'static>); impl_read!(Box<Buf+Send+'static>);
macro_rules! impl_write { macro_rules! impl_write {
($ty:ty) => { ($ty:ty) => {
+4 -4
View File
@@ -132,9 +132,9 @@ fn inline<B: ByteStr>() -> bool {
impl ByteStr for Bytes { impl ByteStr for Bytes {
type Buf = Box<Buf+'static>; type Buf = Box<Buf+Send+'static>;
fn buf(&self) -> Box<Buf+'static> { fn buf(&self) -> Box<Buf+Send+'static> {
self.obj().buf() self.obj().buf()
} }
@@ -200,7 +200,7 @@ unsafe impl Sync for Bytes { }
trait ByteStrPriv { trait ByteStrPriv {
fn buf(&self) -> Box<Buf+'static>; fn buf(&self) -> Box<Buf+Send+'static>;
fn clone(&self) -> Bytes; fn clone(&self) -> Bytes;
@@ -221,7 +221,7 @@ trait ByteStrPriv {
impl<B: ByteStr> ByteStrPriv for B { impl<B: ByteStr> ByteStrPriv for B {
fn buf(&self) -> Box<Buf+'static> { fn buf(&self) -> Box<Buf+Send+'static> {
Box::new(self.buf()) Box::new(self.buf())
} }
+1 -1
View File
@@ -18,7 +18,7 @@ use std::any::Any;
pub trait ByteStr : Clone + Sized + Send + Sync + Any + ToBytes + ops::Index<usize, Output=u8> + 'static { pub trait ByteStr : Clone + Sized + Send + Sync + Any + ToBytes + ops::Index<usize, Output=u8> + 'static {
// Until HKT lands, the buf must be bound by 'static // Until HKT lands, the buf must be bound by 'static
type Buf: Buf+'static; type Buf: Buf+Send+'static;
/// Returns a read-only `Buf` for accessing the byte contents of the /// Returns a read-only `Buf` for accessing the byte contents of the
/// `ByteStr`. /// `ByteStr`.
+1 -1
View File
@@ -294,7 +294,7 @@ pub struct RopeBuf {
// escape (which it shouldn't) it is safe. Doing this properly would // escape (which it shouldn't) it is safe. Doing this properly would
// require HKT. // require HKT.
pieces: PieceIter<'static>, pieces: PieceIter<'static>,
leaf_buf: Option<Box<Buf+'static>>, leaf_buf: Option<Box<Buf+Send+'static>>,
} }
impl RopeBuf { impl RopeBuf {