Skip to main content

EnabledCursorExt

Trait EnabledCursorExt 

Source
pub trait EnabledCursorExt:
    Styled
    + Sized
    + FluentBuilder {
    // Provided method
    fn cursor_for_enabled(self, enabled: bool) -> Self { ... }
}
Expand description

Extension trait for applying cursor styling based on enabled state.

This reduces the common pattern of:

.when(enabled, |d| d.cursor_pointer())
.when(!enabled, |d| d.cursor_default())

To simply:

.cursor_for_enabled(enabled)

Provided Methods§

Source

fn cursor_for_enabled(self, enabled: bool) -> Self

Apply cursor styling based on enabled state. When enabled, uses pointer cursor; otherwise uses default cursor.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§