Skip to main content

MaterialKey

Trait MaterialKey 

Source
pub trait MaterialKey:
    Any
    + Send
    + Sync
    + 'static {
    // Required method
    fn material(&self) -> &ShaderMaterial;
}
Expand description

A theme-extension newtype that carries a widget-kind’s default material.

Implement on a pub struct FooMaterial(pub ShaderMaterial) for widget Foo, register it with theme.with_ext(FooMaterial(m)), and Foo’s paint resolves it via resolve_material. The newtype (not a bare ShaderMaterial) is what type-keys the theme slot per widget-kind — two widgets can hold different app-wide materials at once.

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§