[−][src]Struct druid::Env
An environment passed down through all widget traversals.
All widget methods have access to an environment, and it is passed downwards during traversals.
A widget can retrieve theme parameters (colors, dimensions, etc.). In addition, it can pass custom data down to all descendants. An important example of the latter is setting a value for enabled/disabled status so that an entire subtree can be disabled ("grayed out") with one setting.
Methods
impl Env
[src]
pub fn get<'a, V: ValueType<'a>>(&'a self, key: Key<V>) -> V
[src]
Gets a value from the environment, expecting it to be present.
Note that the return value is a reference for "expensive" types such as strings, but an ordinary value for "cheap" types such as numbers and colors.
Panics
Panics if the key is not found, or if it is present with the wrong type.
pub fn try_get<'a, V: ValueType<'a>>(&'a self, key: Key<V>) -> Option<V>
[src]
Gets a value from the environment.
Panics
Panics if the value for the key is found, but has the wrong type.
pub fn adding<'a, V: ValueType<'a>>(
self,
key: Key<V>,
value: impl Into<V::Owned>
) -> Env
[src]
self,
key: Key<V>,
value: impl Into<V::Owned>
) -> Env
Adds a key/value, acting like a builder.
pub fn set<'a, V: ValueType<'a>>(
&'a mut self,
key: Key<V>,
value: impl Into<V::Owned>
)
[src]
&'a mut self,
key: Key<V>,
value: impl Into<V::Owned>
)
Sets a value in an environment.
Panics
Panics if the environment already has a value for the key, but it is of a different type.
pub fn localization_manager(&self) -> &L10nManager
[src]
Returns a reference to the L10nManager
, which handles localization
resources.
Trait Implementations
Auto Trait Implementations
impl Send for Env
impl Sync for Env
impl Unpin for Env
impl !UnwindSafe for Env
impl !RefUnwindSafe for Env
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> RoundFrom<T> for T
fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,