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

source

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.

source

pub fn expand_before(self) -> bool

When inserting new text around this style, prefer inserting after it.

source

pub fn expand_after(self) -> bool

When inserting new text around this style, prefer inserting before it.

source

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.

source

pub fn is_delete(&self) -> bool

source

pub fn is_container(&self) -> bool

source

pub const fn new( mergeable: bool, expand_type: ExpandType, is_delete: bool, is_container: bool ) -> Self

source

pub const fn is_dead(self) -> bool

source

pub const fn to_delete(self) -> Self

source

pub const BOLD: TextStyleInfoFlag = _

source

pub const COMMENT: TextStyleInfoFlag = _

source

pub const fn to_byte(&self) -> u8

source

pub const fn from_byte(data: u8) -> Self

Trait Implementations§

source§

impl Clone for TextStyleInfoFlag

source§

fn clone(&self) -> TextStyleInfoFlag

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TextStyleInfoFlag

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for TextStyleInfoFlag

source§

fn default() -> TextStyleInfoFlag

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for TextStyleInfoFlag

source§

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

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for TextStyleInfoFlag

source§

fn eq(&self, other: &TextStyleInfoFlag) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for TextStyleInfoFlag

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Copy for TextStyleInfoFlag

source§

impl Eq for TextStyleInfoFlag

source§

impl StructuralEq for TextStyleInfoFlag

source§

impl StructuralPartialEq for TextStyleInfoFlag

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> ZeroElement for Twhere T: Default,

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

source§

impl<T> Rleable for Twhere T: Clone + PartialEq + Serialize + for<'de> Deserialize<'de>,