pub trait TokenCounter: Send + Sync {
// Required method
fn count_tokens(&self, text: &str) -> usize;
}Expand description
Trait for measuring token counts of text slices.
Required Methods§
Sourcefn count_tokens(&self, text: &str) -> usize
fn count_tokens(&self, text: &str) -> usize
Return the measured or estimated token count for the given text.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".