fn parse_score(node: &ElementRef, id: Id) -> Result<Option<Score>, Box<dyn Error>> {
        let score_node = match node.select(&QS_SELECTOR_SCORE).next() {
            None => {
                log::info!("Failed to locate score node for listing. \
                This is probably a Jobs, Launch, or Poll listing. id = {}", id);
                return Ok(None);
            },
            Some(score_node) => score_node,
        };

        let text = score_node.text()
            .next()
            .ok_or_else(|| {
                log::error!("Failed to obtain score text from listing score node, id = {}", id);
                HnError::HtmlParsingError
            })?;

        let score = text.strip_suffix(" points")
            .ok_or_else(|| {
                log::error!("Failed to strip ' points' from listing score text. id = {}, text =  {},",
                    id, text);
                HnError::HtmlParsingError
            })?
            .parse::<Score>()
            .map_err(|_src_err| {
                log::error!("Failed to parse score numeric value from score text, id = {}, text = {}",
                    id, text);
                HnError::HtmlParsingError
            })?;

        Ok(Some(score))
    }
// Note: This function queries against the subtext node
This function queries against the subtext node
This function queries against the subtext node
fn parse_score(node: &ElementRef, id: Id) -> Result<Option<Score>, Box<dyn Error>> {
        let score_node = match node.select(&QS_SELECTOR_SCORE).next() {
            None => {
                log::info!("Failed to locate score node for listing. \
                This is probably a Jobs, Launch, or Poll listing. id = {}", id);
                return Ok(None);
            },
            Some(score_node) => score_node,
        };
        let text = score_node.text()
            .next()
            .ok_or_else(|| {
                log::error!("Failed to obtain score text from listing score node, id = {}", id);
                HnError::HtmlParsingError
            })?;
        let score = text.strip_suffix(" points")
            .ok_or_else(|| {
                log::error!("Failed to strip ' points' from listing score text. id = {}, text =  {},",
                    id, text);
                HnError::HtmlParsingError
            })?
            .parse::<Score>()
            .map_err(|_src_err| {
                log::error!("Failed to parse score numeric value from score text, id = {}, text = {}",
                    id, text);
                HnError::HtmlParsingError
            })?;
        Ok(Some(score))
    }
fn parse_score ( node : & ElementRef , id : Id ) -> Result < Option < Score > , Box < dyn Error > > { let score_node = match node . select ( & QS_SELECTOR_SCORE ) . next ( ) { None => { log :: info ! ( " \
 " id ) ; return Ok ( None ) ; } , Some ( score_node ) => score_node , } ; let text = score_node . text ( ) . next ( ) . ok_or_else ( | | { log :: error ! ( " " id ) ; HnError :: HtmlParsingError } ) ? ; let score = text . strip_suffix ( " " ) . ok_or_else ( | | { log :: error ! ( " " id text ) ; HnError :: HtmlParsingError } ) ? . parse :: < Score > ( ) . map_err ( | _src_err | { log :: error ! ( " " id text ) ; HnError :: HtmlParsingError } ) ? ; Ok ( Some ( score ) ) }
Note: This function queries against the subtext node
Note : This function queries against the subtext node
node
&ElementRef
id
Id