Struct patternfly_dioxus::NodeFactory
[−]pub struct NodeFactory<'a> { /* private fields */ }Expand description
This struct provides an ergonomic API to quickly build VNodes.
NodeFactory is used to build VNodes in the component’s memory space. This struct adds metadata to the final VNode about listeners, attributes, and children
Implementations
impl<'a> NodeFactory<'a>
impl<'a> NodeFactory<'a>
pub fn new(scope: &'a ScopeState) -> NodeFactory<'a>
pub fn new(scope: &'a ScopeState) -> NodeFactory<'a>
Create a new NodeFactory from a Scope or ScopeState
pub fn bump(&self) -> &'a Bump
pub fn bump(&self) -> &'a Bump
Get the custom allocator for this component
pub fn static_text(&self, text: &'static str) -> VNode<'a>
pub fn static_text(&self, text: &'static str) -> VNode<'a>
Directly pass in text blocks without the need to use the format_args macro.
pub fn raw_text(&self, args: Arguments<'_>) -> (&'a str, bool)
pub fn raw_text(&self, args: Arguments<'_>) -> (&'a str, bool)
Parses a lazy text Arguments and returns a string and a flag indicating if the text is ’static
Text that’s static may be pointer compared, making it cheaper to diff
pub fn text(&self, args: Arguments<'_>) -> VNode<'a>
pub fn text(&self, args: Arguments<'_>) -> VNode<'a>
Create some text that’s allocated along with the other vnodes
pub fn element(
&self,
el: impl DioxusElement,
listeners: &'a [Listener<'a>],
attributes: &'a [Attribute<'a>],
children: &'a [VNode<'a>],
key: Option<Arguments<'_>>
) -> VNode<'a>
pub fn element(
&self,
el: impl DioxusElement,
listeners: &'a [Listener<'a>],
attributes: &'a [Attribute<'a>],
children: &'a [VNode<'a>],
key: Option<Arguments<'_>>
) -> VNode<'a>
Create a new [VNode::VElement]
pub fn raw_element(
&self,
tag_name: &'static str,
namespace: Option<&'static str>,
listeners: &'a [Listener<'a>],
attributes: &'a [Attribute<'a>],
children: &'a [VNode<'a>],
key: Option<Arguments<'_>>
) -> VNode<'a>
pub fn raw_element(
&self,
tag_name: &'static str,
namespace: Option<&'static str>,
listeners: &'a [Listener<'a>],
attributes: &'a [Attribute<'a>],
children: &'a [VNode<'a>],
key: Option<Arguments<'_>>
) -> VNode<'a>
Create a new [VNode::VElement] without the trait bound
IE pass in “div” instead of div
pub fn attr(
&self,
name: &'static str,
val: Arguments<'_>,
namespace: Option<&'static str>,
is_volatile: bool
) -> Attribute<'a>
pub fn attr(
&self,
name: &'static str,
val: Arguments<'_>,
namespace: Option<&'static str>,
is_volatile: bool
) -> Attribute<'a>
Create a new [Attribute]
pub fn component<P>(
&self,
component: fn(Scope<'a, P>) -> Option<VNode<'a>>,
props: P,
key: Option<Arguments<'_>>,
fn_name: &'static str
) -> VNode<'a>where
P: 'a + Properties,
pub fn component<P>(
&self,
component: fn(Scope<'a, P>) -> Option<VNode<'a>>,
props: P,
key: Option<Arguments<'_>>,
fn_name: &'static str
) -> VNode<'a>where
P: 'a + Properties,
Create a new [VNode::VComponent]
pub fn listener(
self,
event: &'static str,
callback: &'a RefCell<Option<Box<'a, dyn FnMut(AnyEvent) + 'a>>>
) -> Listener<'a>
pub fn listener(
self,
event: &'static str,
callback: &'a RefCell<Option<Box<'a, dyn FnMut(AnyEvent) + 'a>>>
) -> Listener<'a>
Create a new [Listener]
pub fn fragment_root<'b, 'c>(
self,
node_iter: impl IntoIterator<Item = impl IntoVNode<'a> + 'c> + 'b
) -> VNode<'a>
pub fn fragment_root<'b, 'c>(
self,
node_iter: impl IntoIterator<Item = impl IntoVNode<'a> + 'c> + 'b
) -> VNode<'a>
Create a new [VNode::VFragment] from a root of the rsx! call
pub fn fragment_from_iter<'b, 'c>(
self,
node_iter: impl IntoIterator<Item = impl IntoVNode<'a> + 'c> + 'b
) -> VNode<'a>
pub fn fragment_from_iter<'b, 'c>(
self,
node_iter: impl IntoIterator<Item = impl IntoVNode<'a> + 'c> + 'b
) -> VNode<'a>
Create a new [VNode::VFragment] from any iterator
pub fn create_children(
self,
node_iter: impl IntoIterator<Item = impl IntoVNode<'a>>
) -> Option<VNode<'a>>
pub fn create_children(
self,
node_iter: impl IntoIterator<Item = impl IntoVNode<'a>>
) -> Option<VNode<'a>>
Create a new VNode from any iterator of children
pub fn event_handler<T>(self, f: impl FnMut(T) + 'a) -> EventHandler<'a, T>
pub fn event_handler<T>(self, f: impl FnMut(T) + 'a) -> EventHandler<'a, T>
Create a new EventHandler from an FnMut
Trait Implementations
impl<'a> Clone for NodeFactory<'a>
impl<'a> Clone for NodeFactory<'a>
fn clone(&self) -> NodeFactory<'a>
fn clone(&self) -> NodeFactory<'a>
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read more