env

Function env 

Source
pub fn env<S: Clone + Default + 'static, V: View, F: Fn(S, &mut Context) -> V + 'static>(
    f: F,
) -> impl View
Expand description

Reads from the environment.

Examples found in repository?
examples/env.rs (lines 16-21)
15fn my_control() -> impl View {
16    env(|t, _| {
17        circle().color(match t {
18            MyControlType::Chill => AZURE_HIGHLIGHT,
19            MyControlType::Agro => RED_HIGHLIGHT,
20        })
21    })
22}