mirror of
https://github.com/actix/actix-website
synced 2024-12-01 03:24:36 +01:00
13 lines
44 KiB
JavaScript
13 lines
44 KiB
JavaScript
|
/*!
|
||
|
* Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||
|
* file at the top-level directory of this distribution and at
|
||
|
* http://rust-lang.org/COPYRIGHT.
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||
|
* <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||
|
* option. This file may not be copied, modified, or distributed
|
||
|
* except according to those terms.
|
||
|
*/(function(){"use strict";var itemTypes=["mod","externcrate","import","struct","enum","fn","type","static","trait","impl","tymethod","method","structfield","variant","macro","primitive","associatedtype","constant","associatedconstant","union","foreigntype","keyword"];var search_input=document.getElementsByClassName('search-input')[0];var currentTab=0;var themesWidth=null;var titleBeforeSearch=document.title;if(!String.prototype.startsWith){String.prototype.startsWith=function(searchString,position){position=position||0;return this.indexOf(searchString,position)===position;};}if(!String.prototype.endsWith){String.prototype.endsWith=function(suffix,length){var l=length||this.length;return this.indexOf(suffix,l-suffix.length)!==-1;};}function getPageId(){var id=document.location.href.split('#')[1];if(id){return id.split('?')[0].split('&')[0];}return null;}function hasClass(elem,className){if(elem&&className&&elem.className){var elemClass=elem.className;var start=elemClass.indexOf(className);if(start===-1){return false;}else if(elemClass.length===className.length){return true;}else{if(start>0&&elemClass[start-1]!==' '){return false;}var end=start+className.length;return!(end<elemClass.length&&elemClass[end]!==' ');}if(start>0&&elemClass[start-1]!==' '){return false;}var end=start+className.length;return!(end<elemClass.length&&elemClass[end]!==' ');}return false;}function addClass(elem,className){if(elem&&className&&!hasClass(elem,className)){if(elem.className&&elem.className.length>0){elem.className+=' '+className;}else{elem.className=className;}}}function removeClass(elem,className){if(elem&&className&&elem.className){elem.className=(" "+elem.className+" ").replace(" "+className+" "," ").trim();}}function isHidden(elem){return(elem.offsetParent===null)}function showSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){addClass(elems,"show-it");}var sidebar=document.getElementsByClassName('sidebar')[0];if(sidebar){addClass(sidebar,'mobile');var filler=document.getElementById("sidebar-filler");if(!filler){var div=document.createElement("div");div.id="sidebar-filler";sidebar.appendChild(div);}}var themePicker=document.getElementsByClassName("theme-picker");if(themePicker&&themePicker.length>0){themePicker[0].style.display="none";}}function hideSidebar(){var elems=document.getElementsByClassName("sidebar-elems")[0];if(elems){removeClass(elems,"show-it");}var sidebar=document.getElementsByClassName('sidebar')[0];removeClass(sidebar,'mobile');var filler=document.getElementById("sidebar-filler");if(filler){filler.remove();}document.getElementsByTagName("body")[0].style.marginTop='';var themePicker=document.getElementsByClassName("theme-picker");if(themePicker&&themePicker.length>0){themePicker[0].style.display=null;}}var TY_PRIMITIVE=itemTypes.indexOf("primitive");var TY_KEYWORD=itemTypes.indexOf("keyword");onEach(document.getElementsByClassName('js-only'),function(e){removeClass(e,'js-only');});function getQueryStringParams(){var params={};window.location.search.substring(1).split("&").map(function(s){var pair=s.split("=");params[decodeURIComponent(pair[0])]=typeof pair[1]==="undefined"?null:decodeURIComponent(pair[1]);});return params;}function browserSupportsHistoryApi(){return document.location.protocol!="file:"&&window.history&&typeof window.history.pushState==="function";}function highlightSourceLines(ev){hideSidebar();var search=document.getElementById("search");var i,from,to,match=window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);if(match){from=parseInt(match[1],10);to=Math.min(50000,parseInt(match[2]||match[1],10));from=Math.min(from,to);var elem=document.getElementById(from);if(!elem){return;}if(ev===null){var x=document.getElementById(from);if(x){x.scrollIntoView();}}onEach(document.getElementsByClassName('line-numbers'),function(e){onEach(e.getElementsByTagName('span'),function(i_e){removeClass(i_e,'line-highlighted');});});for(i=from;i<=to;++i){addClass(document.getElementById(i),'line-highlighted');}}else if(ev!==null&&search&&!hasClass(search,"hidden")&&ev.newURL){addClass(search,"hid
|
||
|
<tr><td><code>'+code.outerHTML+'</code></td><td></td></tr></tbody></table>\
|
||
|
</span>';list.appendChild(display);}}};if(window.pending_implementors){window.register_implementors(window.pending_implementors);}function labelForToggleButton(sectionIsCollapsed){if(sectionIsCollapsed){return"+";}return"\u2212";}function onEveryMatchingChild(elem,className,func){if(elem&&className&&func){for(var i=0;i<elem.childNodes.length;i++){if(hasClass(elem.childNodes[i],className)){func(elem.childNodes[i]);}else{onEveryMatchingChild(elem.childNodes[i],className,func);}}}}function toggleAllDocs(pageId,fromAutoCollapse){var toggle=document.getElementById("toggle-all-docs");if(!toggle){return;}if(hasClass(toggle,"will-expand")){updateLocalStorage("rustdoc-collapse","false");removeClass(toggle,"will-expand");onEveryMatchingChild(toggle,"inner",function(e){e.innerHTML=labelForToggleButton(false);});toggle.title="collapse all docs";if(fromAutoCollapse!==true){onEach(document.getElementsByClassName("collapse-toggle"),function(e){collapseDocs(e,"show");});}}else{updateLocalStorage("rustdoc-collapse","true");addClass(toggle,"will-expand");onEveryMatchingChild(toggle,"inner",function(e){e.innerHTML=labelForToggleButton(true);});toggle.title="expand all docs";if(fromAutoCollapse!==true){onEach(document.getElementsByClassName("collapse-toggle"),function(e){collapseDocs(e,"hide",pageId);});}}}function collapseDocs(toggle,mode,pageId){if(!toggle||!toggle.parentNode){return;}function adjustToggle(arg){return function(e){if(hasClass(e,'toggle-label')){if(arg){e.style.display='inline-block';}else{e.style.display='none';}}if(hasClass(e,'inner')){e.innerHTML=labelForToggleButton(arg);}};};if(!hasClass(toggle.parentNode,"impl")){var relatedDoc=toggle.parentNode.nextElementSibling;if(hasClass(relatedDoc,"stability")){relatedDoc=relatedDoc.nextElementSibling;}if(hasClass(relatedDoc,"docblock")){var action=mode;if(action==="toggle"){if(hasClass(relatedDoc,"hidden-by-usual-hider")){action="show";}else{action="hide";}}if(action==="hide"){addClass(relatedDoc,"hidden-by-usual-hider");onEach(toggle.childNodes,adjustToggle(true));addClass(toggle.parentNode,'collapsed');}else if(action==="show"){removeClass(relatedDoc,"hidden-by-usual-hider");removeClass(toggle.parentNode,'collapsed');onEach(toggle.childNodes,adjustToggle(false));}}}else{function implHider(addOrRemove){return function(n){var is_method=hasClass(n,"method");if(is_method||hasClass(n,"type")){if(is_method===true){if(addOrRemove){addClass(n,"hidden-by-impl-hider");}else{removeClass(n,"hidden-by-impl-hider");}}var ns=n.nextElementSibling;while(true){if(ns&&(hasClass(ns,"docblock")||hasClass(ns,"stability"))){if(addOrRemove){addClass(ns,"hidden-by-impl-hider");}else{removeClass(ns,"hidden-by-impl-hider");}ns=ns.nextElementSibling;continue;}break;}}}}var parentElem=toggle.parentNode;var relatedDoc=parentElem;var docblock=relatedDoc.nextElementSibling;while(!hasClass(relatedDoc,"impl-items")){relatedDoc=relatedDoc.nextElementSibling;}if((!relatedDoc&&!hasClass(docblock,"docblock"))||(pageId&&onEach(relatedDoc.childNodes,function(e){return e.id===pageId;})===true)){return;}var action=mode;if(action==="toggle"){if(hasClass(relatedDoc,"fns-now-collapsed")||hasClass(docblock,"hidden-by-impl-hider")){action="show";}else{action="hide";}}if(action==="show"){removeClass(relatedDoc,"fns-now-collapsed");removeClass(docblock,"hidden-by-usual-hider");onEach(toggle.childNodes,adjustToggle(false));onEach(relatedDoc.childNodes,implHider(false));}else if(action==="hide"){addClass(relatedDoc,"fns-now-collapsed");addClass(docblock,"hidden-by-usual-hider");onEach(toggle.childNodes,adjustToggle(true));onEach(relatedDoc.childNodes,implHider(true));}}}function autoCollapse(pageId,collapse){if(collapse){toggleAllDocs(pageId,true);}var collapser=function(e){var n=e.parentElement;if(n.id.match(/^impl(?:-\d+)?$/)===null){if(collapse||hasClass(n,'impl')){collapseDocs(e,"hide",pageId);}}};if(getCurrentValue('rustdoc-trait-implementations')!=="false"){onEach(document.getElementById('implementations-list').getElementsByClassName("collapse-toggle"),collapser);}if(getCurrentValue('rustdoc-method-
|