Enum loro::ExpandType
source · pub enum ExpandType {
Before,
After,
Both,
None,
}
Expand description
Whether to expand the style when inserting new text around it.
- Before: when inserting new text before this style, the new text should inherit this style.
- After: when inserting new text after this style, the new text should inherit this style.
- Both: when inserting new text before or after this style, the new text should inherit this style.
- None: when inserting new text before or after this style, the new text should not inherit this style.
Variants§
Implementations§
source§impl ExpandType
impl ExpandType
pub const fn expand_before(&self) -> bool
pub const fn expand_after(&self) -> bool
sourcepub fn try_from_str(s: &str) -> Option<ExpandType>
pub fn try_from_str(s: &str) -> Option<ExpandType>
‘before’|‘after’|‘both’|‘none’
sourcepub const fn reverse(self) -> ExpandType
pub const fn reverse(self) -> ExpandType
Toggle expand type between for deletion and for creation
For a style that expand after, when we delete the style, we need to have another style that expands after to nullify it, so that the expand behavior is not changed.
Before -> Before After -> After Both -> None None -> Both
Because the creation of text styles and the deletion of the text styles have reversed expand type. This method is useful to convert between the two
Trait Implementations§
source§impl Clone for ExpandType
impl Clone for ExpandType
source§fn clone(&self) -> ExpandType
fn clone(&self) -> ExpandType
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 ExpandType
impl Debug for ExpandType
source§impl Hash for ExpandType
impl Hash for ExpandType
source§impl PartialEq for ExpandType
impl PartialEq for ExpandType
source§fn eq(&self, other: &ExpandType) -> bool
fn eq(&self, other: &ExpandType) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for ExpandType
impl Eq for ExpandType
impl StructuralPartialEq for ExpandType
Auto Trait Implementations§
impl Freeze for ExpandType
impl RefUnwindSafe for ExpandType
impl Send for ExpandType
impl Sync for ExpandType
impl Unpin for ExpandType
impl UnwindSafe for ExpandType
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more