# LineIndex

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-designer-language/struct-lineindex/

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

```rust
struct LineIndex
```

UTF-16 LSP positions over UTF-8 authored bytes, retaining LF/CRLF/CR exactly.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Language/line_index.rs#L31)

## Members

- [`new`](#function-new)
- [`source`](#function-source)
- [`line_count`](#function-line_count)
- [`offset`](#function-offset)
- [`position`](#function-position)
- [`span`](#function-span)
- [`range`](#function-range)
- [`apply`](#function-apply)

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

### new

```rust
fn new(source: &str) -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Language/line_index.rs#L50)

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

### source

```rust
fn source(self: &Self) -> &str
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Language/line_index.rs#L59)

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

### line_count

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Language/line_index.rs#L62)

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

### offset

```rust
fn offset(self: &Self, position: Position) -> Result<usize>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Language/line_index.rs#L65)

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

### position

```rust
fn position(self: &Self, offset: usize) -> Result<Position>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Language/line_index.rs#L94)

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

### span

```rust
fn span(self: &Self, range: Range) -> Result<SourceSpan>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Language/line_index.rs#L109)

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

### range

```rust
fn range(self: &Self, span: SourceSpan) -> Result<Range>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Language/line_index.rs#L115)

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

### apply

```rust
fn apply(self: &mut Self, change: &TextChange) -> Result<()>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Designer.Language/line_index.rs#L122)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `Clone`
- `Debug`

## Availability

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