Struct patternfly_dioxus::LazyNodes
[−]pub struct LazyNodes<'a, 'b> { /* private fields */ }Expand description
A concrete type provider for closures that build VNode structures.
This struct wraps lazy structs that build VNode trees Normally, we cannot perform a blanket implementation over closures, but if we wrap the closure in a concrete type, we can maintain separate implementations of IntoVNode.
ⓘ
LazyNodes::new(|f| f.element("div", [], [], [] None))Implementations
impl<'a, 'b> LazyNodes<'a, 'b>
impl<'a, 'b> LazyNodes<'a, 'b>
pub fn new(
val: impl FnOnce(NodeFactory<'a>) -> VNode<'a> + 'b
) -> LazyNodes<'a, 'b>
pub fn new(
val: impl FnOnce(NodeFactory<'a>) -> VNode<'a> + 'b
) -> LazyNodes<'a, 'b>
Create a new LazyNodes closure, optimistically placing it onto the stack.
If the closure cannot fit into the stack allocation (16 bytes), then it is placed on the heap. Most closures will fit into the stack, and is the most optimal way to use the creation function.
pub fn new_boxed<F>(_val: F) -> LazyNodes<'a, 'b>where
F: 'b + FnOnce(NodeFactory<'a>) -> VNode<'a>,
pub fn new_boxed<F>(_val: F) -> LazyNodes<'a, 'b>where
F: 'b + FnOnce(NodeFactory<'a>) -> VNode<'a>,
Create a new LazyNodes closure, but force it onto the heap.
pub fn call(self, f: NodeFactory<'a>) -> VNode<'a>
pub fn call(self, f: NodeFactory<'a>) -> VNode<'a>
Call the closure with the given factory to produce real VNodes.
ⓘ
let f = LazyNodes::new(move |f| f.element("div", [], [], [] None));
let fac = NodeFactory::new(&cx);
let node = f.call(cac);Trait Implementations
impl<'a, 'b> IntoIterator for LazyNodes<'a, 'b>
impl<'a, 'b> IntoIterator for LazyNodes<'a, 'b>
impl<'a, 'b> IntoVNode<'a> for LazyNodes<'a, 'b>
impl<'a, 'b> IntoVNode<'a> for LazyNodes<'a, 'b>
fn into_vnode(self, cx: NodeFactory<'a>) -> VNode<'a>
fn into_vnode(self, cx: NodeFactory<'a>) -> VNode<'a>
Convert this into a
VNode, using the NodeFactory as a source of allocationAuto Trait Implementations
impl<'a, 'b> !RefUnwindSafe for LazyNodes<'a, 'b>
impl<'a, 'b> !Send for LazyNodes<'a, 'b>
impl<'a, 'b> !Sync for LazyNodes<'a, 'b>
impl<'a, 'b> Unpin for LazyNodes<'a, 'b>
impl<'a, 'b> !UnwindSafe for LazyNodes<'a, 'b>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more