pub enum Node {
Block(BlockNode),
Text(TextNode),
Void(VoidNode),
Fragment(FragmentNode),
}Variants§
Implementations§
Source§impl Node
impl Node
Sourcepub fn block(
name: impl Into<String>,
attributes: BTreeMap<String, NodeAttrVal>,
children: Vec<Node>,
) -> Self
pub fn block( name: impl Into<String>, attributes: BTreeMap<String, NodeAttrVal>, children: Vec<Node>, ) -> Self
Simplifies the creation of a BlockNode by providing a shorthand
function:
use dompa::*;
use std::collections::BTreeMap;
Node::block("div", BTreeMap::new(), vec![]);The verbose variant looks like this:
use dompa::*;
use std::collections::BTreeMap;
Node::Block(BlockNode {
name: String::from("div"),
attributes: BTreeMap::new(),
children: vec![]
});Sourcepub fn simple_block(name: impl Into<String>, children: Vec<Node>) -> Self
pub fn simple_block(name: impl Into<String>, children: Vec<Node>) -> Self
Simplifies the simplified shorthand function (Node::block) even more for when
you don’t want to set attributes, in which case you can simply call this:
use dompa::*;
Node::simple_block("div", vec![]);Sourcepub fn text(value: impl Into<String>) -> Self
pub fn text(value: impl Into<String>) -> Self
Simplifies the creation of a TextNode by providing a shorthand
function:
use dompa::*;
Node::text("Hello, World!");The verbose variant looks like this:
use dompa::*;
Node::Text(TextNode {
value: String::from("Hello, World!")
});Sourcepub fn void(
name: impl Into<String>,
attributes: BTreeMap<String, NodeAttrVal>,
) -> Self
pub fn void( name: impl Into<String>, attributes: BTreeMap<String, NodeAttrVal>, ) -> Self
Simplifies the creation of a VoidNode by providing a shorthand
function:
use dompa::*;
use std::collections::BTreeMap;
Node::void("img", BTreeMap::new());The verbose variant looks like this:
use dompa::*;
use std::collections::BTreeMap;
Node::Void(VoidNode {
name: String::from("img"),
attributes: BTreeMap::new()
});Sourcepub fn simple_void(name: impl Into<String>) -> Self
pub fn simple_void(name: impl Into<String>) -> Self
Simplifies the simplifier shrothand function (Node::void) even more for when
you don’t want to set attributes, in which case you can simply call this:
use dompa::*;
Node::simple_void("img");Trait Implementations§
Source§impl<'de> Deserialize<'de> for Node
impl<'de> Deserialize<'de> for Node
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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