# NavigationStack

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

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

```rust
struct NavigationStack
```

The back or the forward stack of a frame (WinUI's `IVector<PageStackEntry>` of
`Frame.BackStack` and `Frame.ForwardStack`): a live, observable list of entries. Clones are the
same list.

An edit is rejected during a navigation, with an index outside the list, or with an entry of the
journal of another frame (`NavigationHistory.cpp`, `PageStackEntryTrackerCollection.cpp`); the
edits return a `Result` where WinUI returns a failing `HRESULT`.

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

## Members

- [`count`](#function-count)
- [`is_empty`](#function-is_empty)
- [`get`](#function-get)
- [`snapshot`](#function-snapshot)
- [`add_collection_changed`](#function-add_collection_changed)
- [`remove_collection_changed`](#function-remove_collection_changed)
- [`add`](#function-add)
- [`insert`](#function-insert)
- [`set`](#function-set)
- [`remove_at`](#function-remove_at)
- [`clear`](#function-clear)

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

### count

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

Gets the number of entries.

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

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

### is_empty

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

Gets whether the stack has no entry.

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

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

### get

```rust
fn get(self: &Self, index: usize) -> Option<Ref<PageStackEntry>>
```

Gets the entry at `index`.

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

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

### snapshot

```rust
fn snapshot(self: &Self) -> Rc<Vec<Ref<PageStackEntry>>>
```

Gets the entries, oldest first.

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

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

### add_collection_changed

```rust
fn add_collection_changed(self: &Self, handler: Rc<CollectionChangedHandler<Ref<PageStackEntry>>>) -> u64
```

Adds a handler of the changes of the list; returns its token.

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

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

### remove_collection_changed

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

Removes the handler of `token`.

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

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

### add

```rust
fn add(self: &Self, entry: Ref<PageStackEntry>) -> Result<(), NavigationError>
```

Adds an entry at the end (the newest).

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

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

### insert

```rust
fn insert(self: &Self, index: usize, entry: Ref<PageStackEntry>) -> Result<(), NavigationError>
```

Inserts an entry at `index`.

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

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

### set

```rust
fn set(self: &Self, index: usize, entry: Ref<PageStackEntry>) -> Result<(), NavigationError>
```

Replaces the entry at `index`.

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

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

### remove_at

```rust
fn remove_at(self: &Self, index: usize) -> Result<(), NavigationError>
```

Removes the entry at `index`.

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

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

### clear

```rust
fn clear(self: &Self) -> Result<(), NavigationError>
```

Removes every entry.

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

## 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`
- [`INotifyCollectionChanged`](/docs/0.5.0/api/ferroui-base/data/model/use-inotifycollectionchanged/)
- [`INotifyPropertyChanged`](/docs/0.5.0/api/ferroui-base/data/model/use-inotifypropertychanged/)
- [`IItemsList`](/docs/0.5.0/api/ferroui-controls/trait-iitemslist/)
- `From<NavigationStack>`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`ValueTypeRegistration`](/docs/0.5.0/api/ferroui-base/data/core/trait-valuetyperegistration/)

## Availability

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