Skip to main content

Tokenizer

Trait Tokenizer 

Source
pub trait Tokenizer: Send + Sync {
    // Required method
    fn count_tokens(&self, text: &str) -> usize;
}
Expand description

Counts tokens for a piece of text. Rust equivalent of upstream TokenizerProtocol.

Required Methods§

Source

fn count_tokens(&self, text: &str) -> usize

Count the tokens represented by text.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§