# IndexRange

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

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

```rust
struct IndexRange
```

An inclusive range of indexes.

The arithmetic wraps on overflow, as the managed implementation's does:
"select all" without a source selects the range `0..=i32::MAX`.

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

## Members

- [`from_index`](#function-from_index)
- [`new`](#function-new)
- [`begin`](#function-begin)
- [`end`](#function-end)
- [`count`](#function-count)
- [`contains`](#function-contains)
- [`split`](#function-split)
- [`intersects`](#function-intersects)
- [`adjacent`](#function-adjacent)
- [`contains_in`](#function-contains_in)
- [`get_at`](#function-get_at)
- [`add`](#function-add)
- [`add_ranges`](#function-add_ranges)
- [`intersect`](#function-intersect)
- [`remove`](#function-remove)
- [`remove_ranges`](#function-remove_ranges)
- [`enumerate_indices`](#function-enumerate_indices)
- [`get_count`](#function-get_count)

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

### from_index

```rust
fn from_index(index: i32) -> Self
```

A range holding a single index.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L21)

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

### new

```rust
fn new(begin: i32, end: i32) -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L25)

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

### begin

```rust
fn begin(self: &Self) -> i32
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L35)

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

### end

```rust
fn end(self: &Self) -> i32
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L40)

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

### count

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L45)

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

### contains

```rust
fn contains(self: &Self, index: i32) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L50)

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

### split

```rust
fn split(self: &Self, split_index: i32) -> (IndexRange, Option<IndexRange>)
```

Splits the range after `split_index`: the part up to and including
the index, and the part after it if there is one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L56)

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

### intersects

```rust
fn intersects(self: &Self, other: IndexRange) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L66)

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

### adjacent

```rust
fn adjacent(self: &Self, other: IndexRange) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L70)

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

### contains_in

```rust
fn contains_in(ranges: Option<&[IndexRange]>, index: i32) -> bool
```

Whether any of the ranges contains the index.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L75)

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

### get_at

```rust
fn get_at(ranges: &[IndexRange], index: i32) -> i32
```

The `index`th index of the ranges.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L88)

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

### add

```rust
fn add(ranges: &mut Vec<IndexRange>, range: IndexRange, added: Option<&mut Vec<IndexRange>>) -> i32
```

Adds a range to the ranges. Returns the number of indexes added,
which are recorded in `added`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L106)

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

### add_ranges

```rust
fn add_ranges(destination: &mut Vec<IndexRange>, source: &[IndexRange], added: Option<&mut Vec<IndexRange>>) -> i32
```

Adds each of the `source` ranges to `destination`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L150)

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

### intersect

```rust
fn intersect(ranges: &mut Vec<IndexRange>, range: IndexRange, removed: Option<&mut Vec<IndexRange>>) -> i32
```

Restricts the ranges to `range`. Returns the number of indexes
removed, which are recorded in `removed`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L166)

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

### remove

```rust
fn remove(ranges: Option<&mut Vec<IndexRange>>, range: IndexRange, removed: Option<&mut Vec<IndexRange>>) -> i32
```

Removes a range from the ranges. Returns the number of indexes
removed, which are recorded in `removed`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L215)

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

### remove_ranges

```rust
fn remove_ranges(destination: &mut Vec<IndexRange>, source: &[IndexRange], added: Option<&mut Vec<IndexRange>>) -> i32
```

Removes each of the `source` ranges from `destination`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L269)

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

### enumerate_indices

```rust
fn enumerate_indices(ranges: Rc<Vec<IndexRange>>) -> IndexRangeIndices
```

Enumerates the indexes of the ranges.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L284)

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

### get_count

```rust
fn get_count(ranges: &[IndexRange]) -> i32
```

The number of indexes in the ranges.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/selection/index_range.rs#L289)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ToString`
- [`ResourceKeyObject`](/docs/0.5.0/api/ferroui-base/controls/trait-resourcekeyobject/)
- [`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`
- `Copy`
- `Debug`
- `StructuralPartialEq`
- `PartialEq`
- `Eq`
- `Hash`
- `Display`

## Availability

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