pub struct KeySerializer<'a, B: Buffer> { /* private fields */ }Expand description
Serializes keys sequentially into binary format suitable for lexicographical comparisons.
The key layout contains:
- A 2-byte Big-Endian length prefix specifying the size of the serialized data in bytes.
- The encoded variable-length binary key payload.
Implementations§
Source§impl<'a, B: Buffer> KeySerializer<'a, B>
impl<'a, B: Buffer> KeySerializer<'a, B>
Sourcepub fn new(buffer: &'a mut B, base: Option<u64>) -> Self
pub fn new(buffer: &'a mut B, base: Option<u64>) -> Self
Creates a new KeySerializer attached to a persistent storage buffer.
Sourcepub fn write_u64(&mut self, v: u64)
pub fn write_u64(&mut self, v: u64)
Writes an order-preserving varint encoded 64-bit payload to buffer. If a base was provided and this is the first u64, it writes the delta.
Sourcepub fn write_bytes(&mut self, bytes: &[u8])
pub fn write_bytes(&mut self, bytes: &[u8])
Writes fixed-length raw byte payloads into serialization buffer.
Sourcepub fn finalize(&mut self)
pub fn finalize(&mut self)
Resolves and writes the real key byte payload length to the two-byte prefix placeholder.
Sourcepub fn write_varint(&mut self, v: u64)
pub fn write_varint(&mut self, v: u64)
Writes an order-preserving varint encoded 64-bit payload to buffer.
Sourcepub fn write_last(&mut self, bytes: &[u8])
pub fn write_last(&mut self, bytes: &[u8])
Writes trailing variable-length dynamic strings or vectors to serialization buffer.
Trait Implementations§
Source§impl<B: Buffer> Drop for KeySerializer<'_, B>
impl<B: Buffer> Drop for KeySerializer<'_, B>
Auto Trait Implementations§
impl<'a, B> Freeze for KeySerializer<'a, B>
impl<'a, B> RefUnwindSafe for KeySerializer<'a, B>where
B: RefUnwindSafe,
impl<'a, B> Send for KeySerializer<'a, B>
impl<'a, B> Sync for KeySerializer<'a, B>where
B: Sync,
impl<'a, B> Unpin for KeySerializer<'a, B>
impl<'a, B> UnsafeUnpin for KeySerializer<'a, B>
impl<'a, B> !UnwindSafe for KeySerializer<'a, B>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more