pub enum PinnableSlice {
Pinned {
_block: Block,
value: Slice,
},
Owned(UserValue),
}Expand description
A value reference that may share the decompressed block buffer.
Use PinnableSlice::as_ref to access the raw bytes regardless of variant.
§Lifetime
The Pinned variant holds a [Block] clone whose data field is a
refcounted Slice. As long as the PinnableSlice is alive, the
decompressed block buffer remains valid. Dropping it releases the
reference count on the underlying ByteView allocation.
Variants§
Pinned
Value sharing the decompressed block buffer — zero copy.
The [Block] keeps the decompressed data alive via refcounted
Slice / ByteView. value is a sub-slice created via
Slice::slice, sharing the same backing allocation.
Fields
_block: BlockKeeps the decompressed block buffer alive via refcount.
Owned(UserValue)
Value owned independently (memtable, blob, merge result).
Implementations§
Source§impl PinnableSlice
impl PinnableSlice
Sourcepub fn pinned(block: Block, value: Slice) -> Self
pub fn pinned(block: Block, value: Slice) -> Self
Creates a pinned value sharing the decompressed block buffer.
Sourcepub fn is_pinned(&self) -> bool
pub fn is_pinned(&self) -> bool
Returns true if this value shares the decompressed block buffer.
Sourcepub fn into_value(self) -> UserValue
pub fn into_value(self) -> UserValue
Converts this PinnableSlice into an owned UserValue.
For the Pinned variant, the Block is dropped but the returned
Slice still shares the same ByteView backing allocation.
For the Owned variant, the value is returned directly.
Trait Implementations§
Source§impl AsRef<[u8]> for PinnableSlice
impl AsRef<[u8]> for PinnableSlice
Source§impl Clone for PinnableSlice
impl Clone for PinnableSlice
Source§fn clone(&self) -> PinnableSlice
fn clone(&self) -> PinnableSlice
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more