pub struct WidgetBuilding { /* private fields */ }
Expand description
Represents a finalizing WidgetBuilder
.
Widgets can register a build action to get access to this, it provides an opportunity
to remove or capture the final properties of a widget, after they have all been resolved and when
assigns generated.
Build actions can also define the child node, intrinsic nodes and a custom builder.
Implementations§
source§impl WidgetBuilding
impl WidgetBuilding
sourcepub fn widget_type(&self) -> WidgetType
pub fn widget_type(&self) -> WidgetType
The widget that started this builder.
sourcepub fn has_child(&self) -> bool
pub fn has_child(&self) -> bool
If an innermost node is defined.
If false
by the end of build the FillUiNode
is used as the innermost node.
sourcepub fn disable_inspector(&mut self)
pub fn disable_inspector(&mut self)
Don’t insert the inspector node and inspector metadata on build.
The inspector metadata is inserted by default when feature="inspector"
is active.
sourcepub fn disable_trace_widget(&mut self)
pub fn disable_trace_widget(&mut self)
Don’t insert the widget trace node on build.
The trace node is inserted by default when feature="trace_widget"
is active.
sourcepub fn disable_trace_wgt_item(&mut self)
pub fn disable_trace_wgt_item(&mut self)
Don’t insert property/intrinsic trace nodes on build.
The trace nodes is inserted by default when feature="trace_wgt_item"
is active.
sourcepub fn push_intrinsic<I>(
&mut self,
group: NestGroup,
name: &'static str,
intrinsic: impl FnOnce(Box<dyn UiNodeBoxed>) -> I + Send + Sync + 'static,
)where
I: UiNode,
pub fn push_intrinsic<I>(
&mut self,
group: NestGroup,
name: &'static str,
intrinsic: impl FnOnce(Box<dyn UiNodeBoxed>) -> I + Send + Sync + 'static,
)where
I: UiNode,
Insert intrinsic node, that is a core functionality node of the widget that cannot be overridden.
The name
is used for inspector/trace only, intrinsic nodes are not deduplicated.
sourcepub fn push_intrinsic_positioned<I>(
&mut self,
position: NestPosition,
name: &'static str,
intrinsic: impl FnOnce(Box<dyn UiNodeBoxed>) -> I + Send + Sync + 'static,
)where
I: UiNode,
pub fn push_intrinsic_positioned<I>(
&mut self,
position: NestPosition,
name: &'static str,
intrinsic: impl FnOnce(Box<dyn UiNodeBoxed>) -> I + Send + Sync + 'static,
)where
I: UiNode,
Insert intrinsic node with custom nest position.
The name
is used for inspector/trace only, intrinsic nodes are not deduplicated.
sourcepub fn remove_property(
&mut self,
property_id: PropertyId,
) -> Option<BuilderProperty>
pub fn remove_property( &mut self, property_id: PropertyId, ) -> Option<BuilderProperty>
Removes the property.
Note that if the property can already be captured by another widget component.
sourcepub fn capture_property(
&mut self,
property_id: PropertyId,
) -> Option<BuilderPropertyRef<'_>>
pub fn capture_property( &mut self, property_id: PropertyId, ) -> Option<BuilderPropertyRef<'_>>
Flags the property as captured and returns a reference to it.
Note that captured properties are not instantiated in the final build, but they also are not removed like unset.
A property can be “captured” more then once, and if the "inspector"
feature is enabled they can be inspected.
sourcepub fn capture_var<T>(
&mut self,
property_id: PropertyId,
) -> Option<Box<dyn VarBoxed<T>>>where
T: VarValue,
pub fn capture_var<T>(
&mut self,
property_id: PropertyId,
) -> Option<Box<dyn VarBoxed<T>>>where
T: VarValue,
Flags the property as captured and downcast the input var.
sourcepub fn capture_var_or_else<T, F>(
&mut self,
property_id: PropertyId,
or_else: impl FnOnce() -> F,
) -> Box<dyn VarBoxed<T>>
pub fn capture_var_or_else<T, F>( &mut self, property_id: PropertyId, or_else: impl FnOnce() -> F, ) -> Box<dyn VarBoxed<T>>
Flags the property as captured and downcast the input var, or calls or_else
to generate a fallback.
sourcepub fn capture_var_or_default<T>(
&mut self,
property_id: PropertyId,
) -> Box<dyn VarBoxed<T>>
pub fn capture_var_or_default<T>( &mut self, property_id: PropertyId, ) -> Box<dyn VarBoxed<T>>
Flags the property as captured and downcast the input var, returns a new one with the default value.
sourcepub fn capture_ui_node(
&mut self,
property_id: PropertyId,
) -> Option<Box<dyn UiNodeBoxed>>
pub fn capture_ui_node( &mut self, property_id: PropertyId, ) -> Option<Box<dyn UiNodeBoxed>>
Flags the property as captured and get the input node.
sourcepub fn capture_ui_node_or_else<F>(
&mut self,
property_id: PropertyId,
or_else: impl FnOnce() -> F,
) -> Box<dyn UiNodeBoxed>where
F: UiNode,
pub fn capture_ui_node_or_else<F>(
&mut self,
property_id: PropertyId,
or_else: impl FnOnce() -> F,
) -> Box<dyn UiNodeBoxed>where
F: UiNode,
Flags the property as captured and get the input node, or calls or_else
to generate a fallback node.
sourcepub fn capture_ui_node_list(
&mut self,
property_id: PropertyId,
) -> Option<Box<dyn UiNodeListBoxed>>
pub fn capture_ui_node_list( &mut self, property_id: PropertyId, ) -> Option<Box<dyn UiNodeListBoxed>>
Flags the property as captured and get the input list.
sourcepub fn capture_ui_node_list_or_else<F>(
&mut self,
property_id: PropertyId,
or_else: impl FnOnce() -> F,
) -> Box<dyn UiNodeListBoxed>where
F: UiNodeList,
pub fn capture_ui_node_list_or_else<F>(
&mut self,
property_id: PropertyId,
or_else: impl FnOnce() -> F,
) -> Box<dyn UiNodeListBoxed>where
F: UiNodeList,
Flags the property as captured and get the input list, or calls or_else
to generate a fallback list.
sourcepub fn capture_ui_node_list_or_empty(
&mut self,
property_id: PropertyId,
) -> Box<dyn UiNodeListBoxed>
pub fn capture_ui_node_list_or_empty( &mut self, property_id: PropertyId, ) -> Box<dyn UiNodeListBoxed>
Flags the property as captured and get the input list, or returns an empty list.
sourcepub fn capture_widget_handler<A>(
&mut self,
property_id: PropertyId,
) -> Option<ArcWidgetHandler<A>>where
A: Clone + 'static,
pub fn capture_widget_handler<A>(
&mut self,
property_id: PropertyId,
) -> Option<ArcWidgetHandler<A>>where
A: Clone + 'static,
Flags the property as captured and downcast the input handler.
Methods from Deref<Target = 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.
Trait Implementations§
source§impl Deref for WidgetBuilding
impl Deref for WidgetBuilding
source§type Target = WidgetBuilderProperties
type Target = WidgetBuilderProperties
source§impl DerefMut for WidgetBuilding
impl DerefMut for WidgetBuilding
Auto Trait Implementations§
impl Freeze for WidgetBuilding
impl !RefUnwindSafe for WidgetBuilding
impl Send for WidgetBuilding
impl !Sync for WidgetBuilding
impl Unpin for WidgetBuilding
impl !UnwindSafe for WidgetBuilding
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> 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