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§
type Component: 'static
type RawValue: Default + Clone + Send + 'static
type FilterValue: Clone + Send + 'static
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
Provided Methods§
Sourcefn unwrap_value(_value: Self::FilterValue) -> Self::RawValue
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.
Sourcefn set_silent(
entity: &Entity<Self::Component>,
_value: Self::RawValue,
window: &mut Window,
cx: &mut App,
)
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".