causal-agent / scraper

HTML parsing and querying with CSS selectors
https://docs.rs/scraper
ISC License
1.79k stars 98 forks source link

Add trait to abstract over selectable collections of elements #155

Closed adamreichold closed 8 months ago

adamreichold commented 8 months ago

Our codebase contains a simpler version of this trait which we use to write helper functions which can be applied both at the top level to Html but also if selection is a multi-step process, i.e. to ElementRef itself, as the scope to which a CSS selector is applied.

Note that this uses generic associated type and hence requires Rust 1.65, c.f. https://blog.rust-lang.org/2022/10/28/gats-stabilization.html.

cfvescovo commented 8 months ago

LGTM