pub struct NodeBuilder<'a> { /* private fields */ }
Expand description
A builder for a Node
struct.
Implementations§
Source§impl<'a> NodeBuilder<'a>
impl<'a> NodeBuilder<'a>
Sourcepub fn new(name: &'a str) -> Self
pub fn new(name: &'a str) -> Self
Creates a builder for a Node
with the name set to the givin parameter.
Sourcepub const fn name(self, name: &'a str) -> Self
pub const fn name(self, name: &'a str) -> Self
Sets the name of the NodeBuilder
.
Sourcepub const fn content(self, data: &'a str) -> Self
pub const fn content(self, data: &'a str) -> Self
Sets the content of the NodeBuilder
.
Sourcepub fn attributes(
self,
attributes: impl IntoIterator<Item = (String, String)>,
) -> Self
pub fn attributes( self, attributes: impl IntoIterator<Item = (String, String)>, ) -> Self
Adds all key-value pairs from an iterator to the attributes of the NodeBuilder
.
Sourcepub fn attribute(
self,
key: &(impl ToString + ?Sized),
value: &(impl ToString + ?Sized),
) -> Self
pub fn attribute( self, key: &(impl ToString + ?Sized), value: &(impl ToString + ?Sized), ) -> Self
Adds an key-value pair as attributes to the NodeBuilder
.
Sourcepub fn childs(self, childs: impl IntoIterator<Item = Node>) -> Self
pub fn childs(self, childs: impl IntoIterator<Item = Node>) -> Self
Adds all nodes from an iterator to the NodeBuilder
as childs.
Sourcepub fn option_child(self, child: Option<impl Into<Node>>) -> Self
pub fn option_child(self, child: Option<impl Into<Node>>) -> Self
Adds a possible Node
as a child to the NodeBuilder
.
Trait Implementations§
Source§impl<'a> Clone for NodeBuilder<'a>
impl<'a> Clone for NodeBuilder<'a>
Source§fn clone(&self) -> NodeBuilder<'a>
fn clone(&self) -> NodeBuilder<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> Debug for NodeBuilder<'a>
impl<'a> Debug for NodeBuilder<'a>
Source§impl<'a> Default for NodeBuilder<'a>
impl<'a> Default for NodeBuilder<'a>
Source§fn default() -> NodeBuilder<'a>
fn default() -> NodeBuilder<'a>
Returns the “default value” for a type. Read more
Source§impl<'a> From<NodeBuilder<'a>> for Node
impl<'a> From<NodeBuilder<'a>> for Node
Source§fn from(builder: NodeBuilder<'a>) -> Self
fn from(builder: NodeBuilder<'a>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a> Freeze for NodeBuilder<'a>
impl<'a> RefUnwindSafe for NodeBuilder<'a>
impl<'a> Send for NodeBuilder<'a>
impl<'a> Sync for NodeBuilder<'a>
impl<'a> Unpin for NodeBuilder<'a>
impl<'a> UnwindSafe for NodeBuilder<'a>
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