Struct loro_internal::container::richtext::TextStyleInfoFlag
source · pub struct TextStyleInfoFlag { /* private fields */ }Expand description
A compact representation of a rich text style config.
Note: we assume style with the same key has the same Mergeable and isContainer value.
- Mergeable (1st bit): whether two styles with the same key can be merged into one.
- Expand Before (2nd bit): when inserting new text before this style, whether the new text should inherit this style.
- Expand After (3rd bit): when inserting new text after this style, whether the new text should inherit this style.
- Delete (4th bit): whether this is used to remove a style from a range.
- isContainer (5th bit): whether the style also store other data in a associated map container with the same OpID.
- 0 (6th bit)
- 0 (7th bit)
- isAlive (8th bit): always 1 unless the style is garbage collected. If this is 0, all other bits should be 0 as well.
Implementations§
source§impl TextStyleInfoFlag
impl TextStyleInfoFlag
sourcepub fn mergeable(self) -> bool
pub fn mergeable(self) -> bool
Whether two styles with the same key can be merged into one. If false, the styles will coexist in the same range.
sourcepub fn expand_before(self) -> bool
pub fn expand_before(self) -> bool
When inserting new text around this style, prefer inserting after it.
sourcepub fn expand_after(self) -> bool
pub fn expand_after(self) -> bool
When inserting new text around this style, prefer inserting before it.
sourcepub fn prefer_insert_before(self, anchor_type: AnchorType) -> bool
pub fn prefer_insert_before(self, anchor_type: AnchorType) -> bool
This method tells that when we can insert text before/after this style anchor, whether we insert the new text before the anchor.
pub fn is_delete(&self) -> bool
pub fn is_container(&self) -> bool
pub const fn new( mergeable: bool, expand_type: ExpandType, is_delete: bool, is_container: bool ) -> Self
pub const fn is_dead(self) -> bool
pub const fn to_delete(self) -> Self
pub const BOLD: TextStyleInfoFlag = _
pub const LINK: TextStyleInfoFlag = _
pub const COMMENT: TextStyleInfoFlag = _
pub const fn to_byte(&self) -> u8
pub const fn from_byte(data: u8) -> Self
Trait Implementations§
source§impl Clone for TextStyleInfoFlag
impl Clone for TextStyleInfoFlag
source§fn clone(&self) -> TextStyleInfoFlag
fn clone(&self) -> TextStyleInfoFlag
Returns a copy 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 TextStyleInfoFlag
impl Debug for TextStyleInfoFlag
source§impl Default for TextStyleInfoFlag
impl Default for TextStyleInfoFlag
source§fn default() -> TextStyleInfoFlag
fn default() -> TextStyleInfoFlag
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for TextStyleInfoFlag
impl<'de> Deserialize<'de> for TextStyleInfoFlag
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Hash for TextStyleInfoFlag
impl Hash for TextStyleInfoFlag
source§impl PartialEq for TextStyleInfoFlag
impl PartialEq for TextStyleInfoFlag
source§fn eq(&self, other: &TextStyleInfoFlag) -> bool
fn eq(&self, other: &TextStyleInfoFlag) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl Serialize for TextStyleInfoFlag
impl Serialize for TextStyleInfoFlag
impl Copy for TextStyleInfoFlag
impl Eq for TextStyleInfoFlag
impl StructuralEq for TextStyleInfoFlag
impl StructuralPartialEq for TextStyleInfoFlag
Auto Trait Implementations§
impl RefUnwindSafe for TextStyleInfoFlag
impl Send for TextStyleInfoFlag
impl Sync for TextStyleInfoFlag
impl Unpin for TextStyleInfoFlag
impl UnwindSafe for TextStyleInfoFlag
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