pub struct SliceVocab { /* private fields */ }Expand description
The obvious TokenVocab over an owned id -> bytes table. Handy for
tests and for any caller that already has the vocabulary as a Vec.
Implementations§
Trait Implementations§
Source§impl Clone for SliceVocab
impl Clone for SliceVocab
Source§fn clone(&self) -> SliceVocab
fn clone(&self) -> SliceVocab
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 SliceVocab
impl Debug for SliceVocab
Source§impl TokenVocab for SliceVocab
impl TokenVocab for SliceVocab
Source§fn token_count(&self) -> usize
fn token_count(&self) -> usize
How many token ids exist (
0..token_count() is the id range).Source§fn token_bytes(&self, id: u32) -> Option<&[u8]>
fn token_bytes(&self, id: u32) -> Option<&[u8]>
The bytes token
id decodes to, or None for an out-of-range /
byte-less control id (e.g. EOS). A None token contributes no bytes to
the grammar and is never structurally allowed by JsonStructure on
its own — permit it explicitly via
JsonStructure::with_always_allowed if it should be samplable (EOS
usually should, so the model can actually stop).Auto Trait Implementations§
impl Freeze for SliceVocab
impl RefUnwindSafe for SliceVocab
impl Send for SliceVocab
impl Sync for SliceVocab
impl Unpin for SliceVocab
impl UnsafeUnpin for SliceVocab
impl UnwindSafe for SliceVocab
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