fn parse_a_hrefs(handle: Handle, base_url: &Url, urls: &mut HashSet<Url>) {
    let node = handle;
    if let NodeData::Element {
        ref name,
        ref attrs,
        ..
    } = node.data
    {
        if &name.local == "a" {
            if let Some(attr) = attrs
                .borrow()
                .iter()
                .find(|attr| &attr.name.local == "href")
            {
                let val = &attr.value;
                if let Ok(link) = base_url.join(val) {
                    debug!("link is {:?}", link);
                    urls.insert(link);
                } else {
                    debug!("unparsable link {:?}", val);
                }
            }
        }
    }

    for child in node.children.borrow().iter() {
        parse_a_hrefs(child.clone(), base_url, urls);
    }
}
/// Traverse the DOM of a parsed HTML element, extracting all URLs from <a href="xxx"> links.
Traverse the DOM of a parsed HTML element, extracting all URLs from  links.
Traverse the DOM of a parsed HTML element extracting all URLs from links .
fn parse_a_hrefs(handle: Handle, base_url: &Url, urls: &mut HashSet<Url>) {
    let node = handle;
    if let NodeData::Element {
        ref name,
        ref attrs,
        ..
    } = node.data
    {
        if &name.local == "a" {
            if let Some(attr) = attrs
                .borrow()
                .iter()
                .find(|attr| &attr.name.local == "href")
            {
                let val = &attr.value;
                if let Ok(link) = base_url.join(val) {
                    debug!("link is {:?}", link);
                    urls.insert(link);
                } else {
                    debug!("unparsable link {:?}", val);
                }
            }
        }
    }
    for child in node.children.borrow().iter() {
        parse_a_hrefs(child.clone(), base_url, urls);
    }
}
fn parse_a_hrefs ( handle : Handle , base_url : & Url , urls : & mut HashSet < Url > ) { let node = handle ; if let NodeData :: Element { ref name , ref attrs , .. } = node . data { if & name . local == " " { if let Some ( attr ) = attrs . borrow ( ) . iter ( ) . find ( | attr | & attr . name . local == " " ) { let val = & attr . value ; if let Ok ( link ) = base_url . join ( val ) { debug ! ( " " link ) ; urls . insert ( link ) ; } else { debug ! ( " " val ) ; } } } } for child in node . children . borrow ( ) . iter ( ) { parse_a_hrefs ( child . clone ( ) , base_url , urls ) ; } }
Traverse the DOM of a parsed HTML element, extracting all URLs from <a href="xxx"> links.
Traverse the DOM of a parsed HTML element extracting all URLs from <a href = " xxx " > links .
handle
Handle
base_url
&Url
urls
&mut HashSet<Url>