Skip to content

Commit cb848ce

Browse files
committed
rebuild pages at a7df455
1 parent 91c223f commit cb848ce

16 files changed

+135
-74
lines changed

doc/main.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ h2 {
8383
h3 {
8484
font-size: 1.3em;
8585
}
86-
h1, h2, h3:not(.impl):not(.method):not(.type), h4:not(.method):not(.type) {
86+
h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {
8787
color: black;
8888
font-weight: 500;
8989
margin: 20px 0 15px 0;
@@ -93,7 +93,7 @@ h1.fqn {
9393
border-bottom: 1px dashed #D5D5D5;
9494
margin-top: 0;
9595
}
96-
h2, h3:not(.impl):not(.method):not(.type), h4:not(.method):not(.type) {
96+
h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) {
9797
border-bottom: 1px solid #DDDDDD;
9898
}
9999
h3.impl, h3.method, h4.method, h3.type, h4.type {

doc/main.js

Lines changed: 100 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,27 @@
1515
"use strict";
1616
var resizeTimeout, interval;
1717

18+
// This mapping table should match the discriminants of
19+
// `rustdoc::html::item_type::ItemType` type in Rust.
20+
var itemTypes = ["mod",
21+
"externcrate",
22+
"import",
23+
"struct",
24+
"enum",
25+
"fn",
26+
"type",
27+
"static",
28+
"trait",
29+
"impl",
30+
"tymethod",
31+
"method",
32+
"structfield",
33+
"variant",
34+
"macro",
35+
"primitive",
36+
"associatedtype",
37+
"constant"];
38+
1839
$('.js-only').removeClass('js-only');
1940

2041
function getQueryStringParams() {
@@ -33,23 +54,6 @@
3354
return window.history && typeof window.history.pushState === "function";
3455
}
3556

36-
function resizeShortBlocks() {
37-
if (resizeTimeout) {
38-
clearTimeout(resizeTimeout);
39-
}
40-
resizeTimeout = setTimeout(function() {
41-
var contentWidth = $('.content').width();
42-
$('.docblock.short').width(function() {
43-
return contentWidth - 40 - $(this).prev().width();
44-
}).addClass('nowrap');
45-
$('.summary-column').width(function() {
46-
return contentWidth - 40 - $(this).prev().width();
47-
})
48-
}, 150);
49-
}
50-
resizeShortBlocks();
51-
$(window).on('resize', resizeShortBlocks);
52-
5357
function highlightSourceLines(ev) {
5458
var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
5559
if (match) {
@@ -205,6 +209,33 @@
205209
break;
206210
}
207211
}
212+
// searching by type
213+
} else if (val.search("->") > -1) {
214+
var trimmer = function (s) { return s.trim(); };
215+
var parts = val.split("->").map(trimmer);
216+
var input = parts[0];
217+
// sort inputs so that order does not matter
218+
var inputs = input.split(",").map(trimmer).sort();
219+
var output = parts[1];
220+
221+
for (var i = 0; i < nSearchWords; ++i) {
222+
var type = searchIndex[i].type;
223+
if (!type) {
224+
continue;
225+
}
226+
227+
// sort index inputs so that order does not matter
228+
var typeInputs = type.inputs.map(function (input) {
229+
return input.name;
230+
}).sort();
231+
232+
// allow searching for void (no output) functions as well
233+
var typeOutput = type.output ? type.output.name : "";
234+
if (inputs.toString() === typeInputs.toString() &&
235+
output == typeOutput) {
236+
results.push({id: i, index: -1, dontValidate: true});
237+
}
238+
}
208239
} else {
209240
// gather matching search results up to a certain maximum
210241
val = val.replace(/\_/g, "");
@@ -325,6 +356,11 @@
325356
path = result.item.path.toLowerCase(),
326357
parent = result.item.parent;
327358

359+
// this validation does not make sense when searching by types
360+
if (result.dontValidate) {
361+
continue;
362+
}
363+
328364
var valid = validateResult(name, path, split, parent);
329365
if (!valid) {
330366
result.id = -1;
@@ -552,27 +588,6 @@
552588
showResults(results);
553589
}
554590

555-
// This mapping table should match the discriminants of
556-
// `rustdoc::html::item_type::ItemType` type in Rust.
557-
var itemTypes = ["mod",
558-
"externcrate",
559-
"import",
560-
"struct",
561-
"enum",
562-
"fn",
563-
"type",
564-
"static",
565-
"trait",
566-
"impl",
567-
"tymethod",
568-
"method",
569-
"structfield",
570-
"variant",
571-
"macro",
572-
"primitive",
573-
"associatedtype",
574-
"constant"];
575-
576591
function itemTypeFromName(typename) {
577592
for (var i = 0; i < itemTypes.length; ++i) {
578593
if (itemTypes[i] === typename) return i;
@@ -590,7 +605,8 @@
590605
// (String) name,
591606
// (String) full path or empty string for previous path,
592607
// (String) description,
593-
// (optional Number) the parent path index to `paths`]
608+
// (Number | null) the parent path index to `paths`]
609+
// (Object | null) the type of the function (if any)
594610
var items = rawSearchIndex[crate].items;
595611
// an array of [(Number) item type,
596612
// (String) name]
@@ -615,7 +631,7 @@
615631
var rawRow = items[i];
616632
var row = {crate: crate, ty: rawRow[0], name: rawRow[1],
617633
path: rawRow[2] || lastPath, desc: rawRow[3],
618-
parent: paths[rawRow[4]]};
634+
parent: paths[rawRow[4]], type: rawRow[5]};
619635
searchIndex.push(row);
620636
if (typeof row.name === "string") {
621637
var word = row.name.toLowerCase();
@@ -708,6 +724,50 @@
708724

709725
window.initSearch = initSearch;
710726

727+
// delayed sidebar rendering.
728+
function initSidebarItems(items) {
729+
var sidebar = $('.sidebar');
730+
var current = window.sidebarCurrent;
731+
732+
function block(shortty, longty) {
733+
var filtered = items[shortty];
734+
if (!filtered) return;
735+
736+
var div = $('<div>').attr('class', 'block ' + shortty);
737+
div.append($('<h2>').text(longty));
738+
739+
for (var i = 0; i < filtered.length; ++i) {
740+
var item = filtered[i];
741+
var name = item[0];
742+
var desc = item[1]; // can be null
743+
744+
var klass = shortty;
745+
if (name === current.name && shortty == current.ty) {
746+
klass += ' current';
747+
}
748+
var path;
749+
if (shortty === 'mod') {
750+
path = name + '/index.html';
751+
} else {
752+
path = shortty + '.' + name + '.html';
753+
}
754+
div.append($('<a>', {'href': current.relpath + path,
755+
'title': desc,
756+
'class': klass}).text(name));
757+
}
758+
sidebar.append(div);
759+
}
760+
761+
block("mod", "Modules");
762+
block("struct", "Structs");
763+
block("enum", "Enums");
764+
block("trait", "Traits");
765+
block("fn", "Functions");
766+
block("macro", "Macros");
767+
}
768+
769+
window.initSidebarItems = initSidebarItems;
770+
711771
window.register_implementors = function(imp) {
712772
var list = $('#implementors-list');
713773
var libs = Object.getOwnPropertyNames(imp);

doc/playpen.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
if (window.playgroundUrl) {
1616
$('pre.rust').hover(function() {
1717
var a = $('<a>').text('⇱').attr('class', 'test-arrow');
18-
var code = $(this).siblings(".rusttest").text();
18+
var code = $(this).prev(".rusttest").text();
1919
a.attr('href', window.playgroundUrl + '?code=' +
2020
encodeURIComponent(code));
2121
a.attr('target', '_blank');
@@ -25,4 +25,3 @@
2525
});
2626
}
2727
}());
28-
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
initSidebarItems({});

doc/postgres_array/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
<section class="sidebar">
2828

29-
<p class='location'></p>
29+
<p class='location'></p><script>window.sidebarCurrent = {name: 'postgres_array', ty: 'mod', relpath: '../'};</script>
3030
</section>
3131

3232
<nav class="sub">

doc/postgres_array/sidebar-items.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/postgres_array/stability.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
<section class="sidebar">
2828

29-
<p class='location'></p>
29+
<p class='location'></p><script>window.sidebarCurrent = {name: 'postgres_array', ty: 'mod', relpath: '../'};</script>
3030
</section>
3131

3232
<nav class="sub">

doc/postgres_array/struct.ArrayBase.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
<section class="sidebar">
2828

29-
<p class='location'><a href='index.html'>postgres_array</a></p><div class='block struct'><h2>Structs</h2><a class='struct current' href='struct.ArrayBase.html' title='A multi-dimensional array'>ArrayBase</a><a class='struct ' href='struct.ArraySlice.html' title='An immutable slice of a multi-dimensional array'>ArraySlice</a><a class='struct ' href='struct.DimensionInfo.html' title='Information about a dimension of an array'>DimensionInfo</a><a class='struct ' href='struct.MutArraySlice.html' title='A mutable slice of a multi-dimensional array'>MutArraySlice</a></div><div class='block trait'><h2>Traits</h2><a class='trait ' href='trait.Array.html' title='Specifies methods that can be performed on multi-dimensional arrays'>Array</a><a class='trait ' href='trait.MutableArray.html' title='Specifies methods that can be performed on mutable multi-dimensional arrays'>MutableArray</a></div>
29+
<p class='location'><a href='index.html'>postgres_array</a></p><script>window.sidebarCurrent = {name: 'ArrayBase', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script>
3030
</section>
3131

3232
<nav class="sub">
@@ -43,7 +43,7 @@
4343
<section id='main' class="content struct">
4444
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>postgres_array</a>::<wbr><a class='struct' href=''>ArrayBase</a><wbr></span><span class='out-of-band'><span id='render-detail'>
4545
<a id="collapse-all" href="#">[-]</a>&nbsp;<a id="expand-all" href="#">[+]</a>
46-
</span><a id='src-1150' href='../src/postgres_array/lib.rs.html#82-85'>[src]</a></span></h1>
46+
</span><a id='src-1148' href='../src/postgres_array/lib.rs.html#82-85'>[src]</a></span></h1>
4747
<pre class='rust struct'>pub struct ArrayBase&lt;T&gt; {
4848
// some fields omitted
4949
}</pre><div class='docblock'><p>A multi-dimensional array</p>
@@ -93,10 +93,10 @@ <h4 id='method.slice' class='method'><a class='stability Unmarked' title='No sta
9393
<h4 id='method.get' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.get' class='fnname'>get</a>&lt;'a&gt;(&amp;'a self, idx: <a href='http://doc.rust-lang.org/nightly/std/primitive.isize.html'>isize</a>) -&gt; &amp;'a T</code></h4>
9494
</div><h3 class='impl'><a class='stability Unmarked' title='No stability level'></a><code>impl&lt;T&gt; <a class='trait' href='../postgres_array/trait.MutableArray.html' title='postgres_array::MutableArray'>MutableArray</a>&lt;T&gt; for <a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt;</code></h3><div class='impl-items'><h4 id='method.slice_mut' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.slice_mut' class='fnname'>slice_mut</a>&lt;'a&gt;(&amp;'a mut self, idx: <a href='http://doc.rust-lang.org/nightly/std/primitive.isize.html'>isize</a>) -&gt; <a class='struct' href='../postgres_array/struct.MutArraySlice.html' title='postgres_array::MutArraySlice'>MutArraySlice</a>&lt;'a, T&gt;</code></h4>
9595
<h4 id='method.get_mut' class='method'><a class='stability Unmarked' title='No stability level'></a><code>fn <a href='#method.get_mut' class='fnname'>get_mut</a>&lt;'a&gt;(&amp;'a mut self, idx: <a href='http://doc.rust-lang.org/nightly/std/primitive.isize.html'>isize</a>) -&gt; &amp;'a mut T</code></h4>
96-
</div><h3 id='derived_implementations'>Derived Implementations </h3><h3 class='impl'><a class='stability Stable' title='Stable'></a><code>impl&lt;T: <a class='trait' href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a>&gt; <a class='trait' href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a> for <a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt;</code></h3><div class='impl-items'><h4 id='method.clone' class='method'><a class='stability Stable' title='Stable'></a><code>fn <a href='#method.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt;</code></h4>
96+
</div><h3 id='derived_implementations'>Derived Implementations </h3><h3 class='impl'><a class='stability Stable' title='Stable'></a><code>impl&lt;T: <a class='trait' href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a>&gt; <a class='trait' href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a> for <a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt; <span class='where'>where T: <a class='trait' href='http://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a></span></code></h3><div class='impl-items'><h4 id='method.clone' class='method'><a class='stability Stable' title='Stable'></a><code>fn <a href='#method.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt;</code></h4>
9797
<h4 id='method.clone_from' class='tymethod'><a class='stability Unstable' title='Unstable: this function is rarely used'></a><code>fn <a href='#tymethod.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: &amp;Self)</code></h4>
98-
</div><h3 class='impl'><a class='stability Stable' title='Stable'></a><code>impl&lt;T: <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a>&gt; <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a> for <a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt;</code></h3><div class='impl-items'><h4 id='method.assert_receiver_is_total_eq' class='tymethod'><a class='stability Stable' title='Stable'></a><code>fn <a href='#tymethod.assert_receiver_is_total_eq' class='fnname'>assert_receiver_is_total_eq</a>(&amp;self)</code></h4>
99-
</div><h3 class='impl'><a class='stability Stable' title='Stable'></a><code>impl&lt;T: <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a>&gt; <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> for <a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt;</code></h3><div class='impl-items'><h4 id='method.eq' class='method'><a class='stability Stable' title='Stable'></a><code>fn <a href='#method.eq' class='fnname'>eq</a>(&amp;self, __arg_0: &amp;<a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt;) -&gt; <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
98+
</div><h3 class='impl'><a class='stability Stable' title='Stable'></a><code>impl&lt;T: <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a>&gt; <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a> for <a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt; <span class='where'>where T: <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a></span></code></h3><div class='impl-items'><h4 id='method.assert_receiver_is_total_eq' class='tymethod'><a class='stability Stable' title='Stable'></a><code>fn <a href='#tymethod.assert_receiver_is_total_eq' class='fnname'>assert_receiver_is_total_eq</a>(&amp;self)</code></h4>
99+
</div><h3 class='impl'><a class='stability Stable' title='Stable'></a><code>impl&lt;T: <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a>&gt; <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> for <a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt; <span class='where'>where T: <a class='trait' href='http://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a></span></code></h3><div class='impl-items'><h4 id='method.eq' class='method'><a class='stability Stable' title='Stable'></a><code>fn <a href='#method.eq' class='fnname'>eq</a>(&amp;self, __arg_0: &amp;<a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt;) -&gt; <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
100100
<h4 id='method.ne' class='method'><a class='stability Stable' title='Stable'></a><code>fn <a href='#method.ne' class='fnname'>ne</a>(&amp;self, __arg_0: &amp;<a class='struct' href='../postgres_array/struct.ArrayBase.html' title='postgres_array::ArrayBase'>ArrayBase</a>&lt;T&gt;) -&gt; <a href='http://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
101101
</div></section>
102102
<section id='search' class="content hidden"></section>

0 commit comments

Comments
 (0)