pub fn filter_label<'a, F>(&'a self, filter: F) -> Vec<&'a VirtualNode>
    where
        F: Fn(&str) -> bool,
    {
        let mut descendants = vec![];

        for child in self.children.as_ref().unwrap() {
            get_descendants(&mut descendants, &child);
        }

        let mut filtered_descendants = vec![];
        for node in descendants.into_iter() {
            match node.props.get("label") {
                Some(label) => {
                    if filter(label) {
                        filtered_descendants.push(node);
                    }
                }
                None => {}
            };
        }

        filtered_descendants
    }
/// Get a vector of all of the VirtualNode children / grandchildren / etc of
/// your virtual_node that have a label that matches your filter.
///
/// # Examples
///
/// ```rust,ignore
/// # #[macro_use] extern crate virtual_dom_rs;  fn main() {
///
/// let component = html! {<div>
///  <span label="hello",> {"Hi!"} </span>
///  <em label="world",> {"There!!"} </em>
///  <em label="hello",></em>
/// </div> };
///
/// let hello_nodes = component.filter_label(|label| {
///     label.contains("hello")
/// });
///
/// assert_eq!(hello_nodes.len(), 2);
/// }
/// ```
Get a vector of all of the VirtualNode children / grandchildren / etc of
your virtual_node that have a label that matches your filter.
Get a vector of all of the VirtualNode children / grandchildren / etc of your virtual_node that have a label that matches your filter .
pub fn filter_label<'a, F>(&'a self, filter: F) -> Vec<&'a VirtualNode>
    where
        F: Fn(&str) -> bool,
    {
        let mut descendants = vec![];
        for child in self.children.as_ref().unwrap() {
            get_descendants(&mut descendants, &child);
        }
        let mut filtered_descendants = vec![];
        for node in descendants.into_iter() {
            match node.props.get("label") {
                Some(label) => {
                    if filter(label) {
                        filtered_descendants.push(node);
                    }
                }
                None => {}
            };
        }
        filtered_descendants
    }
pub fn filter_label < ' a , F > ( & ' a self , filter : F ) -> Vec < & ' a VirtualNode > where F : Fn ( & str ) -> bool , { let mut descendants = vec ! [ ] ; for child in self . children . as_ref ( ) . unwrap ( ) { get_descendants ( & mut descendants , & child ) ; } let mut filtered_descendants = vec ! [ ] ; for node in descendants . into_iter ( ) { match node . props . get ( " " ) { Some ( label ) => { if filter ( label ) { filtered_descendants . push ( node ) ; } } None => { } } ; } filtered_descendants }
Get a vector of all of the VirtualNode children / grandchildren / etc of
your virtual_node that have a label that matches your filter.
Get a vector of all of the VirtualNode children / grandchildren / etc of your virtual_node that have a label that matches your filter .
&'a self
filter
F
&'a self
filter
F
examples
None
#[macro_use] extern crate virtual_dom_rs;  fn main() {
let component = html.

let hello_nodes = component.filter_label(|label| {
label.contains("hello")
}).


let component = html . let hello_nodes = component . filter_label ( |label| { label . contains ( " hello " ) } ) .