# NameScopeExtensions

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

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

```rust
struct NameScopeExtensions
```

Name scope lookups anchored at a styled element.

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

## Members

- [`find`](#function-find)
- [`get`](#function-get)
- [`find_name_scope`](#function-find_name_scope)

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

### find

```rust
fn find<T: ObjectType>(anchor: &StyledElement, name: &str) -> Option<Ref<T>>
```

Finds a named element in the name scope attached to `anchor`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/name_scope_extensions.rs#L38)

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

### get

```rust
fn get<T: ObjectType>(anchor: &StyledElement, name: &str) -> Ref<T>
```

Gets a named element from the name scope attached to `anchor`.

Panics if the element has no name scope, the name is not registered or
the named element is of a different class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/name_scope_extensions.rs#L46)

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

### find_name_scope

```rust
fn find_name_scope(control: &StyledElement) -> Option<NameScopeRef>
```

Finds the name scope of `control` by walking up its logical ancestors.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/name_scope_extensions.rs#L56)

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

## Availability

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