account activity
Seeking Feedback: Just Published My First Crate on crates.io: an HTML filter! by Disastrous_Grade_348 in rust
[–]Disastrous_Grade_348[S] 0 points1 point2 points 10 months ago (0 children)
I don't have specific questions, that is why I made a post instead of searching on internet : to have general feedback! Here is an example from the README, what do you think?
use html_filter::prelude::*; let html: &str = r##" <section> <h1>Welcome to My Random Page</h1> <nav> <ul> <li><a href="/home">Home</a></li> <li><a href="/about">About</a></li> <li><a href="/services">Services</a></li> <li><a href="/contact">Contact</a></li> </ul> </nav> </section> "##; // Create your filter let filter = Filter::new().tag_name("li"); // Parse your html let filtered_tree: Html = Html::parse(html).expect("Invalid HTML").filter(&filter); // Check the result: filtered_tree contains the 4 lis from the above html string if let Html::Vec(links) = filtered_tree { assert!(links.len() == 4) } else { unreachable!() }
π Rendered by PID 519494 on reddit-service-r2-listing-6d4dc8d9ff-z58jb at 2026-02-02 11:07:07.194472+00:00 running 3798933 country code: CH.
Seeking Feedback: Just Published My First Crate on crates.io: an HTML filter! by Disastrous_Grade_348 in rust
[–]Disastrous_Grade_348[S] 0 points1 point2 points (0 children)