dom_query/
selection.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::dom_tree::Node;

/// Selection represents a collection of nodes matching some criteria. The
/// initial Selection object can be created by using [`crate::document::Document::select`], and then
/// manipulated using methods itself.
#[derive(Debug, Clone, Default)]
pub struct Selection<'a> {
    pub(crate) nodes: Vec<Node<'a>>,
}

impl<'a> From<Node<'a>> for Selection<'a> {
    fn from(node: Node<'a>) -> Selection {
        Self { nodes: vec![node] }
    }
}