Enum stam::TextSelectionOperator
source · 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
Both sets occupy cover the exact same TextSelections, and all are covered (cf. textfabric’s ==), commutative, transitive
Overlaps
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
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
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
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
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
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
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
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
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
Each TextSelection in A is in B as well, this is similar to Equals but allows for set B having unmatched items
SameRange
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
impl TextSelectionOperator
pub fn all(&self) -> bool
pub fn toggle_negate(&self) -> Self
pub fn toggle_all(&self) -> Self
Trait Implementations§
source§impl Clone for TextSelectionOperator
impl Clone for TextSelectionOperator
source§fn clone(&self) -> TextSelectionOperator
fn clone(&self) -> TextSelectionOperator
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more