# ArraySlice

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

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

```rust
struct ArraySlice<T>
```

A view over `length` elements of a shared array starting at `start`.

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

## Members

- [`empty`](#function-empty)
- [`new`](#function-new)
- [`from_shared`](#function-from_shared)
- [`data`](#function-data)
- [`is_empty`](#function-is_empty)
- [`start`](#function-start)
- [`length`](#function-length)
- [`span`](#function-span)
- [`span_mut`](#function-span_mut)
- [`set`](#function-set)
- [`slice`](#function-slice)
- [`take`](#function-take)
- [`skip`](#function-skip)
- [`get`](#function-get)
- [`fill`](#function-fill)

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

### empty

```rust
fn empty() -> Self
```

An empty slice (C# `ArraySlice<T>.Empty`).

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

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

### new

```rust
fn new(data: Vec<T>) -> Self
```

A slice over a whole new array.

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

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

### from_shared

```rust
fn from_shared(data: Rc<RefCell<Vec<T>>>, start: usize, length: usize) -> Self
```

A slice over part of a shared array.

Panics when the range is outside the array.

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

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

### data

```rust
fn data(self: &Self) -> &Rc<RefCell<Vec<T>>>
```

The shared array this slice views.

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

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

### is_empty

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

Whether the slice has no elements.

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

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

### start

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

The offset of the slice inside the shared array.

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

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

### length

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

The number of elements.

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

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

### span

```rust
fn span(self: &Self) -> Ref<'_, [T]>
```

Borrows the elements (C# `Span`).

Panics when the array is mutably borrowed.

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

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

### span_mut

```rust
fn span_mut(self: &Self) -> RefMut<'_, [T]>
```

Mutably borrows the elements (C# `Span`).

Panics when the array is borrowed.

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

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

### set

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

Writes one element.

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

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

### slice

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

A slice of the same array. As upstream, `start` is relative to the
underlying array, not to this slice.

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

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

### take

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

The first `length` elements.

Panics when `length` is larger than the slice.

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

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

### skip

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

Everything after the first `length` elements.

Panics when `length` is larger than the slice.

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

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

### get

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

Reads one element.

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

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

### fill

```rust
fn fill(self: &Self, value: T)
```

Sets every element to `value`.

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

## Trait implementations

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

## Availability

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