pub struct StructuralMemo<T> {
pub values: Vec<Option<T>>,
pub size: usize,
pub hits: usize,
/* private fields */
}Expand description
memoize values by token structure. lookups return a slot, the value of a slot is None until it is set
Fields§
§values: Vec<Option<T>>values by slot
size: usizenumber of distinct structures
hits: usizenumber of lookups that found an existing entry
Implementations§
Source§impl<T> StructuralMemo<T>
impl<T> StructuralMemo<T>
pub fn new(numeric_equality: bool) -> Self
Sourcepub fn list(&mut self, arena: &Arena, first: u32, prefix: i32) -> usize
pub fn list(&mut self, arena: &Arena, first: u32, prefix: i32) -> usize
slot of a token list (the token and its next siblings). prefix: extra key component, not negative
Sourcepub fn token(&mut self, arena: &Arena, token: u32) -> usize
pub fn token(&mut self, arena: &Arena, token: u32) -> usize
slot of a single token (its next siblings are ignored)
pub fn get(&self, slot: usize) -> Option<&T>
pub fn set(&mut self, slot: usize, value: T)
Trait Implementations§
Auto Trait Implementations§
impl<T> Forget for StructuralMemo<T>
impl<T> Freeze for StructuralMemo<T>
impl<T> Move for StructuralMemo<T>
impl<T> RefUnwindSafe for StructuralMemo<T>
impl<T> Send for StructuralMemo<T>
impl<T> Sync for StructuralMemo<T>
impl<T> Unpin for StructuralMemo<T>
impl<T> UnsafeUnpin for StructuralMemo<T>
impl<T> UnwindSafe for StructuralMemo<T>
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