Skip to content

Commit

Permalink
Refactor HTML link extractor for improved performance and maintainabi…
Browse files Browse the repository at this point in the history
…lity

- Replace Vec<u8> with String for better readability and manipulation
- Introduce Element struct to encapsulate element-related data
- Use HashMap<String, String> for current_attributes for efficient lookups
- Add verbatim_stack to properly handle nested verbatim elements
- Remove unsafe code where possible, using String::from_utf8_lossy
- Improve attribute handling with HashMap entry API and prioritize srcset
- Simplify logic and consolidate verbatim element handling
- Enhance encapsulation in LinkExtractor struct
- Improve overall performance with more efficient data structures
- Increase flexibility for future feature additions or modifications

This refactor maintains core functionality while making the code more
idiomatic Rust, easier to read and maintain, and more robust in handling
edge cases. The new structure is better suited for future extensions or
modifications.
  • Loading branch information
mre committed Oct 7, 2024
1 parent a38a192 commit 9d10eab
Showing 1 changed file with 128 additions and 214 deletions.
Loading

0 comments on commit 9d10eab

Please sign in to comment.