pub struct CompactSchema { /* private fields */ }Expand description
Compact representation of a symbol table.
Uses string interning and delta encoding to minimize size.
Implementations§
Source§impl CompactSchema
impl CompactSchema
Sourcepub fn from_symbol_table(table: &SymbolTable) -> Self
pub fn from_symbol_table(table: &SymbolTable) -> Self
Create a compact schema from a symbol table.
§Example
use tensorlogic_adapters::{SymbolTable, DomainInfo, CompactSchema};
let mut table = SymbolTable::new();
table.add_domain(DomainInfo::new("Person", 100)).unwrap();
let compact = CompactSchema::from_symbol_table(&table);
let recovered = compact.to_symbol_table().unwrap();
assert_eq!(table.domains.len(), recovered.domains.len());Sourcepub fn to_symbol_table(&self) -> Result<SymbolTable>
pub fn to_symbol_table(&self) -> Result<SymbolTable>
Convert compact schema back to a symbol table.
Sourcepub fn from_binary(data: &[u8]) -> Result<Self>
pub fn from_binary(data: &[u8]) -> Result<Self>
Deserialize from compact binary format.
Sourcepub fn string_count(&self) -> usize
pub fn string_count(&self) -> usize
Get the number of unique strings.
Sourcepub fn compression_stats(&self) -> CompressionStats
pub fn compression_stats(&self) -> CompressionStats
Get statistics about compression.
Trait Implementations§
Source§impl Clone for CompactSchema
impl Clone for CompactSchema
Source§fn clone(&self) -> CompactSchema
fn clone(&self) -> CompactSchema
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 CompactSchema
impl Debug for CompactSchema
Source§impl<'de> Deserialize<'de> for CompactSchema
impl<'de> Deserialize<'de> for CompactSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CompactSchema
impl RefUnwindSafe for CompactSchema
impl Send for CompactSchema
impl Sync for CompactSchema
impl Unpin for CompactSchema
impl UnwindSafe for CompactSchema
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