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,
limit: Option<usize>,
},
Before {
all: bool,
negate: bool,
limit: Option<usize>,
},
After {
all: bool,
negate: bool,
limit: Option<usize>,
},
Precedes {
all: bool,
negate: bool,
},
Succeeds {
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, such as overlap, embedding, adjacency, etc…
Rather than operator on single TextSelection instances, the 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.
Use the various methods on this type to quickly instantiate a variant.
Variants§
Equals
Both sets 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 ]])
The limit, if set, constrains the lookup range (in unicode points), which can positively affect performance
Before
Each TextSelections in A 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 <<)
The limit, if set, constrains the lookup range (in unicode points), which can positively affect performance
After
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 >>)
The limit, if set, constrains the lookup range (in unicode points), which can positively affect performance
Precedes
Each TextSelection in A 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 <:)
Succeeds
Each TextSelection in A 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 as_str(&self) -> &'static str
pub fn equals() -> Self
pub fn overlaps() -> Self
pub fn embeds() -> Self
pub fn embedded() -> Self
pub fn before() -> Self
pub fn after() -> Self
pub fn precedes() -> Self
pub fn succeeds() -> Self
pub fn samebegin() -> Self
pub fn sameend() -> Self
pub fn samerange() -> Self
pub fn inset() -> Self
sourcepub fn with_limit(self, limit: usize) -> Self
pub fn with_limit(self, limit: usize) -> Self
Constrains the operator to a limit range (in unicode points)
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 moresource§impl Debug for TextSelectionOperator
impl Debug for TextSelectionOperator
source§impl PartialEq for TextSelectionOperator
impl PartialEq for TextSelectionOperator
source§fn eq(&self, other: &TextSelectionOperator) -> bool
fn eq(&self, other: &TextSelectionOperator) -> bool
self and other values to be equal, and is used
by ==.