mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-16 00:00:15 +02:00
committed by
Carl Lerche
parent
d0d27bd540
commit
f693e038d9
+3
-2
@@ -407,12 +407,13 @@ impl<'a> Sink for &'a mut Vec<u8> {
|
||||
self.clear();
|
||||
|
||||
let rem = buf.remaining();
|
||||
let cap = self.capacity();
|
||||
|
||||
// Ensure that the vec is big enough
|
||||
if rem > self.capacity() {
|
||||
self.reserve(rem - cap);
|
||||
// current length is 0, so reserve completely
|
||||
self.reserve(rem);
|
||||
}
|
||||
debug_assert!(rem <= self.capacity());
|
||||
|
||||
unsafe {
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user