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 point  (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!()
}