pub enum TextSelectionOperator {
    Equals {
        all: bool,
        negate: bool,
    },
    Overlaps {
        all: bool,
        negate: bool,
    },
    Embeds {
        all: bool,
        negate: bool,
    },
    Embedded {
        all: bool,
        negate: bool,
    },
    Precedes {
        all: bool,
        negate: bool,
    },
    Succeeds {
        all: bool,
        negate: bool,
    },
    LeftAdjacent {
        all: bool,
        negate: bool,
    },
    RightAdjacent {
        all: bool,
        negate: bool,
    },
    SameBegin {
        all: bool,
        negate: bool,
    },
    SameEnd {
        all: bool,
        negate: bool,
    },
    InSet {
        all: bool,
        negate: bool,
    },
    SameRange {
        all: bool,
        negate: bool,
    },
}
Expand description

The TextSelectionOperator, simply put, allows comparison of two [TextSelection'] instances. It allows testing for all kinds of spatial relations (as embodied by this enum) in which two [TextSelection`] instances can be.

Rather than operator on single TextSelection instances, te implementation goes a bit further and can act also on the basis of TextSelectionSet rather than TextSelection, allowing you to compare two sets, each containing possibly multiple TextSelections, at once.

Variants§

§

Equals

Fields

§all: bool
§negate: bool

Both sets occupy cover the exact same TextSelections, and all are covered (cf. textfabric’s ==), commutative, transitive

§

Overlaps

Fields

§all: bool
§negate: bool

All items in both sets must cover the exact same TextSelection. This would be fairly useless, it just means both sets contain only one TextSelection and it’s the same one Each TextSelection in A overlaps with a TextSelection in B (cf. textfabric’s &&), commutative If modifier all is set: Each TextSelection in A overlaps with all TextSelection in B (cf. textfabric’s &&), commutative

§

Embeds

Fields

§all: bool
§negate: bool

All TextSelections in B are embedded by a TextSelection in A (cf. textfabric’s [[) If modifier all is set: All TextSelections in B are embedded by all TextSelection in A (cf. textfabric’s [[)

§

Embedded

Fields

§all: bool
§negate: bool

All TextSelections in A are embedded by a TextSelection in B (cf. textfabric’s ]]) If modifier all is set: All TextSelections in A are embedded by all TextSelection in B (cf. textfabric’s ]])

§

Precedes

Fields

§all: bool
§negate: bool

Each TextSelections in A precedes (comes before) a textselection in B If modifier all is set: All TextSelections in A precede (come before) all textselections in B. There is no overlap (cf. textfabric’s <<)

§

Succeeds

Fields

§all: bool
§negate: bool

Each TextSeleciton In A succeeds (comes after) a textselection in B If modifier all is set: All TextSelections in A succeed (come after) all textselections in B. There is no overlap (cf. textfabric’s >>)

§

LeftAdjacent

Fields

§all: bool
§negate: bool

Each TextSelection in A is ends where at least one TextSelection in B begins. If modifier all is set: The rightmost TextSelections in A end where the leftmost TextSelection in B begins (cf. textfabric’s <:)

§

RightAdjacent

Fields

§all: bool
§negate: bool

Each TextSelection in A is begis where at least one TextSelection in A ends. If modifier all is set: The leftmost TextSelection in A starts where the rightmost TextSelection in B ends (cf. textfabric’s :>)

§

SameBegin

Fields

§all: bool
§negate: bool

Each TextSelection in A starts where a TextSelection in B starts If modifier all is set: The leftmost TextSelection in A starts where the leftmost TextSelection in B start (cf. textfabric’s =:)

§

SameEnd

Fields

§all: bool
§negate: bool

Each TextSelection in A ends where a TextSelection in B ends If modifier all is set: The rightmost TextSelection in A ends where the rights TextSelection in B ends (cf. textfabric’s :=)

§

InSet

Fields

§all: bool
§negate: bool

Each TextSelection in A is in B as well, this is similar to Equals but allows for set B having unmatched items

§

SameRange

Fields

§all: bool
§negate: bool

The leftmost TextSelection in A starts where the leftmost TextSelection in A starts and the rightmost TextSelection in A ends where the rights TextSelection in B ends (cf. textfabric’s ::)

Implementations§

source§

impl TextSelectionOperator

source

pub fn all(&self) -> bool

source

pub fn toggle_negate(&self) -> Self

source

pub fn toggle_all(&self) -> Self

Trait Implementations§

source§

impl Clone for TextSelectionOperator

source§

fn clone(&self) -> TextSelectionOperator

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 TextSelectionOperator

source§

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

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

impl Copy for TextSelectionOperator

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, 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> 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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V