# TextRunCache

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/text_formatting/struct-textruncache/

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

```rust
struct TextRunCache
```

Caches shaped text runs and bidi processing results to avoid redundant
shaping when only the paragraph width constraint changes (e.g., between
Measure and Arrange).

Uses an inline single-entry store for the common case of a single
paragraph, and only promotes to a dictionary when multiple entries are
added.

This API is in preview and subject to change without deprecation.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_run_cache.rs#L23)

## Members

- [`new`](#function-new)
- [`invalidate`](#function-invalidate)
- [`retire`](#function-retire)
- [`invalidate_from`](#function-invalidate_from)
- [`dispose`](#function-dispose)

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

### new

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_run_cache.rs#L132)

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

### invalidate

```rust
fn invalidate(self: &Self)
```

Invalidates all cached entries and disposes their shaped buffers.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_run_cache.rs#L137)

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

### retire

```rust
fn retire(self: &Self)
```

Invalidates the cached entries for a new text of the owner, as
`invalidate` does, and keeps the shapings of long texts of the text
before for the new one: an edit of a long text shapes again only what the edit changed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_run_cache.rs#L243)

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

### invalidate_from

```rust
fn invalidate_from(self: &Self, text_source_index: i32)
```

Invalidates all cached entries at or after the specified text source index.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_run_cache.rs#L292)

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

### dispose

```rust
fn dispose(self: &Self)
```

Releases the cache.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/text_formatting/text_run_cache.rs#L374)

## 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`
- `Default`

## Availability

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