SelectedDatesCollection
struct · ferroui-controls · v0.5.0
struct SelectedDatesCollection
Represents a set of selected dates in a Calendar.
The value is a shared handle: clones refer to the same collection, and handles compare by identity. Every change goes through the collection, which validates it against the selection mode of the calendar that owns it and keeps the selected date of that calendar in step.
Members
newadd_rangecountis_emptygetto_veccontainsindex_ofaddinsertremoveremove_atsetclearmove_itemadd_collection_changedremove_collection_changed
new
fn new(owner: &Ref<Calendar>) -> Self
Initializes a new instance of the SelectedDatesCollection class.
owner is the Calendar associated with this object.
add_range
fn add_range(self: &Self, start: DateTime, end: DateTime)
Adds all the dates in the specified range, which includes the first and last dates, to the collection.
start is the first date to add to the collection and end the
last one.
count
fn count(self: &Self) -> usize
The number of dates in the collection.
is_empty
fn is_empty(self: &Self) -> bool
Whether the collection has no dates.
get
fn get(self: &Self, index: usize) -> DateTime
The date at index. Panics when the index is out of range.
to_vec
fn to_vec(self: &Self) -> Vec<DateTime>
The dates of the collection, as they are now.
contains
fn contains(self: &Self, item: DateTime) -> bool
Whether the collection contains the date.
index_of
fn index_of(self: &Self, item: DateTime) -> Option<usize>
The index of the date in the collection.
add
fn add(self: &Self, item: DateTime)
Adds a date to the end of the collection.
Panics when the selection mode of the calendar does not allow the change or the date cannot be selected.
insert
fn insert(self: &Self, index: usize, item: DateTime)
Inserts a date into the collection at the specified index.
Panics when the selection mode of the calendar does not allow the change or the date cannot be selected.
remove
fn remove(self: &Self, item: DateTime) -> bool
Removes a date from the collection. Returns whether it was present.
remove_at
fn remove_at(self: &Self, index: usize)
Removes the date at the specified index of the collection.
set
fn set(self: &Self, index: usize, item: DateTime)
Replaces the date at the specified index.
clear
fn clear(self: &Self)
Removes all dates from the collection.
move_item
fn move_item(self: &Self, old_index: usize, new_index: usize)
Moves the date at old_index to new_index.
add_collection_changed
fn add_collection_changed(self: &Self, handler: Rc<CollectionChangedHandler<DateTime>>) -> u64
Subscribes to the changes of the collection; returns the token of the subscription.
remove_collection_changed
fn remove_collection_changed(self: &Self, token: u64) -> bool
Ends a subscription to the changes of the collection.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherClonePartialEq
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.