pub struct GraphemeId(/* private fields */);Expand description
Grapheme ID: reference to an interned string in [GraphemePool].
§Layout
[30-24: width (7 bits)][23-0: pool slot (24 bits)]§Capacity
- Pool slots: 16,777,216 (24 bits = 16M entries)
- Width range: 0-127 (7 bits, plenty for any display width)
§Design Rationale
- 24 bits for slot allows 16M unique graphemes (far exceeding practical usage)
- 7 bits for width allows display widths 0-127 (most graphemes are 1-2)
- Embedded width avoids pool lookup for width queries
- Total 31 bits leaves bit 31 for
CellContenttype discrimination
Implementations§
Trait Implementations§
Source§impl Clone for GraphemeId
impl Clone for GraphemeId
Source§fn clone(&self) -> GraphemeId
fn clone(&self) -> GraphemeId
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 moreSource§impl Debug for GraphemeId
impl Debug for GraphemeId
Source§impl Default for GraphemeId
impl Default for GraphemeId
Source§fn default() -> GraphemeId
fn default() -> GraphemeId
Returns the “default value” for a type. Read more
Source§impl Hash for GraphemeId
impl Hash for GraphemeId
Source§impl PartialEq for GraphemeId
impl PartialEq for GraphemeId
impl Copy for GraphemeId
impl Eq for GraphemeId
impl StructuralPartialEq for GraphemeId
Auto Trait Implementations§
impl Freeze for GraphemeId
impl RefUnwindSafe for GraphemeId
impl Send for GraphemeId
impl Sync for GraphemeId
impl Unpin for GraphemeId
impl UnwindSafe for GraphemeId
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