Huge overhaul of bytes

* Get rid of `ByteStr` trait
* `Bytes` is not a concrete type
* Add `BlockBuf`
* Delete lots of cruft
* Performance work
This commit is contained in:
Carl Lerche
2016-08-10 15:45:31 -07:00
parent b2efe63c70
commit 04e0ac75e2
31 changed files with 1630 additions and 1653 deletions
+1 -11
View File
@@ -1,5 +1,5 @@
use buf::{Buf, MutBuf};
use std::{cmp, io};
use std::{cmp};
#[derive(Debug)]
pub struct Take<T> {
@@ -52,16 +52,6 @@ impl<T: Buf> Buf for Take<T> {
}
}
impl<T: Buf> io::Read for Take<T> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
if !self.has_remaining() {
return Ok(0);
}
Ok(self.read_slice(buf))
}
}
impl<T: MutBuf> MutBuf for Take<T> {
fn remaining(&self) -> usize {
cmp::min(self.inner.remaining(), self.limit)