pub struct KeyDictionary { /* private fields */ }Expand description
An append-only field-name↔id catalogue for one document collection.
Ids are dense, assigned 0, 1, 2, … in interning order, and never reused.
Implementations§
Source§impl KeyDictionary
impl KeyDictionary
Sourcepub fn intern(&mut self, name: &str) -> u32
pub fn intern(&mut self, name: &str) -> u32
Intern name, returning its (stable) id.
If name is already present its existing id is returned and nothing is
appended; otherwise a new id is assigned at the end of the catalogue.
This is the transactional append used by the write path when it
classifies a key as common.
Sourcepub fn id_of(&self, name: &str) -> Option<u32>
pub fn id_of(&self, name: &str) -> Option<u32>
Look up the id for an already-interned name, if any.
Unlike intern this never mutates the dictionary, so a
caller can ask “is this key already common?” without appending.
Sourcepub fn name_of(&self, id: u32) -> Option<&str>
pub fn name_of(&self, id: u32) -> Option<&str>
Resolve an id back to its field name, if the id is in range.
Trait Implementations§
Source§impl Clone for KeyDictionary
impl Clone for KeyDictionary
Source§fn clone(&self) -> KeyDictionary
fn clone(&self) -> KeyDictionary
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 KeyDictionary
impl Debug for KeyDictionary
Source§impl Default for KeyDictionary
impl Default for KeyDictionary
Source§fn default() -> KeyDictionary
fn default() -> KeyDictionary
Returns the “default value” for a type. Read more
Source§impl PartialEq for KeyDictionary
impl PartialEq for KeyDictionary
Source§fn eq(&self, other: &KeyDictionary) -> bool
fn eq(&self, other: &KeyDictionary) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for KeyDictionary
Auto Trait Implementations§
impl Freeze for KeyDictionary
impl RefUnwindSafe for KeyDictionary
impl Send for KeyDictionary
impl Sync for KeyDictionary
impl Unpin for KeyDictionary
impl UnsafeUnpin for KeyDictionary
impl UnwindSafe for KeyDictionary
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