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