# BidiData

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

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

```rust
struct BidiData
```

Represents a unicode string and all associated attributes
for each character required for the bidirectional Unicode algorithm

To avoid allocations, this class is designed to be reused.

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

## Members

- [`new`](#function-new)
- [`paragraph_embedding_level`](#function-paragraph_embedding_level)
- [`set_paragraph_embedding_level`](#function-set_paragraph_embedding_level)
- [`has_brackets`](#function-has_brackets)
- [`has_embeddings`](#function-has_embeddings)
- [`has_isolates`](#function-has_isolates)
- [`length`](#function-length)
- [`classes`](#function-classes)
- [`classes_mut`](#function-classes_mut)
- [`paired_bracket_types`](#function-paired_bracket_types)
- [`paired_bracket_types_mut`](#function-paired_bracket_types_mut)
- [`paired_bracket_values`](#function-paired_bracket_values)
- [`append`](#function-append)
- [`save_types`](#function-save_types)
- [`restore_types`](#function-restore_types)
- [`get_temp_level_buffer`](#function-get_temp_level_buffer)
- [`reset`](#function-reset)

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

### new

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



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

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

### paragraph_embedding_level

```rust
fn paragraph_embedding_level(self: &Self) -> i8
```



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

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

### set_paragraph_embedding_level

```rust
fn set_paragraph_embedding_level(self: &mut Self, value: i8)
```



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

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

### has_brackets

```rust
fn has_brackets(self: &Self) -> Option<bool>
```



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

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

### has_embeddings

```rust
fn has_embeddings(self: &Self) -> Option<bool>
```



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

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

### has_isolates

```rust
fn has_isolates(self: &Self) -> Option<bool>
```



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

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

### length

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

Gets the length of the data held by the BidiData

This is the number of codepoints appended (a surrogate pair counts once).

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

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

### classes

```rust
fn classes(self: &Self) -> &[BidiClass]
```

Gets the bidi character type of each code point

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

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

### classes_mut

```rust
fn classes_mut(self: &mut Self) -> &mut [BidiClass]
```

The mutable view of `BidiData::classes` (the slice is writable upstream).

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

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

### paired_bracket_types

```rust
fn paired_bracket_types(self: &Self) -> &[BidiPairedBracketType]
```

Gets the paired bracket type for each code point

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

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

### paired_bracket_types_mut

```rust
fn paired_bracket_types_mut(self: &mut Self) -> &mut [BidiPairedBracketType]
```

The mutable view of `BidiData::paired_bracket_types` (the slice is writable upstream).

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

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

### paired_bracket_values

```rust
fn paired_bracket_values(self: &Self) -> &[i32]
```

Gets the paired bracket value for code point

The paired bracket values are the code points
of each character where the opening code point
is replaced with the closing code point for easier
matching.  Also, bracket code points are mapped
to their canonical equivalents

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

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

### append

```rust
fn append(self: &mut Self, text: &[u16])
```

Appends text to the bidi data.

* `text` - The text to process.

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

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

### save_types

```rust
fn save_types(self: &mut Self)
```

Save the Types and PairedBracketTypes of this BiDiData

This is used when processing embedded style runs with
BiDiClass overrides. Text layout process saves the data,
overrides the style runs to neutral, processes the bidi
data for the entire paragraph and then restores this data
before processing the embedded runs.

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

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

### restore_types

```rust
fn restore_types(self: &mut Self)
```

Restore the data saved by SaveTypes

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

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

### get_temp_level_buffer

```rust
fn get_temp_level_buffer(self: &mut Self, length: usize) -> &mut [i8]
```

Gets a temporary level buffer. Used by the text layout process when
resolving style runs with different BiDiClass.

* `length` - Length of the required buffer

Returns a level buffer of that length (zeroed here; uninitialized upstream).

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

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

### reset

```rust
fn reset(self: &mut Self)
```

Resets the bidi data to a clean state.

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

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

## Availability

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