pub fn parent(&self) -> Selection<'a> {
        let mut result = Vec::with_capacity(self.length());
        let mut set = HashSet::with_capacity(self.length());

        for node in self.nodes() {
            if let Some(parent) = node.parent() {
                if !set.contains(&parent.id) {
                    set.insert(parent.id);
                    result.push(parent);
                }
            }
        }

        Self { nodes: result }
    }
/// Gets the parent of each element in the selection. It returns a
/// mew Selection object containing these elements.
Gets the parent of each element in the selection. It returns a
mew Selection object containing these elements.
Gets the parent of each element in the selection . It returns a mew Selection object containing these elements .
pub fn parent(&self) -> Selection<'a> {
        let mut result = Vec::with_capacity(self.length());
        let mut set = HashSet::with_capacity(self.length());
        for node in self.nodes() {
            if let Some(parent) = node.parent() {
                if !set.contains(&parent.id) {
                    set.insert(parent.id);
                    result.push(parent);
                }
            }
        }
        Self { nodes: result }
    }
pub fn parent ( & self ) -> Selection < ' a > { let mut result = Vec :: with_capacity ( self . length ( ) ) ; let mut set = HashSet :: with_capacity ( self . length ( ) ) ; for node in self . nodes ( ) { if let Some ( parent ) = node . parent ( ) { if ! set . contains ( & parent . id ) { set . insert ( parent . id ) ; result . push ( parent ) ; } } } Self { nodes : result } }
Gets the parent of each element in the selection.
Gets the parent of each element in the selection .
&self
&self