Struct nutrimatic::ChildReader [−][src]
A lazy reader of the children of a node.
This struct
is created by the children
method on Node
. It
conceptually represents a sequence of Node
s indexed by contiguous
numbers, kind of like [Node]
; however, it does not physically contain any
instances, instead constructing them on demand.
Examples
use nutrimatic::Node; // Materialize all the children of a node into a `Vec`. fn collect_children<'a>(node: &Node<'a>) -> Vec<Node<'a>> { node.children().iter().collect() }
Implementations
impl<'buf> ChildReader<'buf>
[src]
pub fn index(&self, index: usize) -> Node<'buf>
[src]
Returns the child at the given index, starting from 0. Children are in increasing order by character. If the index is not within bounds, this method will panic or return garbage.
pub fn len(&self) -> usize
[src]
Returns the number of children of the node.
pub fn is_empty(&self) -> bool
[src]
Returns true
if the node has no children.
pub fn find(&self, ch: u8) -> Option<Node<'buf>>
[src]
Finds a child with the given character using binary search.
pub fn scan(&self, ch: u8) -> Option<Node<'buf>>
[src]
Finds a child with the given character by scanning through the children in order. This is useful when the character is known to be early in the list (in particular, the space character is always first if present).
pub fn iter<'reader>(&'reader self) -> ChildIter<'buf, 'reader>ⓘ
[src]
Returns an iterator over the children.
Trait Implementations
impl<'buf> Clone for ChildReader<'buf>
[src]
fn clone(&self) -> ChildReader<'buf>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'buf> Copy for ChildReader<'buf>
[src]
impl<'buf> Debug for ChildReader<'buf>
[src]
impl<'buf> Eq for ChildReader<'buf>
[src]
impl<'buf, 'reader> IntoIterator for &'reader ChildReader<'buf>
[src]
type Item = Node<'buf>
The type of the elements being iterated over.
type IntoIter = ChildIter<'buf, 'reader>
Which kind of iterator are we turning this into?
fn into_iter(self) -> ChildIter<'buf, 'reader>ⓘ
[src]
impl<'buf> PartialEq<ChildReader<'buf>> for ChildReader<'buf>
[src]
fn eq(&self, other: &ChildReader<'buf>) -> bool
[src]
fn ne(&self, other: &ChildReader<'buf>) -> bool
[src]
impl<'buf> StructuralEq for ChildReader<'buf>
[src]
impl<'buf> StructuralPartialEq for ChildReader<'buf>
[src]
Auto Trait Implementations
impl<'buf> RefUnwindSafe for ChildReader<'buf>
impl<'buf> Send for ChildReader<'buf>
impl<'buf> Sync for ChildReader<'buf>
impl<'buf> Unpin for ChildReader<'buf>
impl<'buf> UnwindSafe for ChildReader<'buf>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,