Struct zng::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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for 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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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