fn extract_core_build(icons_row: Node<'_>) -> CoreBuildDataExpand description
⚙️ Function: Extracts the core build items from an HTML iconsRow div.
This function processes a div containing the core build items for a champion, typically found
in the iconsRow HTML element. It extracts the alt attributes of the item images, cleans them,
and returns the first, second, and third items in the build as a CoreBuildData struct.
§Parameters:
icons_row: Aselect::node::Noderepresenting theiconsRowdiv that contains the item icons for the core build.
§Returns:
CoreBuildData: Returns aCoreBuildDatastruct containing the names of the first, second, and third core build items.
§Example:
This function is typically called to process the core build for a specific champion:
let core_build = extract_core_build(icons_row);
println!("{:?}", core_build);§Notes:
- The function collects all
imgtags within theiconsRowdiv and extracts thealtattributes, which contain the names of the items. - The
clean_alt_textfunction is used to clean thealttext by removing unnecessary characters and formatting it. - The function assumes that the images vector contains at least four elements, where the first image is ignored and the second, third, and fourth images represent the core build items.
- If the
iconsRowdiv does not contain enough images, this could result in anindex out of boundserror, so ensure the data is well-formed before calling the function.