# TreeNodeCollection

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-diagnostics/diagnostics/view_models/struct-treenodecollection/

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

```rust
struct TreeNodeCollection
```

The children of a [`TreeNode`](/docs/0.5.0/api/ferroui-diagnostics/diagnostics/view_models/struct-treenode/): a read-only list of nodes that is filled
the first time it is used (its count, an item, an enumeration or a
subscription to its changes), and then follows the tree it shows.

The kinds of the original (the collections of the logical and visual
trees, of a group of top levels, of an application, and the empty one)
derive from it; here they implement [`TreeNodeCollectionImpl`](/docs/0.5.0/api/ferroui-diagnostics/diagnostics/view_models/trait-treenodecollectionimpl/), which the
collection holds.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L37)

## Members

- [`new`](#function-new)
- [`empty`](#function-empty)
- [`get`](#function-get)
- [`count`](#function-count)
- [`owner`](#function-owner)
- [`dispose`](#function-dispose)
- [`base_dispose`](#function-base_dispose)
- [`is_initialized`](#function-is_initialized)
- [`to_vec`](#function-to_vec)
- [`contains`](#function-contains)
- [`index_of`](#function-index_of)

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

### new

```rust
fn new(owner: Weak<TreeNode>, kind: Box<dyn TreeNodeCollectionImpl>) -> Rc<Self>
```

`TreeNodeCollection(TreeNode owner)`: a collection of the children of
`owner`, of the kind `kind`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L64)

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

### empty

```rust
fn empty() -> Rc<TreeNodeCollection>
```

`static readonly internal TreeNodeCollection Empty`: the collection of
the nodes without children (one per thread).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L75)

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

### get

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

`this[int index]`: the node at `index`.
## Panics
Panics when `index` is out of range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L83)

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

### count

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

`Count`: the number of nodes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L88)

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

### owner

```rust
fn owner(self: &Self) -> Option<Rc<TreeNode>>
```

`Owner`: the node whose children the collection holds; `None` for the
empty collection, and once the node is gone.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L94)

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

### dispose

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

`Dispose()`: the override of the kind of the collection.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L99)

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

### base_dispose

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

The base implementation of `Dispose()`: disposes the nodes, if the
collection was ever filled.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L105)

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

### is_initialized

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

Whether the collection was filled: whether its nodes exist. A collection is filled the first
time it is used (its count, an item, an enumeration or a subscription to its changes); the
tree pages ask for the children of a node when its row is shown or expanded.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L116)

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

### to_vec

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

`GetEnumerator()`: the nodes, as they are now.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L121)

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

### contains

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

`IList.Contains(object)`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L126)

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

### index_of

```rust
fn index_of(self: &Self, node: &Rc<TreeNode>) -> i32
```

`IList.IndexOf(object)`: the index of `node`, or `-1`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Diagnostics/diagnostics/view_models/tree_node_collection.rs#L131)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- [`TreeModel`](/docs/0.5.0/api/ferroui-treedatagrid-core/accessor/trait-treemodel/)
- `PartialEq`
- [`INotifyCollectionChanged`](/docs/0.5.0/api/ferroui-base/data/model/use-inotifycollectionchanged/)
- [`INotifyPropertyChanged`](/docs/0.5.0/api/ferroui-base/data/model/use-inotifypropertychanged/)
- [`IFerroReadOnlyList<Rc<TreeNode>>`](/docs/0.5.0/api/ferroui-base/collections/trait-iferroreadonlylist/)
- [`IItemsList`](/docs/0.5.0/api/ferroui-controls/trait-iitemslist/)
- [`ModelCollection<TreeNode>`](/docs/0.5.0/api/ferroui-treedatagrid-core/model_collection/trait-modelcollection/)
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)

## Availability

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