Skip to main content

GpuiTableFilterShape

Trait GpuiTableFilterShape 

Source
pub trait GpuiTableFilterShape: ComponentShapeMetadata {
    type Component: 'static;
    type RawValue: Default + Clone + Send + 'static;
    type FilterValue: Clone + Send + 'static;

    const FILTER_TYPE: RegistryFilterType;

    // Required methods
    fn new_for(
        title: impl Fn(&App) -> String + 'static,
        value: Self::RawValue,
        on_change: impl Fn(Self::RawValue, &mut Window, &mut App) + 'static,
        cx: &mut App,
    ) -> Entity<Self::Component>;
    fn read_value(entity: &Entity<Self::Component>, cx: &App) -> Self::RawValue;
    fn wrap_value(value: Self::RawValue) -> Self::FilterValue;
    fn reset_silent(
        entity: &Entity<Self::Component>,
        window: &mut Window,
        cx: &mut App,
    );

    // Provided methods
    fn unwrap_value(_value: Self::FilterValue) -> Self::RawValue { ... }
    fn set_silent(
        entity: &Entity<Self::Component>,
        _value: Self::RawValue,
        window: &mut Window,
        cx: &mut App,
    ) { ... }
}
Expand description

Table-specific filter shape contract consumed by #[derive(GpuiTable)].

Required Associated Constants§

Required Associated Types§

Source

type Component: 'static

Source

type RawValue: Default + Clone + Send + 'static

Source

type FilterValue: Clone + Send + 'static

Required Methods§

Source

fn new_for( title: impl Fn(&App) -> String + 'static, value: Self::RawValue, on_change: impl Fn(Self::RawValue, &mut Window, &mut App) + 'static, cx: &mut App, ) -> Entity<Self::Component>

Source

fn read_value(entity: &Entity<Self::Component>, cx: &App) -> Self::RawValue

Source

fn wrap_value(value: Self::RawValue) -> Self::FilterValue

Source

fn reset_silent( entity: &Entity<Self::Component>, window: &mut Window, cx: &mut App, )

Reset the component without running its public change callback.

Provided Methods§

Source

fn unwrap_value(_value: Self::FilterValue) -> Self::RawValue

Convert a generated typed filter value back into component-facing state.

Implement this together with Self::set_silent when generated filter collections should support apply_values(...) for restored presets.

Source

fn set_silent( entity: &Entity<Self::Component>, _value: Self::RawValue, window: &mut Window, cx: &mut App, )

Replace the component value without running its public change callback.

The default resets the component. Shapes that support applying a non-default typed preset must override this method.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§