Tweak Bytes helpers

This commit is contained in:
Carl Lerche
2016-10-14 20:42:16 -07:00
parent ec7d7f27fe
commit 8d2508bfeb
4 changed files with 15 additions and 8 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ impl BlockBuf {
ret = Some(match ret.take() {
Some(curr) => {
curr.concat(&segment)
curr.concat(segment)
}
None => segment,
});
+8 -2
View File
@@ -92,8 +92,14 @@ impl Bytes {
}
}
pub fn concat(&self, other: &Bytes) -> Bytes {
Rope::concat(self.clone(), other.clone())
/// Concatenate two `Bytes` together
pub fn concat(self, other: Bytes) -> Bytes {
Rope::concat(self, other)
}
/// Divide one `Bytes` into two at an index
pub fn split_at(self, mid: usize) -> (Bytes, Bytes) {
(self.slice_to(mid), self.slice_from(mid))
}
/// Returns a new ByteStr value containing the byte range between `begin`
+1
View File
@@ -29,6 +29,7 @@ pub mod buf {
pub use imp::buf::slice::SliceBuf;
pub use imp::buf::append::AppendBuf;
pub use imp::buf::block::{BlockBuf, BlockBufCursor};
pub use imp::buf::bound::{BoundBuf};
pub use imp::buf::ring::RingBuf;
pub use imp::buf::take::Take;
pub use imp::bytes::BytesBuf;