# TypeIdentity

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

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

```rust
struct TypeIdentity
```

The identity of a class: what a type check (`is::<T>()`, `cast::<T>()`,
`downcast_ref::<T>()`) compares. One static per class, made by
`ferro_class!`; the [`TypeInfo`](/docs/0.5.0/api/ferroui-base/struct-typeinfo/) of the class points to it.

A type check names only this, not the [`TypeInfo`](/docs/0.5.0/api/ferroui-base/struct-typeinfo/) of the class, whose
initialisation, constructor and markup metadata the linker then keeps
only when something uses them: checking whether an object is a
`RichTextBlock` does not link the rich text block into an application
that never creates one (#612).

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

## Members

- [`new`](#function-new)
- [`name`](#function-name)

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

### new

```rust
const fn new(name: &'static str) -> Self
```

The identity of the class `name`. Each class has its own static of
this type; two identities are the same only if they are the same
static.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/type_system.rs#L58)

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

### name

```rust
const fn name(self: &Self) -> &'static str
```

The name of the class, for diagnostics.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/type_system.rs#L63)

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

## Availability

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