Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QMHTMY/RustBook
/ contains
Method
contains
publication/code/chapter10/trie.rs:34–36 ·
view source on GitHub ↗
判断单词是否存在
(&self, word: &str)
Source
from the content-addressed store, hash-verified
32
33
// 判断单词是否存在
34
fn contains(&self, word: &str) -> bool {
35
self.word_node(word).map_or(false, |n| n.end)
36
}
37
38
// 判断是否存在以某个前缀开头的单词
39
fn start_with(&self, prefix: &str) -> bool {
Callers
1
main
Function · 0.45
Calls
1
word_node
Method · 0.45
Tested by
no test coverage detected