Struct virtual_dom_rs::ParsedVirtualNode
source · pub struct ParsedVirtualNode {
pub tag: String,
pub props: HashMap<String, String, RandomState>,
pub custom_events: CustomEvents,
pub browser_events: BrowserEvents,
pub children: Option<Vec<Rc<RefCell<ParsedVirtualNode>>, Global>>,
pub parent: Option<Rc<RefCell<ParsedVirtualNode>>>,
pub text: Option<String>,
}
Expand description
Our html! macro takes in tokens, builds ParsedVirtualNode
’s from those tokens and then
finally converts that ParsedVirtualNode
into a VirtualNode
.
When we next revisit that macro we’ll want to revisit whether or not we can build a VirtualNode
as we go vs. needing this intermediary data structure.
TODO: Is this complexity really necessary? Doubt it… Map this all out on paper… shouldn’t need two nearly identical structs…?
Fields§
§tag: String
TODO: See if we can get rid of ParsedVirtualNode entirely in favor of only VirtualNode
props: HashMap<String, String, RandomState>
TODO: See if we can get rid of ParsedVirtualNode entirely in favor of only VirtualNode
custom_events: CustomEvents
TODO: See if we can get rid of ParsedVirtualNode entirely in favor of only VirtualNode
browser_events: BrowserEvents
TODO: See if we can get rid of ParsedVirtualNode entirely in favor of only VirtualNode
children: Option<Vec<Rc<RefCell<ParsedVirtualNode>>, Global>>
TODO: See if we can get rid of ParsedVirtualNode entirely in favor of only VirtualNode TODO: Don’t think this needs to be an option
parent: Option<Rc<RefCell<ParsedVirtualNode>>>
TODO: See if we can get rid of ParsedVirtualNode entirely in favor of only VirtualNode
text: Option<String>
TODO: See if we can get rid of ParsedVirtualNode entirely in favor of only VirtualNode
Implementations§
source§impl ParsedVirtualNode
impl ParsedVirtualNode
sourcepub fn new(tag: &str) -> ParsedVirtualNode
pub fn new(tag: &str) -> ParsedVirtualNode
Create a virtual node that is meant to represent a DOM element
sourcepub fn text(text: &str) -> ParsedVirtualNode
pub fn text(text: &str) -> ParsedVirtualNode
Create a virtual node that is meant to represent DOM Text
sourcepub fn take_children(&mut self) -> Vec<VirtualNode, Global>
pub fn take_children(&mut self) -> Vec<VirtualNode, Global>
Take off the the VirtualNode
’s direct descendants (who in turn might have their
own descendants)