Skip to main content

NodeList

Struct NodeList 

Source
pub struct NodeList<'a, Ext: 'static> { /* private fields */ }
Expand description

Snapshot of node ids captured at construction. item(i) and iter() resolve against the borrowed &Dom; if a node has been removed since the snapshot, the resolution returns None for that slot (filtered out by iter()).

Implementations§

Source§

impl<'a, Ext: 'static> NodeList<'a, Ext>

Source

pub fn from_ids( dom: &'a Dom<Ext>, nodes: impl IntoIterator<Item = NodeId>, ) -> Self

Construct from an iterator of node ids and a borrowed Dom. Used by Dom::query_selector_all (M4b step 18) and tests.

Source

pub fn len(&self) -> usize

Number of node ids in the snapshot. DOM length.

Source

pub fn is_empty(&self) -> bool

true iff the snapshot has no node ids.

Source

pub fn item(&self, index: usize) -> Option<NodeRef<'a, Ext>>

Borrow the i-th node if (a) the index is in range and (b) the underlying id still resolves to a live node. DOM item(i).

Source

pub fn iter(&self) -> impl Iterator<Item = NodeRef<'a, Ext>> + '_

Iterate over the live members of the snapshot in snapshot order. Nodes that have been removed from the tree since the snapshot was taken are skipped.

Source

pub fn ids(&self) -> &[NodeId]

Raw access to the snapshot’s id slice. Escape hatch for callers who want to do their own resolution (e.g. compare snapshots, build their own indices).

Auto Trait Implementations§

§

impl<'a, Ext> !RefUnwindSafe for NodeList<'a, Ext>

§

impl<'a, Ext> !Send for NodeList<'a, Ext>

§

impl<'a, Ext> !Sync for NodeList<'a, Ext>

§

impl<'a, Ext> !UnwindSafe for NodeList<'a, Ext>

§

impl<'a, Ext> Freeze for NodeList<'a, Ext>
where &'a Dom<Ext>: Freeze,

§

impl<'a, Ext> Unpin for NodeList<'a, Ext>
where &'a Dom<Ext>: Unpin,

§

impl<'a, Ext> UnsafeUnpin for NodeList<'a, Ext>
where &'a Dom<Ext>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.