pub struct DomTree { /* private fields */ }Expand description
Arena-allocated DOM tree.
Implementations§
Source§impl DomTree
impl DomTree
pub fn new() -> Self
pub fn root(&self) -> DomNodeId
pub fn add_element( &mut self, parent: DomNodeId, tag: &str, attributes: HashMap<String, String>, ) -> DomNodeId
pub fn add_text(&mut self, parent: DomNodeId, text: &str) -> DomNodeId
pub fn node(&self, id: DomNodeId) -> &DomNode
pub fn children(&self, id: DomNodeId) -> &[DomNodeId]
pub fn parent(&self, id: DomNodeId) -> Option<DomNodeId>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn find_element_by_tag(&self, tag: &str) -> Option<DomNodeId>
pub fn find_element_by_tag(&self, tag: &str) -> Option<DomNodeId>
Find the first element with a given tag name (depth-first).
Sourcepub fn find_element_by_id(&self, id: &str) -> Option<DomNodeId>
pub fn find_element_by_id(&self, id: &str) -> Option<DomNodeId>
Find an element by its id attribute.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DomTree
impl RefUnwindSafe for DomTree
impl Send for DomTree
impl Sync for DomTree
impl Unpin for DomTree
impl UnwindSafe for DomTree
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