pub struct AdoptiveNode { /* private fields */ }Expand description
Represents a node setup to dynamically swap child.
Any property node can be made adoptive by wrapping it with this node.
Implementations§
Source§impl AdoptiveNode
impl AdoptiveNode
Sourcepub fn new(create: impl FnOnce(AdoptiveChildNode) -> UiNode) -> AdoptiveNode
pub fn new(create: impl FnOnce(AdoptiveChildNode) -> UiNode) -> AdoptiveNode
Create the adoptive node, the AdoptiveChildNode must be used as the child of the created node.
The created node is assumed to not be inited.
Sourcepub fn try_new<E>(
create: impl FnOnce(AdoptiveChildNode) -> Result<UiNode, E>,
) -> Result<AdoptiveNode, E>
pub fn try_new<E>( create: impl FnOnce(AdoptiveChildNode) -> Result<UiNode, E>, ) -> Result<AdoptiveNode, E>
Create the adoptive node using a closure that can fail.
The created node is assumed to not be inited.
Sourcepub fn replace_child(&mut self, new_child: UiNode) -> UiNode
pub fn replace_child(&mut self, new_child: UiNode) -> UiNode
Replaces the child node.
Returns the previous child, the initial child is a UiNode::nil.
§Panics
Panics if is_inited.
Sourcepub fn into_parts(self) -> (Arc<Mutex<RawMutex, UiNode>>, UiNode)
pub fn into_parts(self) -> (Arc<Mutex<RawMutex, UiNode>>, UiNode)
Sourcepub fn from_parts(
child: Arc<Mutex<RawMutex, UiNode>>,
node: UiNode,
) -> AdoptiveNode
pub fn from_parts( child: Arc<Mutex<RawMutex, UiNode>>, node: UiNode, ) -> AdoptiveNode
From parts, assumes the nodes are not inited and that child is the actual child of node.
Trait Implementations§
Source§impl UiNodeImpl for AdoptiveNode
impl UiNodeImpl for AdoptiveNode
Source§fn children_len(&self) -> usize
fn children_len(&self) -> usize
Gets the current count of children nodes.
Source§fn try_for_each_child(
&mut self,
visitor: &mut dyn FnMut(usize, &mut UiNode) -> ControlFlow<BoxAnyVarValue>,
) -> ControlFlow<BoxAnyVarValue>
fn try_for_each_child( &mut self, visitor: &mut dyn FnMut(usize, &mut UiNode) -> ControlFlow<BoxAnyVarValue>, ) -> ControlFlow<BoxAnyVarValue>
Source§fn par_each_child(&mut self, visitor: &(dyn Fn(usize, &mut UiNode) + Sync))
fn par_each_child(&mut self, visitor: &(dyn Fn(usize, &mut UiNode) + Sync))
Calls
visitor for each child node in parallel. Read moreSource§fn par_fold_reduce(
&mut self,
identity: BoxAnyVarValue,
fold: &(dyn Fn(BoxAnyVarValue, usize, &mut UiNode) -> BoxAnyVarValue + Sync),
reduce: &(dyn Fn(BoxAnyVarValue, BoxAnyVarValue) -> BoxAnyVarValue + Sync),
) -> BoxAnyVarValue
fn par_fold_reduce( &mut self, identity: BoxAnyVarValue, fold: &(dyn Fn(BoxAnyVarValue, usize, &mut UiNode) -> BoxAnyVarValue + Sync), reduce: &(dyn Fn(BoxAnyVarValue, BoxAnyVarValue) -> BoxAnyVarValue + Sync), ) -> BoxAnyVarValue
Calls
fold for each child node in parallel, with fold accumulators produced by cloning identity, then merges the folded results
using reduce to produce the final value also in parallel. Read moreSource§fn info(&mut self, info: &mut WidgetInfoBuilder)
fn info(&mut self, info: &mut WidgetInfoBuilder)
Builds widget info. Read more
Source§fn event(&mut self, update: &EventUpdate)
fn event(&mut self, update: &EventUpdate)
Receives an event. Read more
Source§fn update(&mut self, updates: &WidgetUpdates)
fn update(&mut self, updates: &WidgetUpdates)
Receives variable and other non-event updates. Read more
Source§fn update_list(
&mut self,
updates: &WidgetUpdates,
observer: &mut dyn UiNodeListObserver,
)
fn update_list( &mut self, updates: &WidgetUpdates, observer: &mut dyn UiNodeListObserver, )
Does
update and if the node is a list notifies list changes to the observer.Source§fn measure(&mut self, wm: &mut WidgetMeasure) -> Size2D<Px, Px>
fn measure(&mut self, wm: &mut WidgetMeasure) -> Size2D<Px, Px>
Computes the widget size given the contextual layout metrics without actually updating the widget layout. Read more
Source§fn measure_list(
&mut self,
wm: &mut WidgetMeasure,
measure: &(dyn Fn(usize, &mut UiNode, &mut WidgetMeasure) -> Size2D<Px, Px> + Sync),
fold_size: &(dyn Fn(Size2D<Px, Px>, Size2D<Px, Px>) -> Size2D<Px, Px> + Sync),
) -> Size2D<Px, Px>
fn measure_list( &mut self, wm: &mut WidgetMeasure, measure: &(dyn Fn(usize, &mut UiNode, &mut WidgetMeasure) -> Size2D<Px, Px> + Sync), fold_size: &(dyn Fn(Size2D<Px, Px>, Size2D<Px, Px>) -> Size2D<Px, Px> + Sync), ) -> Size2D<Px, Px>
Source§fn layout(&mut self, wl: &mut WidgetLayout) -> Size2D<Px, Px>
fn layout(&mut self, wl: &mut WidgetLayout) -> Size2D<Px, Px>
Computes the widget layout given the contextual layout metrics. Read more
Source§fn layout_list(
&mut self,
wl: &mut WidgetLayout,
layout: &(dyn Fn(usize, &mut UiNode, &mut WidgetLayout) -> Size2D<Px, Px> + Sync),
fold_size: &(dyn Fn(Size2D<Px, Px>, Size2D<Px, Px>) -> Size2D<Px, Px> + Sync),
) -> Size2D<Px, Px>
fn layout_list( &mut self, wl: &mut WidgetLayout, layout: &(dyn Fn(usize, &mut UiNode, &mut WidgetLayout) -> Size2D<Px, Px> + Sync), fold_size: &(dyn Fn(Size2D<Px, Px>, Size2D<Px, Px>) -> Size2D<Px, Px> + Sync), ) -> Size2D<Px, Px>
Source§fn render(&mut self, frame: &mut FrameBuilder)
fn render(&mut self, frame: &mut FrameBuilder)
Generates render instructions and updates transforms and hit-test areas. Read more
Source§fn render_list(
&mut self,
frame: &mut FrameBuilder,
render: &(dyn Fn(usize, &mut UiNode, &mut FrameBuilder) + Sync),
)
fn render_list( &mut self, frame: &mut FrameBuilder, render: &(dyn Fn(usize, &mut UiNode, &mut FrameBuilder) + Sync), )
Source§fn render_update(&mut self, update: &mut FrameUpdate)
fn render_update(&mut self, update: &mut FrameUpdate)
Updates values in the last generated frame. Read more
Source§fn render_update_list(
&mut self,
update: &mut FrameUpdate,
render_update: &(dyn Fn(usize, &mut UiNode, &mut FrameUpdate) + Sync),
)
fn render_update_list( &mut self, update: &mut FrameUpdate, render_update: &(dyn Fn(usize, &mut UiNode, &mut FrameUpdate) + Sync), )
Source§fn as_widget(&mut self) -> Option<&mut (dyn WidgetUiNodeImpl + 'static)>
fn as_widget(&mut self) -> Option<&mut (dyn WidgetUiNodeImpl + 'static)>
Gets the node implementation as a
WidgetUiNodeImpl, if the node defines a widget instance scope.Auto Trait Implementations§
impl Freeze for AdoptiveNode
impl !RefUnwindSafe for AdoptiveNode
impl Send for AdoptiveNode
impl !Sync for AdoptiveNode
impl Unpin for AdoptiveNode
impl !UnwindSafe for AdoptiveNode
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
Mutably borrows from an owned value. Read more
§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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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>
Converts
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>
Converts
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