pub struct SharedStringTable { /* private fields */ }Expand description
Runtime shared string table for efficient string lookup and insertion.
Maintains both an ordered list of strings (for index-based lookup) and a reverse hash map (for deduplication when inserting). Also preserves rich text formatting information for round-tripping.
Implementations§
Sourcepub fn from_sst(sst: &Sst) -> Self
pub fn from_sst(sst: &Sst) -> Self
Build from an XML Sst struct.
Plain-text items use the t field directly. Rich-text items
concatenate all run texts.
Sourcepub fn add(&mut self, s: &str) -> usize
pub fn add(&mut self, s: &str) -> usize
Add a string, returning its index.
If the string already exists, the existing index is returned (dedup).
Sourcepub fn add_rich_text(&mut self, runs: &[RichTextRun]) -> usize
pub fn add_rich_text(&mut self, runs: &[RichTextRun]) -> usize
Add rich text runs, returning the SST index.
The plain-text concatenation of the runs is used for deduplication.
Sourcepub fn get_rich_text(&self, index: usize) -> Option<Vec<RichTextRun>>
pub fn get_rich_text(&self, index: usize) -> Option<Vec<RichTextRun>>
Get rich text runs for an SST entry, if it has formatting.
Returns None for plain-text entries.
Trait Implementations§
Auto Trait Implementations§
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