CalendarBlackoutDatesCollection
struct · ferroui-controls · v0.5.0
struct CalendarBlackoutDatesCollection
Represents a collection of non-selectable 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 and refreshes the calendar that owns it.
Members
newadd_dates_in_pastcontains_datecontains_datescontains_anycountis_emptygetto_veccontainsindex_ofaddinsertremoveremove_atsetclearmove_itemadd_collection_changedremove_collection_changed
new
fn new(owner: &Ref<Calendar>) -> Self
Initializes a new instance of the
CalendarBlackoutDatesCollection class.
owner is the Calendar whose dates this object represents.
add_dates_in_past
fn add_dates_in_past(self: &Self)
Adds all dates before today to the collection.
contains_date
fn contains_date(self: &Self, date: DateTime) -> bool
Returns a value that represents whether this collection contains the specified date.
contains_dates
fn contains_dates(self: &Self, start: DateTime, end: DateTime) -> bool
Returns a value that represents whether this collection contains the
specified range of dates: start is the start of the date range and
end the end of it.
contains_any
fn contains_any(self: &Self, range: &CalendarDateRange) -> bool
Returns a value that represents whether this collection contains any date in the specified range.
count
fn count(self: &Self) -> usize
The number of ranges in the collection.
is_empty
fn is_empty(self: &Self) -> bool
Whether the collection has no ranges.
get
fn get(self: &Self, index: usize) -> Rc<CalendarDateRange>
The range at index. Panics when the index is out of range.
to_vec
fn to_vec(self: &Self) -> Vec<Rc<CalendarDateRange>>
The ranges of the collection, as they are now.
contains
fn contains(self: &Self, item: &Rc<CalendarDateRange>) -> bool
Whether the collection contains the range (the same range object).
index_of
fn index_of(self: &Self, item: &Rc<CalendarDateRange>) -> Option<usize>
The index of the range (the same range object) in the collection.
add
fn add(self: &Self, item: Rc<CalendarDateRange>)
Adds a range to the end of the collection.
Panics when the range contains a selected date of the calendar.
insert
fn insert(self: &Self, index: usize, item: Rc<CalendarDateRange>)
Inserts a range into the collection at the specified index.
Panics when the range contains a selected date of the calendar.
remove
fn remove(self: &Self, item: &Rc<CalendarDateRange>) -> bool
Removes the range (the same range object) from the collection. Returns whether it was present.
remove_at
fn remove_at(self: &Self, index: usize)
Removes the range at the specified index of the collection.
set
fn set(self: &Self, index: usize, item: Rc<CalendarDateRange>)
Replaces the range at the specified index.
Panics when the range contains a selected date of the calendar.
clear
fn clear(self: &Self)
Removes all ranges from the collection.
move_item
fn move_item(self: &Self, old_index: usize, new_index: usize)
Moves the range at old_index to new_index.
add_collection_changed
fn add_collection_changed(self: &Self, handler: Rc<CollectionChangedHandler<Rc<CalendarDateRange>>>) -> 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.