# ItemsSource

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

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

```rust
struct ItemsSource
```

A shared handle to an untyped items list: the value of an items source
property.

Equality is the identity of the underlying collection.

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

## Members

- [`new`](#function-new)
- [`from_items`](#function-from_items)
- [`from_values`](#function-from_values)
- [`from_strs`](#function-from_strs)
- [`list`](#function-list)
- [`count`](#function-count)
- [`get_at`](#function-get_at)
- [`index_of`](#function-index_of)
- [`contains`](#function-contains)
- [`is_notifying`](#function-is_notifying)
- [`downcast_ref`](#function-downcast_ref)
- [`identity`](#function-identity)
- [`ptr_eq`](#function-ptr_eq)
- [`iter`](#function-iter)
- [`to_vec`](#function-to_vec)
- [`register_binding_conversion_with`](#function-register_binding_conversion_with)
- [`register_binding_conversion`](#function-register_binding_conversion)

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

### new

```rust
fn new(list: Rc<dyn IItemsList>) -> Self
```

Wraps a list.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L673)

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

### from_items

```rust
fn from_items(items: impl IntoIterator<Item = Option<BoxedValue>>) -> Self
```

Creates a non-notifying source holding the given items.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L678)

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

### from_values

```rust
fn from_values<T: PropertyValue>(values: impl IntoIterator<Item = T>) -> Self
```

Creates a non-notifying source by boxing each of the given values.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L683)

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

### from_strs

```rust
fn from_strs<'a>(values: impl IntoIterator<Item = &'a str>) -> Self
```

Creates a non-notifying source of strings.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L688)

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

### list

```rust
fn list(self: &Self) -> &Rc<dyn IItemsList>
```

The list.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L694)

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

### count

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

The number of items.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L700)

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

### get_at

```rust
fn get_at(self: &Self, index: usize) -> Option<BoxedValue>
```

The item at `index`. Panics if out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L706)

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

### index_of

```rust
fn index_of(self: &Self, item: &Option<BoxedValue>) -> i32
```

The index of the first item equal to `item`, or `-1`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L712)

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

### contains

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

Whether the list contains an item equal to `item`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L718)

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

### is_notifying

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

Whether the list notifies of changes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L724)

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

### downcast_ref

```rust
fn downcast_ref<T: 'static>(self: &Self) -> Option<&T>
```

The typed collection behind the source, if it is a `T`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L729)

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

### identity

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

The identity of the underlying collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L735)

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

### ptr_eq

```rust
fn ptr_eq(self: &Self, other: &ItemsSource) -> bool
```

Whether two handles refer to the same collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L741)

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

### iter

```rust
fn iter(self: &Self) -> impl Iterator<Item = Option<BoxedValue>> + '_
```

The items, enumerated by index over the live list.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L746)

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

### to_vec

```rust
fn to_vec(self: &Self) -> Vec<Option<BoxedValue>>
```

A copy of the items.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L759)

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

### register_binding_conversion_with

```rust
fn register_binding_conversion_with<S: 'static>(convert: fn(&S) -> ItemsSource)
```

Lets bindings deliver a value of the collection type `S` to a
property of type `Option<ItemsSource>` (or `ItemsSource`) on the
current thread.
`register_binding_conversion` for a
collection type that converts with `convert` (a list handle that is delivered as
the shared list).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L769)

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

### register_binding_conversion

```rust
fn register_binding_conversion<S: Clone + Into<ItemsSource> + 'static>()
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/items_source.rs#L774)

## 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`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- `From<NavigationStack>`
- `From<&'a ItemsSource>`
- `Clone`
- `PartialEq`
- `Debug`
- `From<Rc<dyn IItemsList>>`
- `From<Rc<ItemsSourceView>>`
- `From<Rc<FerroList<T>>>`
- `From<Rc<BindableList<T>>>`
- `From<Vec<Option<Rc<dyn AnyValue>>>>`
- `From<Vec<Rc<dyn AnyValue>>>`
- `From<Rc<Vec<Option<Rc<dyn AnyValue>>>>>`
- `From<CommandBarElementCollection>`

## Availability

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