Struct zng_app::widget::builder::WidgetBuilderProperties
source · pub struct WidgetBuilderProperties { /* private fields */ }
Expand description
Direct property access in WidgetBuilder
and WidgetBuilding
.
Implementations§
source§impl WidgetBuilderProperties
impl WidgetBuilderProperties
sourcepub fn property(
&self,
property_id: PropertyId,
) -> Option<BuilderPropertyRef<'_>>
pub fn property( &self, property_id: PropertyId, ) -> Option<BuilderPropertyRef<'_>>
Reference the property, if it is present.
sourcepub fn property_mut(
&mut self,
property_id: PropertyId,
) -> Option<BuilderPropertyMut<'_>>
pub fn property_mut( &mut self, property_id: PropertyId, ) -> Option<BuilderPropertyMut<'_>>
Modify the property, if it is present.
sourcepub fn properties(&self) -> impl Iterator<Item = BuilderPropertyRef<'_>>
pub fn properties(&self) -> impl Iterator<Item = BuilderPropertyRef<'_>>
Iterate over the current properties.
The properties may not be sorted in the correct order if the builder has never built.
sourcepub fn properties_mut(&mut self) -> impl Iterator<Item = BuilderPropertyMut<'_>>
pub fn properties_mut(&mut self) -> impl Iterator<Item = BuilderPropertyMut<'_>>
iterate over mutable references to the current properties.
sourcepub fn capture_value<T>(&mut self, property_id: PropertyId) -> Option<T>where
T: VarValue,
pub fn capture_value<T>(&mut self, property_id: PropertyId) -> Option<T>where
T: VarValue,
Flags the property as captured and downcast the input value.
Unlike other property kinds you can capture values in the WidgetBuilder
, note that the value may not
the final value, unless you are capturing on build.
Other property kinds can only be captured in WidgetBuilding
as
their values strongly depend on the final when
blocks that are only applied after building starts.
sourcepub fn capture_value_or_else<T>(
&mut self,
property_id: PropertyId,
or_else: impl FnOnce() -> T,
) -> Twhere
T: VarValue,
pub fn capture_value_or_else<T>(
&mut self,
property_id: PropertyId,
or_else: impl FnOnce() -> T,
) -> Twhere
T: VarValue,
Flags the property as captured and downcast the input value, or calls or_else
to generate the value.
sourcepub fn capture_value_or_default<T>(&mut self, property_id: PropertyId) -> T
pub fn capture_value_or_default<T>(&mut self, property_id: PropertyId) -> T
Flags the property as captured and downcast the input value, or returns the default value.
Auto Trait Implementations§
impl Freeze for WidgetBuilderProperties
impl !RefUnwindSafe for WidgetBuilderProperties
impl Send for WidgetBuilderProperties
impl Sync for WidgetBuilderProperties
impl Unpin for WidgetBuilderProperties
impl !UnwindSafe for WidgetBuilderProperties
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more