use component_shape_gpui::{
GpuiComponentShapeFor, GpuiComponentValueBinding, ValueChange, component_shape,
};
pub struct InputState;
impl InputState {
fn new(_window: &mut gpui_kit::Window, _cx: &mut gpui_kit::Context<'_, Self>) -> Self {
Self
}
}
#[derive(Clone, Debug)]
pub enum InputEvent {
Change(String),
}
impl gpui_kit::EventEmitter<InputEvent> for InputState {}
component_shape! {
pub struct InputShape {
type State = InputState;
value = String;
value_binding;
impl GpuiComponentValueBinding<String> for InputShape {
type Event = InputEvent;
fn value_change(_state: &Self::State, event: &Self::Event) -> ValueChange<String> {
match event {
InputEvent::Change(value) => ValueChange::Set(value.clone()),
}
}
}
}
}
fn assert_string_shape()
where
InputShape: GpuiComponentShapeFor<String> + GpuiComponentValueBinding<String>,
{
}
fn main() {
assert_string_shape();
}