Function rui::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)
15
16
17
18
19
20
21
22
fn my_control() -> impl View {
    env(|t, _| {
        circle().color(match t {
            MyControlType::Chill => AZURE_HIGHLIGHT,
            MyControlType::Agro => RED_HIGHLIGHT,
        })
    })
}