Skip to main content

Module string_pool

Module string_pool 

Source
Expand description

String pooling utilities for memory-efficient string storage.

This module provides a string pool that deduplicates strings, reducing memory usage when many dictionary entries share the same surface forms or features.

§Examples

use mecab_ko_dict::string_pool::StringPool;

let mut pool = StringPool::new();

// Intern strings - identical strings return the same Arc
let s1 = pool.intern("안녕하세요");
let s2 = pool.intern("안녕하세요");

// s1 and s2 point to the same allocation
assert!(std::sync::Arc::ptr_eq(&s1, &s2));

// Check pool statistics
assert_eq!(pool.len(), 1);

Structs§

ConcurrentStringPool
Thread-safe string pool using a concurrent hashmap.
StringPool
A string pool that deduplicates strings using reference counting.
StringPoolStats
Statistics about a string pool.