pub fn with_ref<V: View, F: Fn(&T) -> V + 'static, T>( binding: impl Binding<T>, f: F ) -> impl View
Convenience to retreive a reference to a value in the context.
9 10 11 12 13 14 15 16
fn my_slider(s: impl Binding<f32>) -> impl View { with_ref(s, move |v| { vstack(( v.to_string().font_size(10).padding(Auto), hslider(s).thumb_color(RED_HIGHLIGHT).padding(Auto), )) }) }