2020-09-11 17:28:42 +02:00
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 } } if ( ! DOMTokenList . prototype . add ) { DOMTokenList . prototype . add = function ( className ) { if ( className && ! hasClass ( this , className ) ) { if ( this . className && this . className . length > 0 ) { this . className += " " + className } else { this . className = className } } } } if ( ! DOMTokenList . prototype . remove ) { DOMTokenList . prototype . remove = function ( className ) { if ( className && this . className ) { this . className = ( " " + this . className + " " ) . replace ( " " + className + " " , " " ) . trim ( ) } } } function getSearchInput ( ) { return document . getElementsByClassName ( "search-input" ) [ 0 ] } function getSearchElement ( ) { return document . getElementById ( "search" ) } function focusSearchBar ( ) { getSearchInput ( ) . focus ( ) } function defocusSearchBar ( ) { getSearchInput ( ) . blur ( ) } ( 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" , "existential" , "attr" , "derive" , "traitalias" ] ; var disableShortcuts = getCurrentValue ( "rustdoc-disable-shortcuts" ) === "true" ; var search _input = getSearchInput ( ) ; var searchTimeout = null ; var currentTab = 0 ; var mouseMovedAfterSearch = true ; var titleBeforeSearch = document . title ; function clearInputTimeout ( ) { if ( searchTimeout !== null ) { clearTimeout ( searchTimeout ) ; searchTimeout = null } } function getPageId ( ) { if ( window . location . hash ) { var tmp = window . location . hash . replace ( /^#/ , "" ) ; if ( tmp . length > 0 ) { return tmp } } return 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 themePickers = document . getElementsByClassName ( "theme-picker" ) ; if ( themePickers && themePickers . length > 0 ) { themePickers [ 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 themePickers = document . getElementsByClassName ( "theme-picker" ) ; if ( themePickers && themePickers . length > 0 ) { themePickers [ 0 ] . style . display = null } } function showSearchResults ( search ) { if ( search === null || typeof search === 'undefined' ) { search = getSearchElement ( ) } addClass ( main , "hidden" ) ; removeClass ( search , "hidden" ) ; mouseMovedAfterSearch = false } function hideSearchResults ( search ) { if ( search === null || typeof search === 'undefined' ) { search = getSearchElement ( ) } addClass ( search , "hidden" ) ; removeClass ( main , "hidden" ) } var TY _PRIMITIVE = itemTypes . indexOf ( "primitive" ) ; var TY _KEYWORD = itemTypes . indexOf ( "keyword" ) ; 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 window . history && typeof window . history . pushState === "function" } function isHidden ( elem ) { return elem . offsetHeight === 0 } var main = document . getElementById ( "main" ) ; var savedHash = "" ; function handleHashes ( ev ) { var elem ; var search = getSearchElement ( ) ; if ( ev !== null && search && ! hasClass ( search , "hidden" ) && ev . newURL ) { hideSearchResults ( search ) ; var hash = ev . newURL . slice ( ev . newURL . indexOf ( "#" ) + 1 ) ; if ( browserSupportsHistoryApi ( ) ) { history . replaceState ( hash , "" , "?search=#" + hash ) } elem = document . getElementById ( hash ) ; if ( elem ) { elem . scrollIntoView ( ) } } if ( savedHash !== window . location . hash ) { savedHash = window . location . hash ; if