# CalendarBlackoutDatesCollection

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/primitives/struct-calendarblackoutdatescollection/

**struct** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
struct CalendarBlackoutDatesCollection
```

Represents a collection of non-selectable dates in a [`Calendar`](/docs/0.5.0/api/ferroui-controls/struct-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.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L22)

## Members

- [`new`](#function-new)
- [`add_dates_in_past`](#function-add_dates_in_past)
- [`contains_date`](#function-contains_date)
- [`contains_dates`](#function-contains_dates)
- [`contains_any`](#function-contains_any)
- [`count`](#function-count)
- [`is_empty`](#function-is_empty)
- [`get`](#function-get)
- [`to_vec`](#function-to_vec)
- [`contains`](#function-contains)
- [`index_of`](#function-index_of)
- [`add`](#function-add)
- [`insert`](#function-insert)
- [`remove`](#function-remove)
- [`remove_at`](#function-remove_at)
- [`set`](#function-set)
- [`clear`](#function-clear)
- [`move_item`](#function-move_item)
- [`add_collection_changed`](#function-add_collection_changed)
- [`remove_collection_changed`](#function-remove_collection_changed)

<a id="function-new"></a>

### new

```rust
fn new(owner: &Ref<Calendar>) -> Self
```

Initializes a new instance of the
`CalendarBlackoutDatesCollection` class.

`owner` is the `Calendar` whose dates this object represents.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L39)

<a id="function-add_dates_in_past"></a>

### add_dates_in_past

```rust
fn add_dates_in_past(self: &Self)
```

Adds all dates before today to the collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L48)

<a id="function-contains_date"></a>

### contains_date

```rust
fn contains_date(self: &Self, date: DateTime) -> bool
```

Returns a value that represents whether this collection contains the
specified date.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L54)

<a id="function-contains_dates"></a>

### contains_dates

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L67)

<a id="function-contains_any"></a>

### contains_any

```rust
fn contains_any(self: &Self, range: &CalendarDateRange) -> bool
```

Returns a value that represents whether this collection contains any
date in the specified range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L91)

<a id="function-count"></a>

### count

```rust
fn count(self: &Self) -> usize
```

The number of ranges in the collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L98)

<a id="function-is_empty"></a>

### is_empty

```rust
fn is_empty(self: &Self) -> bool
```

Whether the collection has no ranges.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L103)

<a id="function-get"></a>

### get

```rust
fn get(self: &Self, index: usize) -> Rc<CalendarDateRange>
```

The range at `index`. Panics when the index is out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L108)

<a id="function-to_vec"></a>

### to_vec

```rust
fn to_vec(self: &Self) -> Vec<Rc<CalendarDateRange>>
```

The ranges of the collection, as they are now.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L113)

<a id="function-contains"></a>

### contains

```rust
fn contains(self: &Self, item: &Rc<CalendarDateRange>) -> bool
```

Whether the collection contains the range (the same range object).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L118)

<a id="function-index_of"></a>

### index_of

```rust
fn index_of(self: &Self, item: &Rc<CalendarDateRange>) -> Option<usize>
```

The index of the range (the same range object) in the collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L123)

<a id="function-add"></a>

### add

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L130)

<a id="function-insert"></a>

### insert

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L137)

<a id="function-remove"></a>

### remove

```rust
fn remove(self: &Self, item: &Rc<CalendarDateRange>) -> bool
```

Removes the range (the same range object) from the collection.
Returns whether it was present.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L144)

<a id="function-remove_at"></a>

### remove_at

```rust
fn remove_at(self: &Self, index: usize)
```

Removes the range at the specified index of the collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L155)

<a id="function-set"></a>

### set

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L163)

<a id="function-clear"></a>

### clear

```rust
fn clear(self: &Self)
```

Removes all ranges from the collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L169)

<a id="function-move_item"></a>

### move_item

```rust
fn move_item(self: &Self, old_index: usize, new_index: usize)
```

Moves the range at `old_index` to `new_index`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L174)

<a id="function-add_collection_changed"></a>

### add_collection_changed

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L180)

<a id="function-remove_collection_changed"></a>

### remove_collection_changed

```rust
fn remove_collection_changed(self: &Self, token: u64) -> bool
```

Ends a subscription to the changes of the collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/calendar/calendar_blackout_dates_collection.rs#L185)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `PartialEq`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
