about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2024-11-13 15:26:57 -0700
committerMichael Howell <michael@notriddle.com>2024-11-13 15:26:57 -0700
commite534f47e955d3ab50191acb2fa4874bb4fb1cde6 (patch)
treedd4e3a8fd68488ccf2964cc6a20bab0dc3b8abfa
parent1d133993eda7434392569f5e5ea8136afe6d5d8c (diff)
downloadrust-e534f47e955d3ab50191acb2fa4874bb4fb1cde6.tar.gz
rust-e534f47e955d3ab50191acb2fa4874bb4fb1cde6.zip
Add descriptive comment for NameTrie
-rw-r--r--src/librustdoc/html/static/js/search.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js
index 1817492a7d6..6c2b264063d 100644
--- a/src/librustdoc/html/static/js/search.js
+++ b/src/librustdoc/html/static/js/search.js
@@ -1107,6 +1107,25 @@ class RoaringBitmapBits {
 }
 
 /**
+ * A prefix tree, used for name-based search.
+ *
+ * This data structure is used to drive prefix matches,
+ * such as matching the query "link" to `LinkedList`,
+ * and Lev-distance matches, such as matching the
+ * query "hahsmap" to `HashMap`. Substring matches,
+ * such as "list" to `LinkedList`, are done with a
+ * tailTable that deep-links into this trie.
+ *
+ * children
+ * : A [sparse array] of subtrees. The array index
+ *   is a charCode.
+ *
+ *   [sparse array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/
+ *     Indexed_collections#sparse_arrays
+ *
+ * matches
+ * : A list of search index IDs for this node.
+ *
  * @typedef {{
  *     children: [NameTrie],
  *     matches: [number],