INNER CODE UNIT · Rust

parse_dom_node

aome510/spotify-player · lyric_finder/src/lib.rs:237

    fn parse_dom_node<F>(node: &Handle, filter: Option<&F>, mut should_parse: bool) -> String
    where
        F: Fn(&NodeData) -> bool,
    {
        log::debug!("parse dom node: node={node:?}, should_parse={should_parse}");

        let mut s = String::new();

        if !should_parse {
            if let Some(f) = filter {
                should_parse = f(&node.data);
            }
        }

        match &node.data {
            NodeData::Text { contents } if should_parse => {
                s.push_str(&contents.borrow().to_string());
            }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…