# MappedArraySlice

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/utilities/struct-mappedarrayslice/

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

```rust
struct MappedArraySlice<T>
```

Provides a mapped view of an underlying slice, selecting arbitrary indices
from the source array.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/mapped_array_slice.rs#L9)

## Members

- [`new`](#function-new)
- [`length`](#function-length)
- [`set`](#function-set)
- [`get`](#function-get)

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

### new

```rust
fn new(data: &ArraySlice<T>, map: &ArraySlice<i32>) -> Self
```

Creates a view of the data slice through the map slice.

In a debug build, panics when the map is longer than the data.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/mapped_array_slice.rs#L18)

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

### length

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

Gets the number of items in the map.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/mapped_array_slice.rs#L27)

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

### set

```rust
fn set(self: &Self, index: usize, value: T)
```

Writes the specified element of the slice.

Panics when the index is not less than `length`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/mapped_array_slice.rs#L34)

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

### get

```rust
fn get(self: &Self, index: usize) -> T
```

Reads the specified element of the slice.

Panics when the index is not less than `length`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/utilities/mapped_array_slice.rs#L44)

## Trait implementations

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

## Availability

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