mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-19 06:00:38 +00:00
review: follow Buffer::extend_from_slice trait definition
panics if IoBufferMut does not enough capacity left to accomodate the source buffer. Signed-off-by: Yuchen Liang <yuchen@neon.tech>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
mod flush;
|
||||
use std::sync::Arc;
|
||||
|
||||
use bytes::BytesMut;
|
||||
use flush::FlushHandle;
|
||||
use tokio_epoll_uring::IoBuf;
|
||||
|
||||
@@ -218,6 +217,10 @@ impl Buffer for IoBufferMut {
|
||||
}
|
||||
|
||||
fn extend_from_slice(&mut self, other: &[u8]) {
|
||||
if self.len() + other.len() > self.cap() {
|
||||
panic!("Buffer capacity exceeded");
|
||||
}
|
||||
|
||||
IoBufferMut::extend_from_slice(self, other);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user