pub struct NodeSet { /* private fields */ }Expand description
An XPath node-set.
Internally stored as a sorted, deduplicated Vec of node pointers in document order.
Implementations§
Source§impl NodeSet
impl NodeSet
pub fn new() -> Self
pub fn singleton(node: *mut _xmlNode) -> Self
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn iter(&self) -> impl Iterator<Item = *mut _xmlNode> + '_
pub fn get(&self, index: usize) -> Option<*mut _xmlNode>
pub fn first(&self) -> Option<*mut _xmlNode>
pub fn last(&self) -> Option<*mut _xmlNode>
pub fn contains(&self, node: *mut _xmlNode) -> bool
Sourcepub fn push(&mut self, node: *mut _xmlNode)
pub fn push(&mut self, node: *mut _xmlNode)
Add a node to the set, maintaining document order and uniqueness.
Sourcepub fn sort(&mut self)
pub fn sort(&mut self)
Sort nodes in document order.
§UPSTREAM-PARITY
XPath node-sets are always in document order (XPath 1.0 §3.3). libxml2 maintains this via its node-set insertion/merge logic plus the document-order comparator (xmlXPathNodeSetSort). Sorting by pointer address is NOT document order and breaks downstream ordering guarantees; the oracle-observed symptom is rotated results on the second of two transforms in one process.
Sourcepub unsafe fn to_raw(&self) -> *mut _xmlNodeSet
pub unsafe fn to_raw(&self) -> *mut _xmlNodeSet
Convert to raw C ABI node-set.
SAFETY: The returned pointer must be freed with xmlXPathFreeNodeSet or the owning XPath object must be freed.
Trait Implementations§
Auto Trait Implementations§
impl !Send for NodeSet
impl !Sync for NodeSet
impl Freeze for NodeSet
impl RefUnwindSafe for NodeSet
impl Unpin for NodeSet
impl UnsafeUnpin for NodeSet
impl UnwindSafe for NodeSet
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