pub struct StringTable { /* private fields */ }Expand description
A table of deduplicated strings read from String records in the binlog stream.
Strings are appended in the order they appear (each String record gets the
next sequential index starting at [STRING_START_INDEX]). Event payloads
reference strings by index.
Implementations§
Source§impl StringTable
impl StringTable
Sourcepub fn add(&mut self, value: String) -> i32
pub fn add(&mut self, value: String) -> i32
Add a string record. Returns the index assigned to it.
Sourcepub fn get(&self, index: i32) -> Result<Option<&str>, MuninError>
pub fn get(&self, index: i32) -> Result<Option<&str>, MuninError>
Look up a string by its on-disk index.
- Index 0 →
Ok(None)(null) - Index 1 →
Ok(Some(""))(empty) - Index 2–9 →
Err(InvalidIndex)(reserved, not yet assigned meaning) - Index ≥ 10 → lookup in the table
Sourcepub fn entries_mut(&mut self) -> &mut [String]
pub fn entries_mut(&mut self) -> &mut [String]
Mutably borrow the stored strings in insertion (index) order.
Provided for in-place rewrites that must preserve indices (e.g.
crate::redact). Replacing an entry’s contents keeps every
existing string-index reference valid, since indices are positional.
Trait Implementations§
Source§impl Debug for StringTable
impl Debug for StringTable
Source§impl Default for StringTable
impl Default for StringTable
Source§fn default() -> StringTable
fn default() -> StringTable
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StringTable
impl RefUnwindSafe for StringTable
impl Send for StringTable
impl Sync for StringTable
impl Unpin for StringTable
impl UnsafeUnpin for StringTable
impl UnwindSafe for StringTable
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