# NativeTextureView

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-media-opengl/struct-nativetextureview/

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

```rust
struct NativeTextureView
```

An immutable GL_TEXTURE_2D alias of retained native storage. The release
callback owns both the alias and its backing, and runs on the owning render
context after all consumer leases have finished. None means context loss.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.OpenGL/native_view.rs#L10)

## Members

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

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

### new

```rust
unsafe fn new(context: Rc<dyn IGlContext>, texture: u32, release: impl FnOnce(Option<&GlInterface>) -> () + Send + 'static) -> Self
```

## Safety
The texture must be complete RGBA8-compatible immutable storage, readable
by the current context with native producer synchronization established.
`release` must own the backing, delete the alias only on Some(context),
and safely release native-only resources on None. No borrowed handles may
escape the callback's owned captures. Never delete this texture elsewhere.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Media.OpenGL/native_view.rs#L22)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Drop`

## Availability

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