pub struct PoolSnapshot {
pub strings: Vec<String>,
}Expand description
A serializable snapshot of a StringPool.
Can be used to persist the pool to disk or transfer it across processes.
Fields§
§strings: Vec<String>The interned strings, in index order.
Implementations§
Source§impl PoolSnapshot
impl PoolSnapshot
Sourcepub fn get(&self, id: InternedString) -> Option<&str>
pub fn get(&self, id: InternedString) -> Option<&str>
Get a string by its interned index.
Sourcepub fn restore(&self) -> StringPool
pub fn restore(&self) -> StringPool
Restore a StringPool from this snapshot.
Sourcepub fn total_bytes(&self) -> usize
pub fn total_bytes(&self) -> usize
Total bytes of string data in the snapshot.
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Encode the snapshot as a single byte vector (length-prefixed strings).
Sourcepub fn decode(data: &[u8]) -> Option<Self>
pub fn decode(data: &[u8]) -> Option<Self>
Decode a snapshot from bytes produced by Self::encode.
Trait Implementations§
Source§impl Clone for PoolSnapshot
impl Clone for PoolSnapshot
Source§fn clone(&self) -> PoolSnapshot
fn clone(&self) -> PoolSnapshot
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PoolSnapshot
impl Debug for PoolSnapshot
Source§impl PartialEq for PoolSnapshot
impl PartialEq for PoolSnapshot
impl Eq for PoolSnapshot
impl StructuralPartialEq for PoolSnapshot
Auto Trait Implementations§
impl Freeze for PoolSnapshot
impl RefUnwindSafe for PoolSnapshot
impl Send for PoolSnapshot
impl Sync for PoolSnapshot
impl Unpin for PoolSnapshot
impl UnsafeUnpin for PoolSnapshot
impl UnwindSafe for PoolSnapshot
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