2021-02-11 21:43:41 +03: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 getVirtualKey ( ev ) { if ( "key" in ev && typeof ev . key != "undefined" ) { return ev . key } var c = ev . charCode || ev . keyCode ; if ( c == 27 ) { return "Escape" } return String . fromCharCode ( c ) } function getSearchInput ( ) { return document . getElementsByClassName ( "search-input" ) [ 0 ] } function getSearchElement ( ) { return document . getElementById ( "search" ) } function getThemesElement ( ) { return document . getElementById ( "theme-choices" ) } function getThemePickerElement ( ) { return document . getElementById ( "theme-picker" ) } 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 = getSettingValue ( "disable-shortcuts" ) === "true" ; var search _input = getSearchInput ( ) ; var searchTimeout = null ; var toggleAllDocsId = "toggle-all-docs" ; var currentTab = 0 ; var mouseMovedAfterSearch = true ; var titleBeforeSearch = document . title ; var searchTitle = null ; 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 ) } } } 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 = "" } function showSearchResults ( search ) { if ( search === null || typeof search === 'undefined' ) { search = getSearchElement ( ) } addClass ( main , "hidden" ) ; removeClass ( search , "hidden" ) ; mouseMovedAfterSearch = false ; document . title = searchTitle } function hideSearchResults ( search ) { if ( search === null || typeof search === 'undefined' ) { search = getSearchElement ( ) } addClass ( search , "hidden" ) ; removeClass ( main , "hidden" ) ; document . title = titleBeforeSearch } 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 , "" , " ?
< a href = \ "https://doc.rust-lang.org/rustdoc/\">the rustdoc book</a>." ; var container = document . createElement ( "div" ) ; var shortcuts = [ [ "?" , "Show this help dialog" ] , [ "S" , "Focus the search field" ] , [ "T" , "Focus the theme picker menu" ] , [ "↑" , "Move up in search results" ] , [ "↓" , "Move down in search results" ] , [ "ctrl + ↑ / ↓" , "Switch result tab" ] , [ "⏎" , "Go to active search result" ] , [ "+" , "Expand all sections" ] , [ "-" , "Collapse all sections" ] , ] . map ( x => "<dt>" + x [ 0 ] . split ( " " ) . map ( ( y , index ) => ( index & 1 ) === 0 ? "<kbd>" + y + "</kbd>" : y ) . join ( "" ) + "</dt><dd>" + x [ 1 ] + "</dd>" ) . join ( "" ) ; var div _shortcuts = document . createElement ( "div" ) ; addClass ( div _shortcuts , "shortcuts" ) ; div _shortcuts . innerHTML = "<h2>Keyboard Shortcuts</h2><dl>" + shortcuts + "</dl></div>" ; var infos = [ " Prefix searches with a type followed by a colon ( e . g . , < code > fn : < / c o d e > ) t o \
2020-11-19 21:56:14 +03:00
restrict the search to a given item kind . "," Accepted kinds are : < code > fn < / c o d e > , < c o d e > m o d < / c o d e > , < c o d e > s t r u c t < / c o d e > , \
2020-08-19 22:57:57 +03:00
< code > enum < / c o d e > , < c o d e > t r a i t < / c o d e > , < c o d e > t y p e < / c o d e > , < c o d e > m a c r o < / c o d e > , \
and < code > const < / c o d e > . " , " S e a r c h f u n c t i o n s b y t y p e s i g n a t u r e ( e . g . , < c o d e > v e c - & g t ; u s i z e < / c o d e > o r \
< code > * - & gt ; vec < / c o d e > ) " , " S e a r c h m u l t i p l e t h i n g s a t o n c e b y s p l i t t i n g y o u r q u e r y w i t h c o m m a ( e . g . , \
< code > str , u8 < / c o d e > o r < c o d e > S t r i n g , s t r u c t : V e c , t e s t < / c o d e > ) " , " Y o u c a n l o o k f o r i t e m s w i t h a n e x a c t n a m e b y p u t t i n g d o u b l e q u o t e s a r o u n d \
2020-12-31 22:29:16 +03:00
your request : < code > \ "string\"</code>" , "Look for items inside another one by searching for a path: <code>vec::Vec</code>" , ] . map ( x => "<p>" + x + "</p>" ) . join ( "" ) ; var div _infos = document . createElement ( "div" ) ; addClass ( div _infos , "infos" ) ; div _infos . innerHTML = "<h2>Search Tricks</h2>" + infos ; container . appendChild ( book _info ) ; container . appendChild ( div _shortcuts ) ; container . appendChild ( div _infos ) ; popup . appendChild ( container ) ; insertAfter ( popup , getSearchElement ( ) ) ; buildHelperPopup = function ( ) { } } onHashChange ( null ) ; window . onhashchange = onHashChange } ( ) ) ; window . onunload = function ( ) { }