Struct stam::TextSelectionSet
source · pub struct TextSelectionSet { /* private fields */ }Expand description
A TextSelectionSet holds one or more TextSelection items and a reference to the TextResource from which they’re drawn.
All textselections in a set must reference the same resource, which implies they are comparable.
Implementations§
source§impl<'store, 'slf> TextSelectionSet
impl<'store, 'slf> TextSelectionSet
sourcepub fn find_textselections(
self,
operator: TextSelectionOperator,
annotationstore: &'store AnnotationStore
) -> Option<impl Iterator<Item = WrappedItem<'store, TextSelection>>>
pub fn find_textselections( self, operator: TextSelectionOperator, annotationstore: &'store AnnotationStore ) -> Option<impl Iterator<Item = WrappedItem<'store, TextSelection>>>
Applies a TextSelectionOperator to find all other text selections that
are in a specific relation with the current text selection set. Returns an iterator over the TextSelection instances.
(as WrappedItem<TextSelection>).
If you are interested in the annotations associated with the found text selections, then use [Self.find_annotations()] instead.
This variant consumes the TextSelectionSet, use find_textselections_ref() for a borrowed version.
sourcepub fn find_textselections_ref(
&'slf self,
operator: TextSelectionOperator,
annotationstore: &'store AnnotationStore
) -> Option<impl Iterator<Item = WrappedItem<'store, TextSelection>> + 'slf>where
'store: 'slf,
pub fn find_textselections_ref( &'slf self, operator: TextSelectionOperator, annotationstore: &'store AnnotationStore ) -> Option<impl Iterator<Item = WrappedItem<'store, TextSelection>> + 'slf>where 'store: 'slf,
Applies a TextSelectionOperator to find all other text selections that
are in a specific relation with the current text selection set. Returns an iterator over the TextSelection instances.
(as WrappedItem<TextSelection>).
If you are interested in the annotations associated with the found text selections, then use [Self.find_annotations()] instead.
This variant borrows the TextSelectionSet, use find_textselections() for an owned version that consumes the set.
source§impl TextSelectionSet
impl TextSelectionSet
pub fn new(resource: TextResourceHandle) -> Self
pub fn add(&mut self, textselection: TextSelection) -> &mut Self
pub fn get(&self, index: usize) -> Option<&TextSelection>
pub fn len(&self) -> usize
pub fn resource(&self) -> TextResourceHandle
pub fn is_empty(&self) -> bool
sourcepub fn test(
&self,
operator: &TextSelectionOperator,
reftextsel: &TextSelection
) -> bool
pub fn test( &self, operator: &TextSelectionOperator, reftextsel: &TextSelection ) -> bool
This method is called to test whether a specific spatial relation (as expressed by the passed operator) holds between two TextSelectionSets.
A boolean is returned with the test result.
sourcepub fn test_set(
&self,
operator: &TextSelectionOperator,
refset: &TextSelectionSet
) -> bool
pub fn test_set( &self, operator: &TextSelectionOperator, refset: &TextSelectionSet ) -> bool
This method is called to test whether a specific spatial relation (as expressed by the passed operator) holds between two TextSelectionSets.
A boolean is returned with the test result.
sourcepub fn leftmost(&self) -> Option<&TextSelection>
pub fn leftmost(&self) -> Option<&TextSelection>
Returns the left-most TextSelection (the one with the lowest start offset) in the set.
sourcepub fn rightmost(&self) -> Option<&TextSelection>
pub fn rightmost(&self) -> Option<&TextSelection>
Returns the right-most TextSelection (the one with the highest end offset) in the set.
Trait Implementations§
source§impl Clone for TextSelectionSet
impl Clone for TextSelectionSet
source§fn clone(&self) -> TextSelectionSet
fn clone(&self) -> TextSelectionSet
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for TextSelectionSet
impl Debug for TextSelectionSet
source§impl Extend<TextSelection> for TextSelectionSet
impl Extend<TextSelection> for TextSelectionSet
source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = TextSelection>,
fn extend<T>(&mut self, iter: T)where T: IntoIterator<Item = TextSelection>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)source§impl<'store> From<WrappedItem<'store, TextSelection>> for TextSelectionSet
impl<'store> From<WrappedItem<'store, TextSelection>> for TextSelectionSet
source§fn from(textselection: WrappedItem<'store, TextSelection>) -> Self
fn from(textselection: WrappedItem<'store, TextSelection>) -> Self
source§impl<'store> FromIterator<WrappedItem<'store, TextSelection>> for TextSelectionSet
impl<'store> FromIterator<WrappedItem<'store, TextSelection>> for TextSelectionSet
source§fn from_iter<T: IntoIterator<Item = WrappedItem<'store, TextSelection>>>(
iter: T
) -> Self
fn from_iter<T: IntoIterator<Item = WrappedItem<'store, TextSelection>>>( iter: T ) -> Self
source§impl PartialEq<TextSelectionSet> for TextSelectionSet
impl PartialEq<TextSelectionSet> for TextSelectionSet
source§fn eq(&self, other: &TextSelectionSet) -> bool
fn eq(&self, other: &TextSelectionSet) -> bool
self and other values to be equal, and is used
by ==.