pub struct CharDef { /* private fields */ }Expand description
Character definition table
Implementations§
Source§impl CharDef
impl CharDef
Sourcepub const TABLE_SIZE: usize = 65_535usize
pub const TABLE_SIZE: usize = 65_535usize
Number of entries in the CharInfo table (0xFFFF = 65535)
Sourcepub fn from_mmap(mmap: Arc<Mmap>) -> Result<Self>
pub fn from_mmap(mmap: Arc<Mmap>) -> Result<Self>
Load character definitions from memory-mapped file
§Errors
Returns an error if the file is corrupted.
Sourcepub fn get_char_info(&self, c: char) -> CharInfo
pub fn get_char_info(&self, c: char) -> CharInfo
Get CharInfo for a Unicode code point
Sourcepub fn get_char_info_from_bytes(&self, bytes: &[u8]) -> (CharInfo, usize)
pub fn get_char_info_from_bytes(&self, bytes: &[u8]) -> (CharInfo, usize)
Get CharInfo for a byte sequence (handles UTF-8)
Sourcepub fn category_name(&self, id: usize) -> Option<&str>
pub fn category_name(&self, id: usize) -> Option<&str>
Get category name by ID
Sourcepub fn category_count(&self) -> usize
pub fn category_count(&self) -> usize
Get number of categories
Sourcepub fn category_id(&self, name: &str) -> Option<usize>
pub fn category_id(&self, name: &str) -> Option<usize>
Get category ID by name
Sourcepub fn should_group(&self, category: CharCategory) -> bool
pub fn should_group(&self, category: CharCategory) -> bool
Check if a category should group consecutive characters
This uses the group flag from the first character of the category.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CharDef
impl RefUnwindSafe for CharDef
impl Unpin for CharDef
impl UnwindSafe for CharDef
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