pub struct LocatedNodeList<'a, T: VariantValue>(/* private fields */);Expand description
A list of LocatedNode resulting from an SPath query, along with their locations.
Implementations§
Source§impl<'a, T: VariantValue> LocatedNodeList<'a, T>
impl<'a, T: VariantValue> LocatedNodeList<'a, T>
Sourcepub fn new(nodes: Vec<LocatedNode<'a, T>>) -> Self
pub fn new(nodes: Vec<LocatedNode<'a, T>>) -> Self
Create a new LocatedNodeList from a vector of located nodes.
Sourcepub fn at_most_one(self) -> Result<Option<LocatedNode<'a, T>>, AtMostOneError>
pub fn at_most_one(self) -> Result<Option<LocatedNode<'a, T>>, AtMostOneError>
Extract at most one entry from a LocatedNodeList
This is intended for queries that are expected to optionally yield a single node.
Sourcepub fn exactly_one(self) -> Result<LocatedNode<'a, T>, ExactlyOneError>
pub fn exactly_one(self) -> Result<LocatedNode<'a, T>, ExactlyOneError>
Extract exactly one entry from a LocatedNodeList
This is intended for queries that are expected to yield a single node.
Sourcepub fn all(self) -> Vec<LocatedNode<'a, T>>
pub fn all(self) -> Vec<LocatedNode<'a, T>>
Extract all located nodes yielded by the query
This is intended for queries that are expected to yield zero or more nodes.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Get the length of a LocatedNodeList
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check if a LocatedNodeList is empty
Sourcepub fn iter(&self) -> Iter<'_, LocatedNode<'a, T>>
pub fn iter(&self) -> Iter<'_, LocatedNode<'a, T>>
Get an iterator over a LocatedNodeList
Note that LocatedNodeList also implements IntoIterator.
To iterate over just locations, see locations. To iterate
over just nodes, see nodes.
Sourcepub fn locations(&self) -> Locations<'_, T> ⓘ
pub fn locations(&self) -> Locations<'_, T> ⓘ
Get an iterator over the locations of nodes within a LocatedNodeList
Sourcepub fn nodes(&self) -> Nodes<'_, T> ⓘ
pub fn nodes(&self) -> Nodes<'_, T> ⓘ
Get an iterator over the nodes within a LocatedNodeList
Sourcepub fn dedup(self) -> Self
pub fn dedup(self) -> Self
Deduplicate a LocatedNodeList and return the result
See also, dedup_in_place.
Sourcepub fn dedup_in_place(&mut self)
pub fn dedup_in_place(&mut self)
Deduplicate a LocatedNodeList in-place
See also, dedup.
Sourcepub fn first(&self) -> Option<&LocatedNode<'a, T>>
pub fn first(&self) -> Option<&LocatedNode<'a, T>>
Return the first entry in the LocatedNodeList, or None if it is empty
Sourcepub fn last(&self) -> Option<&LocatedNode<'a, T>>
pub fn last(&self) -> Option<&LocatedNode<'a, T>>
Return the last entry in the LocatedNodeList, or None if it is empty
Sourcepub fn get(&self, index: usize) -> Option<&LocatedNode<'a, T>>
pub fn get(&self, index: usize) -> Option<&LocatedNode<'a, T>>
Returns the node at the given index in the LocatedNodeList, or None if the
given index is out of bounds.
Trait Implementations§
Source§impl<'a, T: Clone + VariantValue> Clone for LocatedNodeList<'a, T>
impl<'a, T: Clone + VariantValue> Clone for LocatedNodeList<'a, T>
Source§fn clone(&self) -> LocatedNodeList<'a, T>
fn clone(&self) -> LocatedNodeList<'a, T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a, T: Debug + VariantValue> Debug for LocatedNodeList<'a, T>
impl<'a, T: Debug + VariantValue> Debug for LocatedNodeList<'a, T>
Source§impl<'a, T: Default + VariantValue> Default for LocatedNodeList<'a, T>
impl<'a, T: Default + VariantValue> Default for LocatedNodeList<'a, T>
Source§fn default() -> LocatedNodeList<'a, T>
fn default() -> LocatedNodeList<'a, T>
Source§impl<'a, T: VariantValue> IntoIterator for LocatedNodeList<'a, T>
impl<'a, T: VariantValue> IntoIterator for LocatedNodeList<'a, T>
Source§impl<'a, T: PartialEq + VariantValue> PartialEq for LocatedNodeList<'a, T>
impl<'a, T: PartialEq + VariantValue> PartialEq for LocatedNodeList<'a, T>
impl<'a, T: Eq + VariantValue> Eq for LocatedNodeList<'a, T>
impl<'a, T: VariantValue> StructuralPartialEq for LocatedNodeList<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for LocatedNodeList<'a, T>
impl<'a, T> RefUnwindSafe for LocatedNodeList<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for LocatedNodeList<'a, T>where
T: Sync,
impl<'a, T> Sync for LocatedNodeList<'a, T>where
T: Sync,
impl<'a, T> Unpin for LocatedNodeList<'a, T>
impl<'a, T> UnwindSafe for LocatedNodeList<'a, T>where
T: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.