pub struct LanguageConfig {
pub matcher: fn(char) -> bool,
pub chars_per_token: f64,
}Expand description
A language-specific rule that adjusts characters-per-token when matched.
The matcher function is called for each character in a word segment.
If it returns true for any character, the segment uses chars_per_token
instead of the default ratio.
Fields§
§matcher: fn(char) -> boolCharacter-level predicate that detects the language.
chars_per_token: f64Average characters per token for this language.
Trait Implementations§
Source§impl Clone for LanguageConfig
impl Clone for LanguageConfig
Source§fn clone(&self) -> LanguageConfig
fn clone(&self) -> LanguageConfig
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 LanguageConfig
impl RefUnwindSafe for LanguageConfig
impl Send for LanguageConfig
impl Sync for LanguageConfig
impl Unpin for LanguageConfig
impl UnwindSafe for LanguageConfig
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