diff --git a/crates/ui/src/input/input.rs b/crates/ui/src/input/input.rs index 2fab373d..e5accec0 100644 --- a/crates/ui/src/input/input.rs +++ b/crates/ui/src/input/input.rs @@ -112,8 +112,8 @@ pub struct TextInput { text: SharedString, history: History, blink_cursor: Model, - prefix: Option AnyElement + 'static>>, - suffix: Option AnyElement + 'static>>, + prefix: Option) -> AnyElement + 'static>>, + suffix: Option) -> AnyElement + 'static>>, loading: bool, placeholder: SharedString, selected_range: Range, @@ -212,7 +212,7 @@ impl TextInput { /// Set the prefix element of the input field. pub fn set_prefix(&mut self, builder: F, cx: &mut ViewContext) where - F: Fn(&WindowContext) -> E + 'static, + F: Fn(&ViewContext) -> E + 'static, E: IntoElement, { self.prefix = Some(Box::new(move |cx| builder(cx).into_any_element())); @@ -222,7 +222,7 @@ impl TextInput { /// Set the suffix element of the input field. pub fn set_suffix(&mut self, builder: F, cx: &mut ViewContext) where - F: Fn(&WindowContext) -> E + 'static, + F: Fn(&ViewContext) -> E + 'static, E: IntoElement, { self.suffix = Some(Box::new(move |cx| builder(cx).into_any_element())); @@ -238,7 +238,7 @@ impl TextInput { /// Set the prefix element of the input field, for example a search Icon. pub fn prefix(mut self, builder: F) -> Self where - F: Fn(&mut WindowContext) -> E + 'static, + F: Fn(&mut ViewContext) -> E + 'static, E: IntoElement, { self.prefix = Some(Box::new(move |cx| builder(cx).into_any_element())); @@ -248,7 +248,7 @@ impl TextInput { /// Set the suffix element of the input field, for example a clear button. pub fn suffix(mut self, builder: F) -> Self where - F: Fn(&mut WindowContext) -> E + 'static, + F: Fn(&mut ViewContext) -> E + 'static, E: IntoElement, { self.suffix = Some(Box::new(move |cx| builder(cx).into_any_element()));