]> git.lizzy.rs Git - rust.git/blob - src/doc/not_found.md
Merge commit 'c4416f20dcaec5d93077f72470e83e150fb923b1' into sync-rustfmt
[rust.git] / src / doc / not_found.md
1 % Not Found
2
3 <!-- Completely hide the TOC and the section numbers -->
4 <style type="text/css">
5 #TOC { display: none; }
6 .header-section-number { display: none; }
7 li {list-style-type: none; }
8 #search-input {
9     width: calc(100% - 100px);
10 }
11 #search-but {
12     cursor: pointer;
13 }
14 #search-but, #search-input {
15     padding: 4px;
16     border: 1px solid #ccc;
17     border-radius: 3px;
18     outline: none;
19     font-size: 0.7em;
20     background-color: #fff;
21 }
22 #search-but:hover, #search-input:focus {
23     border-color: #55a9ff;
24 }
25 #search-from {
26     border: none;
27     padding: 0;
28     font-size: 0.7em;
29 }
30 </style>
31
32 Looks like you've taken a wrong turn.
33
34 Some things that might be helpful to you though:
35
36 # Search
37
38 <div>
39   <form id="search-form" action="https://duckduckgo.com/">
40     <input id="search-input" type="search" name="q"></input>
41     <input type="submit" value="Search" id="search-but">
42     <!--
43       Don't show the options by default,
44       since "From the Standary Library" doesn't work without JavaScript
45     -->
46     <fieldset id="search-from" style="display:none">
47       <label><input name="from" value="library" type="radio"> From the Standard Library</label>
48       <label><input name="from" value="duckduckgo" type="radio" checked> From DuckDuckGo</label>
49     </fieldset>
50   </form>
51 </div>
52
53 # Reference
54
55  * [The Rust official site](https://www.rust-lang.org)
56  * [The Rust reference](https://doc.rust-lang.org/reference/index.html)
57
58 # Docs
59
60 [The standard library](https://doc.rust-lang.org/std/)
61
62 <script>
63 function get_url_fragments() {
64     var last = document.URL.split("/").pop();
65     var tokens = last.split(".");
66     var op = [];
67     for (var i=0; i < tokens.length; i++) {
68         var t = tokens[i];
69         if (t == 'html' || t.indexOf("#") != -1) {
70             // no html or anchors
71         } else {
72             op.push(t);
73         }
74     }
75     return op;
76 }
77
78 function on_submit(event) {
79     var form = event.target;
80     var q = form['q'].value;
81
82     event.preventDefault();
83
84     if (form['from'].value === 'duckduckgo') {
85         document.location.href = form.action + '?q=' + encodeURIComponent(q + ' site:doc.rust-lang.org');
86     } else if (form['from'].value === 'library') {
87         document.location.href = '/std/index.html?search=' + encodeURIComponent(q);
88     }
89 }
90
91 function populate_search() {
92     var form = document.getElementById('search-form');
93     form.addEventListener('submit', on_submit);
94     document.getElementById('search-from').style.display = '';
95
96     form['from'].value = 'library';
97
98     var op = get_url_fragments();
99     document.getElementById('search-input').value = op.join(' ');
100 }
101 populate_search();
102 </script>