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:
Yuchen Liang
2024-12-02 16:07:57 +00:00
parent 9f384a8426
commit bf9a6d0f4c

View File

@@ -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);
}