前缀字符串 wps: word_prefix_string
(&self, wps: &str)
| 40 | // 前缀字符串 |
| 41 | // wps: word_prefix_string |
| 42 | fn word_node(&self, wps: &str) -> Option<&Node> { |
| 43 | let mut node = &self.root; |
| 44 | for c in wps.as_bytes() { |
| 45 | let index = (c - b'a') as usize; |
| 46 | match &node.children[index] { |
| 47 | None => return None, |
| 48 | Some(next) => node = next.as_ref(), |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | Some(node) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | fn main() { |
no outgoing calls
no test coverage detected