[][src]Struct druid::widget::EnvScope

pub struct EnvScope<T, W> { /* fields omitted */ }

A widget that accepts a closure to update the environment for its child.

Implementations

impl<T, W: Widget<T>> EnvScope<T, W>[src]

pub fn new(f: impl Fn(&mut Env, &T) + 'static, child: W) -> EnvScope<T, W>[src]

Create a widget that updates the environment for its descendants.

Accepts a closure that sets Env values.

This is available as WidgetExt::env_scope for convenience.

Examples

EnvScope::new(
    |env, data| {
        env.set(theme::LABEL_COLOR, Color::WHITE);
    },
    Label::new("White text!")
)

Trait Implementations

impl<T: Data, W: Widget<T>> Widget<T> for EnvScope<T, W>[src]

Auto Trait Implementations

impl<T, W> !RefUnwindSafe for EnvScope<T, W>[src]

impl<T, W> !Send for EnvScope<T, W>[src]

impl<T, W> !Sync for EnvScope<T, W>[src]

impl<T, W> Unpin for EnvScope<T, W> where
    T: Unpin,
    W: Unpin
[src]

impl<T, W> !UnwindSafe for EnvScope<T, W>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.