use crate::{HasUi, StateLike, WidgetIdFn, WidgetLike, WidgetRef}; pub trait WidgetAttr { type Input; fn run(state: &mut State, id: WidgetRef, input: Self::Input); } pub trait Attrable { fn attr>(self, input: A::Input) -> impl WidgetIdFn; } impl, WL: WidgetLike, Tag> Attrable for WL { fn attr>( self, input: A::Input, ) -> impl WidgetIdFn { |state| { let id = self.add(state); A::run(state, id, input); id } } }