mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-14 00:00:13 +02:00
Tweak Bytes helpers
This commit is contained in:
@@ -145,7 +145,7 @@ impl BlockBuf {
|
||||
|
||||
ret = Some(match ret.take() {
|
||||
Some(curr) => {
|
||||
curr.concat(&segment)
|
||||
curr.concat(segment)
|
||||
}
|
||||
None => segment,
|
||||
});
|
||||
|
||||
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user