html_keywords_matching/lib.rs
1mod trie;
2
3use std::{cell::RefCell, collections::HashMap, rc::Rc};
4
5#[derive(Debug)]
6pub struct MatchResult {
7 pub match_words: HashMap<String, usize>,
8 pub modified_html: String,
9}
10
11type TrieNodeRef = Rc<RefCell<TrieNode>>;
12
13struct TrieNode {
14 is_end_words: bool,
15 children: HashMap<char, TrieNodeRef>,
16 fail: Option<TrieNodeRef>,
17 depth: usize,
18}
19
20pub struct Trie {
21 root: TrieNodeRef,
22}