diff --git a/libsql-wal/src/io/buf.rs b/libsql-wal/src/io/buf.rs index 0a06be4cef..7b824287e4 100644 --- a/libsql-wal/src/io/buf.rs +++ b/libsql-wal/src/io/buf.rs @@ -154,6 +154,17 @@ impl ZeroCopyBoxIoBuf { Self { init: 0, inner } } + /// same as new_uninit, but partially fills the buffer starting at offset + /// + /// # Safety: The caller must ensure that the remaining bytes are initialized + pub unsafe fn new_uninit_partial(inner: Box, offset: usize) -> Self { + assert!(offset < size_of::()); + Self { + inner, + init: offset, + } + } + fn is_init(&self) -> bool { self.init == size_of::() }