pub struct PathTrie { /* private fields */ }Expand description
Path Trie for O(|path|) TOON path resolution
Implementations§
Source§impl PathTrie
impl PathTrie
Sourcepub fn insert(&mut self, path: &str, column_type: ColumnType) -> ColumnId
pub fn insert(&mut self, path: &str, column_type: ColumnType) -> ColumnId
Insert a path and get its column ID
Path format: “users.profile.settings.theme” Returns the assigned column ID
Sourcepub fn resolve(&self, path: &str) -> Option<ColumnId>
pub fn resolve(&self, path: &str) -> Option<ColumnId>
Resolve a path to its column ID in O(|path|) time
Returns None if path doesn’t exist
Sourcepub fn resolve_with_type(&self, path: &str) -> Option<(ColumnId, ColumnType)>
pub fn resolve_with_type(&self, path: &str) -> Option<(ColumnId, ColumnType)>
Resolve with type information
Sourcepub fn prefix_match(&self, prefix: &str) -> Vec<(String, ColumnId)>
pub fn prefix_match(&self, prefix: &str) -> Vec<(String, ColumnId)>
Get all paths that start with a prefix
Useful for wildcard queries like “users.profile.*”
Sourcepub fn total_columns(&self) -> u32
pub fn total_columns(&self) -> u32
Get total number of columns
Sourcepub fn total_nodes(&self) -> usize
pub fn total_nodes(&self) -> usize
Get total number of nodes (memory usage indicator)
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Estimate memory usage in bytes
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PathTrie
impl<'de> Deserialize<'de> for PathTrie
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 PathTrie
impl RefUnwindSafe for PathTrie
impl Send for PathTrie
impl Sync for PathTrie
impl Unpin for PathTrie
impl UnwindSafe for PathTrie
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more