TextRangeCollection
struct · ferroui-controls · v0.5.0
struct TextRangeCollection
An observable shared collection of copied highlight values.
Unlike a live document range, an item does not follow edits. Applications replace range values when their search results or annotations change.
Members
newfrom_itemscountlenis_emptycapacityclearaddadd_rangeadd_spaninsertinsert_rangegetsetremove_atremovecontainsindex_ofsnapshotto_veciterfor_eachcollection_changed
new
fn new() -> Self
from_items
fn from_items(items: impl IntoIterator<Item = TextHighlightRange>) -> Self
count
fn count(self: &Self) -> usize
len
fn len(self: &Self) -> usize
is_empty
fn is_empty(self: &Self) -> bool
capacity
fn capacity(self: &Self) -> usize
clear
fn clear(self: &Self)
add
fn add(self: &Self, range: TextHighlightRange)
add_range
fn add_range(self: &Self, ranges: impl IntoIterator<Item = TextHighlightRange>)
add_span
fn add_span(self: &Self, range: Range<usize>) -> Result<(), TextHighlightError>
insert
fn insert(self: &Self, index: usize, range: TextHighlightRange)
Like the source collection, inserting past the end appends.
insert_range
fn insert_range(self: &Self, index: usize, ranges: impl IntoIterator<Item = TextHighlightRange>)
get
fn get(self: &Self, index: usize) -> Option<TextHighlightRange>
set
fn set(self: &Self, index: usize, range: TextHighlightRange) -> bool
remove_at
fn remove_at(self: &Self, index: usize) -> Option<TextHighlightRange>
remove
fn remove(self: &Self, range: &TextHighlightRange) -> bool
contains
fn contains(self: &Self, range: &TextHighlightRange) -> bool
index_of
fn index_of(self: &Self, range: &TextHighlightRange) -> Option<usize>
snapshot
fn snapshot(self: &Self) -> Rc<Vec<TextHighlightRange>>
Copies every value so setters on a returned item cannot mutate the list.
to_vec
fn to_vec(self: &Self) -> Vec<TextHighlightRange>
iter
fn iter(self: &Self) -> std::vec::IntoIter<TextHighlightRange>
for_each
fn for_each(self: &Self, f: impl FnMut(&TextHighlightRange) -> ())
collection_changed
fn collection_changed(self: &Self, handler: impl Fn(&'a NotifyCollectionChangedEventArgs<'b, TextHighlightRange>) -> () + 'static) -> Subscription
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the collection.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherCloneDefaultPartialEqDebugMarkupTypedValueTypeRegistration
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.