pub struct PromptLookupIndex { /* private fields */ }Expand description
2026-10-02: Per-sequence n-gram index over a token history.
Implementations§
Source§impl PromptLookupIndex
impl PromptLookupIndex
Sourcepub fn observe(&mut self, history: &[u32])
pub fn observe(&mut self, history: &[u32])
2026-10-02: Indexes every n-gram of history that has a following
token and is not indexed yet. Amortised O(n) per new token. A history
shorter than the indexed length (a rewind) moves the mark back; the
entries past it are left in place and rejected on use.
Sourcepub fn propose<'h>(
&self,
history: &'h [u32],
max_len: usize,
) -> Option<&'h [u32]>
pub fn propose<'h>( &self, history: &'h [u32], max_len: usize, ) -> Option<&'h [u32]>
2026-10-02: The continuation of the latest earlier occurrence of
history’s final n-gram, at most max_len tokens; None when there
is no earlier occurrence, max_len is 0, or the history is too short.
Call observe with the same history first.
Trait Implementations§
Source§impl Clone for PromptLookupIndex
impl Clone for PromptLookupIndex
Source§fn clone(&self) -> PromptLookupIndex
fn clone(&self) -> PromptLookupIndex
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 moreAuto Trait Implementations§
impl Freeze for PromptLookupIndex
impl RefUnwindSafe for PromptLookupIndex
impl Send for PromptLookupIndex
impl Sync for PromptLookupIndex
impl Unpin for PromptLookupIndex
impl UnwindSafe for PromptLookupIndex
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