# CharacterHit

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

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

```rust
struct CharacterHit
```

Represents information about a character hit within a glyph run.

The `CharacterHit` structure provides information about the index of the
first character that got hit as well as information about leading or
trailing edge.

Indices and lengths are UTF-16 code units (see the index-unit note in
`media/text_formatting/mod.rs`).

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

## Members

- [`new`](#function-new)
- [`with_trailing_length`](#function-with_trailing_length)
- [`first_character_index`](#function-first_character_index)
- [`trailing_length`](#function-trailing_length)

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

### new

```rust
const fn new(first_character_index: i32) -> Self
```

Creates a hit on the leading edge of the character at `first_character_index`.

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

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

### with_trailing_length

```rust
const fn with_trailing_length(first_character_index: i32, trailing_length: i32) -> Self
```

Creates a hit with a trailing length.

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

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

### first_character_index

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

Gets the index of the first character that got hit.

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

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

### trailing_length

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

Gets the trailing length value for the character that got hit.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`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/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Copy`
- `Debug`
- `Default`
- `StructuralPartialEq`
- `PartialEq`
- `Eq`
- `Hash`

## Availability

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