pub struct Node {
pub tag: Option<String>,
pub start: usize,
pub end: usize,
pub children: Vec<Node>,
pub closed: bool,
pub start_tag_end: Option<usize>,
pub end_tag_start: Option<usize>,
pub attributes: HashMap<String, NodeAttribute>,
}
Fields§
§tag: Option<String>
It’s None only when new
start: usize
§end: usize
§children: Vec<Node>
§closed: bool
Whether part of end tag exists
start_tag_end: Option<usize>
It’s None only when new or it miss close part of start tag, it larger than end of start tag
end_tag_start: Option<usize>
It’s None only when it’s self-closing tag or it miss part of end tag, it equals start of end tag
attributes: HashMap<String, NodeAttribute>
Implementations§
Source§impl Node
impl Node
pub fn new(start: usize, end: usize, children: Vec<Node>) -> Node
pub fn attribute_names(&self) -> Vec<&String>
pub fn attribute_names_by_order(&self) -> Vec<&String>
pub fn is_self_closing(&self) -> bool
Sourcepub fn is_same_tag(
&self,
target_tag: Option<&str>,
case_sensitive: bool,
) -> bool
pub fn is_same_tag( &self, target_tag: Option<&str>, case_sensitive: bool, ) -> bool
if case_sensitive is false, then other_tag should be lowercase
pub fn first_child(&self) -> Option<&Node>
pub fn last_child(&self) -> Option<&Node>
pub fn find_node_before<'a>( node: &'a Node, offset: usize, parent_list: &mut Vec<&'a Node>, ) -> &'a Node
pub fn find_node_at<'a>( node: &'a Node, offset: usize, parent_list: &mut Vec<&'a Node>, ) -> &'a Node
Sourcepub fn find_token_type_in_node(node: &Node, offset: usize) -> TokenType
pub fn find_token_type_in_node(node: &Node, offset: usize) -> TokenType
Find TokenType in node at offset
it return StartTagOpen, StartTag, StartTagClose, StartTagSelfClose, Content, EndTagOpen, EndTag, EndTagClose, Unknown
if offset in children, then it’s Content if offset outside of node then it’s Unknown
Trait Implementations§
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