pub struct Detokenizer { /* private fields */ }Expand description
Stateful detokenizer.
Construct with a TokenizerMap; call Detokenizer::render
repeatedly with chunks of IDs. State (the partial UTF-8 byte buffer)
persists across calls; Detokenizer::reset clears it.
Implementations§
Source§impl Detokenizer
impl Detokenizer
Sourcepub fn new(map: &TokenizerMap) -> Self
pub fn new(map: &TokenizerMap) -> Self
Build a detokenizer from a map.
Sourcepub fn render(&mut self, ids: &[u32], options: DetokenizeOptions) -> String
pub fn render(&mut self, ids: &[u32], options: DetokenizeOptions) -> String
Render a chunk of IDs to text. Stateful across calls.
Sourcepub fn detokenize(
map: &TokenizerMap,
ids: &[u32],
render_special: bool,
) -> String
pub fn detokenize( map: &TokenizerMap, ids: &[u32], render_special: bool, ) -> String
Convenience: detokenize a complete sequence in one shot. Uses a fresh detokenizer; partial buffering not exposed.
Auto Trait Implementations§
impl Freeze for Detokenizer
impl RefUnwindSafe for Detokenizer
impl Send for Detokenizer
impl Sync for Detokenizer
impl Unpin for Detokenizer
impl UnsafeUnpin for Detokenizer
impl UnwindSafe for Detokenizer
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