pub fn ensure_buf_size(buf: &mut BytesMut, required_size: usize)
Ensure the buffer is large enough to hold the data