Skip to content

Commit 3cd8c57

Browse files
committed
rustdoc: Add index records to the doc tree
1 parent 5df44bd commit 3cd8c57

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

src/rustdoc/doc.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ type itemdoc = {
3333

3434
type moddoc = {
3535
item: itemdoc,
36-
items: [itemtag]
36+
items: [itemtag],
37+
index: option<index>
3738
};
3839

3940
type nmoddoc = {
@@ -109,6 +110,29 @@ type tydoc = {
109110
sig: option<str>
110111
};
111112

113+
type index = {
114+
entries: [index_entry]
115+
};
116+
117+
#[doc = "
118+
119+
A single entry in an index
120+
121+
Fields:
122+
123+
* kind - The type of thing being indexed, e.g. 'Module'
124+
* name - The name of the thing
125+
* brief - A description
126+
* link - A format-specific string representing the link target
127+
128+
"]
129+
type index_entry = {
130+
kind: str,
131+
name: str,
132+
brief: str,
133+
link: str
134+
};
135+
112136
#[doc = "Some helper methods on moddoc, mostly for testing"]
113137
impl util for moddoc {
114138

src/rustdoc/extract.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ fn moddoc_from_mod(
102102
none
103103
}
104104
}
105-
}
105+
},
106+
index: none
106107
}
107108
}
108109

src/rustdoc/rustdoc.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ fn test_run_passes() {
5757
name: doc.topmod.name() + "two"
5858
with doc.topmod.item
5959
},
60-
items: []
60+
items: [],
61+
index: none
6162
}
6263
}
6364
}
@@ -71,7 +72,8 @@ fn test_run_passes() {
7172
name: doc.topmod.name() + "three"
7273
with doc.topmod.item
7374
},
74-
items: []
75+
items: [],
76+
index: none
7577
}
7678
}
7779
}

0 commit comments

Comments
 (0)