# TextHighlightRange

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/documents/struct-texthighlightrange/

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

```rust
struct TextHighlightRange
```

A copied start/length value in UTF-16 coordinates.

The signed fields preserve the source value contract. Invalid values can be
represented (including in markup), but renderers ignore them. Rust ranges
use half-open endpoints. This type is called TextRange in markup; its Rust
name distinguishes it from the document's live pointer range.

Cloning copies both fields. Interior mutability exists only so markup can
initialize a boxed value; collections always copy values on insertion/read.

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

## Members

- [`new`](#function-new)
- [`start_index`](#function-start_index)
- [`set_start_index`](#function-set_start_index)
- [`length`](#function-length)
- [`set_length`](#function-set_length)
- [`from_range`](#function-from_range)
- [`to_range`](#function-to_range)
- [`range`](#function-range)
- [`parse`](#function-parse)

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

### new

```rust
fn new(start_index: i32, length: i32) -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/text_highlight_range.rs#L52)

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

### start_index

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/text_highlight_range.rs#L59)

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

### set_start_index

```rust
fn set_start_index(self: &Self, value: i32)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/text_highlight_range.rs#L62)

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

### length

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/text_highlight_range.rs#L65)

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

### set_length

```rust
fn set_length(self: &Self, value: i32)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/text_highlight_range.rs#L68)

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

### from_range

```rust
fn from_range(range: Range<usize>) -> Result<Self, TextHighlightError>
```

Converts a half-open UTF-16 range without truncating either endpoint.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/text_highlight_range.rs#L73)

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

### to_range

```rust
fn to_range(self: &Self) -> Result<Range<usize>, TextHighlightError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/text_highlight_range.rs#L82)

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

### range

```rust
fn range(self: &Self) -> Option<Range<usize>>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/text_highlight_range.rs#L94)

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

### parse

```rust
fn parse(text: &str) -> Result<Self, FormatError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/documents/text_highlight_range.rs#L98)

## 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`
- [`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`
- `Debug`
- `Default`
- `StructuralPartialEq`
- `PartialEq`
- `Eq`
- `TryFrom<Range<usize>>`
- `Display`
- [`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/).
