2023-12-27T20:29:02.077 helix_vcs [INFO] PeelToCommit( PeelToObject( Unborn { name: FullName( "refs/heads/master", ), }, ), ) 2023-12-27T20:29:02.077 helix_vcs [INFO] failed to open diff base for /tmp/flicker/src/main.rs 2023-12-27T20:29:02.077 helix_vcs [INFO] PeelToCommit( PeelToObject( Unborn { name: FullName( "refs/heads/master", ), }, ), ) 2023-12-27T20:29:02.077 helix_vcs [INFO] failed to obtain current head name for /tmp/flicker/src/main.rs 2023-12-27T20:29:02.078 helix_lsp::client [INFO] Using custom LSP config: {"cargo":{"features":"all"}} 2023-12-27T20:29:02.078 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"positionEncodings":["utf-8","utf-32","utf-16"]},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"dataSupport":true,"disabledSupport":true,"isPreferredSupport":true,"resolveSupport":{"properties":["edit","command"]}},"completion":{"completionItem":{"deprecatedSupport":true,"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"versionSupport":true},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":true},"signatureHelp":{"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown"],"parameterInformation":{"labelOffsetSupport":true}}}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":false},"executeCommand":{"dynamicRegistration":false},"fileOperations":{"didRename":true,"willRename":true},"inlayHint":{"refreshSupport":false},"symbol":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true,"failureHandling":"abort","normalizesLineEndings":false,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"helix","version":"23.10 (783ff27b)"},"initializationOptions":{"cargo":{"features":"all"}},"processId":64166,"rootPath":"/tmp/flicker","rootUri":"file:///tmp/flicker","workspaceFolders":[{"name":"flicker","uri":"file:///tmp/flicker"}]},"id":0} 2023-12-27T20:29:02.121 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"positionEncoding":"utf-8","textDocumentSync":{"openClose":true,"change":2,"save":{}},"selectionRangeProvider":true,"hoverProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":[":",".","'","("],"completionItem":{"labelDetailsSupport":false}},"signatureHelpProvider":{"triggerCharacters":["(",",","<"]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite"],"resolveProvider":true},"codeLensProvider":{"resolveProvider":true},"documentFormattingProvider":true,"documentRangeFormattingProvider":false,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"=","moreTriggerCharacter":[".",">","{","("]},"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"declarationProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true},"fileOperations":{"willRename":{"filters":[{"scheme":"file","pattern":{"glob":"**/*.rs","matches":"file"}},{"scheme":"file","pattern":{"glob":"**","matches":"folder"}}]}}},"callHierarchyProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["comment","decorator","enumMember","enum","function","interface","keyword","macro","method","namespace","number","operator","parameter","property","string","struct","typeParameter","variable","angle","arithmetic","attribute","attributeBracket","bitwise","boolean","brace","bracket","builtinAttribute","builtinType","character","colon","comma","comparison","constParameter","derive","deriveHelper","dot","escapeSequence","invalidEscapeSequence","formatSpecifier","generic","label","lifetime","logical","macroBang","parenthesis","punctuation","selfKeyword","selfTypeKeyword","semicolon","typeAlias","toolModule","union","unresolvedReference"],"tokenModifiers":["documentation","declaration","static","defaultLibrary","async","attribute","callable","constant","consuming","controlFlow","crateRoot","injected","intraDocLink","library","macro","mutable","public","reference","trait","unsafe"]},"range":true,"full":{"delta":true}},"inlayHintProvider":{"resolveProvider":true},"experimental":{"externalDocs":true,"hoverRange":true,"joinLines":true,"matchingBrace":true,"moveItem":true,"onEnter":true,"openCargoToml":true,"parentModule":true,"runnables":{"kinds":["cargo"]},"ssr":true,"workspaceSymbolScopeKindFiltering":true}},"serverInfo":{"name":"rust-analyzer","version":"1.76.0-nightly (21cce21 2023-12-11)"}}} 2023-12-27T20:29:02.121 helix_lsp::transport [INFO] rust-analyzer <- {"capabilities":{"callHierarchyProvider":true,"codeActionProvider":{"codeActionKinds":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite"],"resolveProvider":true},"codeLensProvider":{"resolveProvider":true},"completionProvider":{"completionItem":{"labelDetailsSupport":false},"resolveProvider":true,"triggerCharacters":[":",".","'","("]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"=","moreTriggerCharacter":[".",">","{","("]},"documentRangeFormattingProvider":false,"documentSymbolProvider":true,"experimental":{"externalDocs":true,"hoverRange":true,"joinLines":true,"matchingBrace":true,"moveItem":true,"onEnter":true,"openCargoToml":true,"parentModule":true,"runnables":{"kinds":["cargo"]},"ssr":true,"workspaceSymbolScopeKindFiltering":true},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inlayHintProvider":{"resolveProvider":true},"positionEncoding":"utf-8","referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["documentation","declaration","static","defaultLibrary","async","attribute","callable","constant","consuming","controlFlow","crateRoot","injected","intraDocLink","library","macro","mutable","public","reference","trait","unsafe"],"tokenTypes":["comment","decorator","enumMember","enum","function","interface","keyword","macro","method","namespace","number","operator","parameter","property","string","struct","typeParameter","variable","angle","arithmetic","attribute","attributeBracket","bitwise","boolean","brace","bracket","builtinAttribute","builtinType","character","colon","comma","comparison","constParameter","derive","deriveHelper","dot","escapeSequence","invalidEscapeSequence","formatSpecifier","generic","label","lifetime","logical","macroBang","parenthesis","punctuation","selfKeyword","selfTypeKeyword","semicolon","typeAlias","toolModule","union","unresolvedReference"]},"range":true},"signatureHelpProvider":{"triggerCharacters":["(",",","<"]},"textDocumentSync":{"change":2,"openClose":true,"save":{}},"typeDefinitionProvider":true,"workspace":{"fileOperations":{"willRename":{"filters":[{"pattern":{"glob":"**/*.rs","matches":"file"},"scheme":"file"},{"pattern":{"glob":"**","matches":"folder"},"scheme":"file"}]}},"workspaceFolders":{"changeNotifications":true,"supported":true}},"workspaceSymbolProvider":true},"serverInfo":{"name":"rust-analyzer","version":"1.76.0-nightly (21cce21 2023-12-11)"}} 2023-12-27T20:29:02.121 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"initialized","params":{}} 2023-12-27T20:29:02.121 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"cargo":{"features":"all"}}}} 2023-12-27T20:29:02.121 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"rust","text":"fn main() {\n let _ = a\n}\n","uri":"file:///tmp/flicker/src/main.rs","version":0}}} 2023-12-27T20:29:02.124 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":0,"method":"workspace/configuration","params":{"items":[{"section":"rust-analyzer"}]}} 2023-12-27T20:29:02.124 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":1,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Fetching"}} 2023-12-27T20:29:02.124 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"begin","title":"Fetching","cancellable":false}}} 2023-12-27T20:29:02.124 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":[null],"id":0} 2023-12-27T20:29:02.124 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":1} 2023-12-27T20:29:02.245 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"report","cancellable":false,"message":"metadata"}}} 2023-12-27T20:29:02.466 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":2,"method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/tmp/flicker/**/*.rs"},{"globPattern":"/tmp/flicker/**/Cargo.toml"},{"globPattern":"/tmp/flicker/**/Cargo.lock"}]}}]}} 2023-12-27T20:29:02.467 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":2} 2023-12-27T20:29:02.470 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"end"}}} 2023-12-27T20:29:02.470 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":3,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Roots Scanned"}} 2023-12-27T20:29:02.470 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"begin","title":"Roots Scanned","cancellable":false,"message":"0/2","percentage":0}}} 2023-12-27T20:29:02.470 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":4,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Fetching"}} 2023-12-27T20:29:02.470 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"begin","title":"Fetching","cancellable":false}}} 2023-12-27T20:29:02.470 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":3} 2023-12-27T20:29:02.470 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":4} 2023-12-27T20:29:02.502 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"report","cancellable":false,"message":"1/2","percentage":50}}} 2023-12-27T20:29:02.502 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"end","message":"2/2"}}} 2023-12-27T20:29:02.592 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"report","cancellable":false,"message":"metadata"}}} 2023-12-27T20:29:02.789 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"end"}}} 2023-12-27T20:29:02.789 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":5,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Fetching"}} 2023-12-27T20:29:02.789 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"begin","title":"Fetching","cancellable":false}}} 2023-12-27T20:29:02.789 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":5} 2023-12-27T20:29:02.913 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"report","cancellable":false,"message":"metadata"}}} 2023-12-27T20:29:03.101 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"end"}}} 2023-12-27T20:29:03.101 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":6,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Building"}} 2023-12-27T20:29:03.101 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Building","value":{"kind":"begin","title":"Building","cancellable":false}}} 2023-12-27T20:29:03.101 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":7,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Loading"}} 2023-12-27T20:29:03.101 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Loading","value":{"kind":"begin","title":"Loading","cancellable":false}}} 2023-12-27T20:29:03.101 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":6} 2023-12-27T20:29:03.101 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":7} 2023-12-27T20:29:03.101 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Loading","value":{"kind":"end"}}} 2023-12-27T20:29:03.201 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Building","value":{"kind":"report","cancellable":false,"message":"building proc-macros: flicker"}}} 2023-12-27T20:29:03.201 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Building","value":{"kind":"report","cancellable":false,"message":"building proc-macros: flicker"}}} 2023-12-27T20:29:03.203 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":8,"method":"client/registerCapability","params":{"registrations":[{"id":"workspace/didChangeWatchedFiles","method":"workspace/didChangeWatchedFiles","registerOptions":{"watchers":[{"globPattern":"/tmp/flicker/**/*.rs"},{"globPattern":"/tmp/flicker/**/Cargo.toml"},{"globPattern":"/tmp/flicker/**/Cargo.lock"}]}}]}} 2023-12-27T20:29:03.203 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":8} 2023-12-27T20:29:03.204 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Building","value":{"kind":"end"}}} 2023-12-27T20:29:03.204 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":9,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Roots Scanned"}} 2023-12-27T20:29:03.204 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"begin","title":"Roots Scanned","cancellable":false,"message":"0/2","percentage":0}}} 2023-12-27T20:29:03.204 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":10,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Loading"}} 2023-12-27T20:29:03.204 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Loading","value":{"kind":"begin","title":"Loading","cancellable":false}}} 2023-12-27T20:29:03.204 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Loading","value":{"kind":"end"}}} 2023-12-27T20:29:03.204 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":9} 2023-12-27T20:29:03.204 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":10} 2023-12-27T20:29:03.238 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"report","cancellable":false,"message":"1/2","percentage":50}}} 2023-12-27T20:29:03.238 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"end","message":"2/2"}}} 2023-12-27T20:29:03.239 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":11,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Indexing"}} 2023-12-27T20:29:03.239 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"begin","title":"Indexing","cancellable":false,"percentage":0}}} 2023-12-27T20:29:03.239 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":11} 2023-12-27T20:29:03.239 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"message":"0/5 (core + 1 more)","percentage":0}}} 2023-12-27T20:29:03.262 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"message":"1/5 (core)","percentage":20}}} 2023-12-27T20:29:03.299 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":12,"method":"window/workDoneProgress/create","params":{"token":"rust-analyzer/flycheck/0"}} 2023-12-27T20:29:03.299 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rust-analyzer/flycheck/0","value":{"kind":"begin","title":"cargo check","cancellable":true}}} 2023-12-27T20:29:03.299 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","result":null,"id":12} 2023-12-27T20:29:03.374 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rust-analyzer/flycheck/0","value":{"kind":"end"}}} 2023-12-27T20:29:05.011 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"percentage":40}}} 2023-12-27T20:29:05.011 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"message":"2/5 (alloc)","percentage":40}}} 2023-12-27T20:29:05.140 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"percentage":60}}} 2023-12-27T20:29:05.140 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"message":"3/5 (std)","percentage":60}}} 2023-12-27T20:29:05.436 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"percentage":80}}} 2023-12-27T20:29:05.436 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"message":"4/5 (proc_macro)","percentage":80}}} 2023-12-27T20:29:05.506 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"percentage":100}}} 2023-12-27T20:29:05.506 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"end"}}} 2023-12-27T20:29:06.553 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/signatureHelp","params":{"position":{"character":13,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}},"id":1} 2023-12-27T20:29:06.553 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":1,"result":null} 2023-12-27T20:29:06.553 helix_lsp::transport [INFO] rust-analyzer <- null 2023-12-27T20:29:06.578 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":13},"end":{"line":1,"character":13}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":0}} 2023-12-27T20:29:07.500 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":13,"line":1},"start":{"character":13,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":1}}} 2023-12-27T20:29:07.574 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":14},"end":{"line":1,"character":14}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":1}} 2023-12-27T20:29:07.602 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":14,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}},"id":2} 2023-12-27T20:29:07.617 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":2,"result":{"isIncomplete":true,"items":[{"label":"self::","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"self::","textEdit":{"newText":"self::","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"crate::","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"crate::","textEdit":{"newText":"crate::","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"main()","kind":3,"detail":"fn()","deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"main","insertTextFormat":2,"textEdit":{"newText":"main()$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"panic!(…)","kind":3,"detail":"macro_rules! panic","deprecated":false,"sortText":"ffffffef","filterText":"panic!","insertTextFormat":2,"textEdit":{"newText":"panic!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"println!(…)","kind":3,"detail":"macro_rules! println","documentation":{"kind":"markdown","value":"Prints to the standard output, with a newline.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`)).\n\nThis macro uses the same syntax as [`format!`], but writes to the standard output instead.\nSee [`std::fmt`] for more information.\n\nThe `println!` macro will lock the standard output on each call. If you call\n`println!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwriteln!(lock, \"hello world\").unwrap();\n```\n\nUse `println!` only for the primary output of your program. Use\n[`eprintln!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`std::fmt`]: crate::fmt\n[`eprintln!`]: crate::eprintln\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to [`io::stdout`] fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n[`io::stdout`]: crate::io::stdout\n\n# Examples\n\n```rust\nprintln!(); // prints just a newline\nprintln!(\"hello there!\");\nprintln!(\"format {} arguments\", \"some\");\nlet local_variable = \"some\";\nprintln!(\"format {local_variable} arguments\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"println!","insertTextFormat":2,"textEdit":{"newText":"println!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"debug_assert_eq!(…)","kind":3,"detail":"macro_rules! debug_assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_eq!`], `debug_assert_eq!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_eq!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_eq!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_eq!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\ndebug_assert_eq!(a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert_eq!","insertTextFormat":2,"textEdit":{"newText":"debug_assert_eq!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"include_str!(…)","kind":3,"detail":"macro_rules! include_str","documentation":{"kind":"markdown","value":"Includes a UTF-8 encoded file as a string.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static str` which is the\ncontents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_str = include_str!(\"spanish.in\");\n assert_eq!(my_str, \"adiós\\n\");\n print!(\"{my_str}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include_str!","insertTextFormat":2,"textEdit":{"newText":"include_str!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"concat!(…)","kind":3,"detail":"macro_rules! concat","documentation":{"kind":"markdown","value":"Concatenates literals into a static string slice.\n\nThis macro takes any number of comma-separated literals, yielding an\nexpression of type `&'static str` which represents all of the literals\nconcatenated left-to-right.\n\nInteger and floating point literals are [stringified](core::stringify) in order to be\nconcatenated.\n\n# Examples\n\n```rust\nlet s = concat!(\"test\", 10, 'b', true);\nassert_eq!(s, \"test10btrue\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat!","insertTextFormat":2,"textEdit":{"newText":"concat!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"format!(…)","kind":3,"detail":"macro_rules! format","documentation":{"kind":"markdown","value":"Creates a `String` using interpolation of runtime expressions.\n\nThe first argument `format!` receives is a format string. This must be a string\nliteral. The power of the formatting string is in the `{}`s contained.\nAdditional parameters passed to `format!` replace the `{}`s within the\nformatting string in the order given unless named or positional parameters\nare used.\n\nSee [the formatting syntax documentation in `std::fmt`](../std/fmt/index.html)\nfor details.\n\nA common use for `format!` is concatenation and interpolation of strings.\nThe same convention is used with [`print!`] and [`write!`] macros,\ndepending on the intended destination of the string; all these macros internally use [`format_args!`].\n\nTo convert a single value to a string, use the [`to_string`] method. This\nwill use the [`Display`] formatting trait.\n\nTo concatenate literals into a `&'static str`, use the [`concat!`] macro.\n\n[`print!`]: ../std/macro.print.html\n[`write!`]: core::write\n[`format_args!`]: core::format_args\n[`to_string`]: crate::string::ToString\n[`Display`]: core::fmt::Display\n[`concat!`]: core::concat\n\n# Panics\n\n`format!` panics if a formatting trait implementation returns an error.\nThis indicates an incorrect implementation\nsince `fmt::Write for String` never returns an error itself.\n\n# Examples\n\n```rust\nformat!(\"test\"); // => \"test\"\nformat!(\"hello {}\", \"world!\"); // => \"hello world!\"\nformat!(\"x = {}, y = {val}\", 10, val = 30); // => \"x = 10, y = 30\"\nlet (x, y) = (1, 2);\nformat!(\"{x} + {y} = 3\"); // => \"1 + 2 = 3\"\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"format!","insertTextFormat":2,"textEdit":{"newText":"format!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"log_syntax!(…)","kind":3,"detail":"macro_rules! log_syntax","documentation":{"kind":"markdown","value":"Prints passed tokens into the standard output."},"deprecated":false,"sortText":"ffffffef","filterText":"log_syntax!","insertTextFormat":2,"textEdit":{"newText":"log_syntax!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"stringify!(…)","kind":3,"detail":"macro_rules! stringify","documentation":{"kind":"markdown","value":"Stringifies its arguments.\n\nThis macro will yield an expression of type `&'static str` which is the\nstringification of all the tokens passed to the macro. No restrictions\nare placed on the syntax of the macro invocation itself.\n\nNote that the expanded results of the input tokens may change in the\nfuture. You should be careful if you rely on the output.\n\n# Examples\n\n```rust\nlet one_plus_one = stringify!(1 + 1);\nassert_eq!(one_plus_one, \"1 + 1\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"stringify!","insertTextFormat":2,"textEdit":{"newText":"stringify!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"assert_ne!(…)","kind":3,"detail":"macro_rules! assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\nassert_ne!(a, b);\n\nassert_ne!(a, b, \"we are testing that the values are not equal\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert_ne!","insertTextFormat":2,"textEdit":{"newText":"assert_ne!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"dbg!(…)","kind":3,"detail":"macro_rules! dbg","documentation":{"kind":"markdown","value":"Prints and returns the value of a given expression for quick and dirty\ndebugging.\n\nAn example:\n\n```rust\nlet a = 2;\nlet b = dbg!(a * 2) + 1;\n// ^-- prints: [src/main.rs:2] a * 2 = 4\nassert_eq!(b, 5);\n```\n\nThe macro works by using the `Debug` implementation of the type of\nthe given expression to print the value to [stderr] along with the\nsource location of the macro invocation as well as the source code\nof the expression.\n\nInvoking the macro on an expression moves and takes ownership of it\nbefore returning the evaluated expression unchanged. If the type\nof the expression does not implement `Copy` and you don't want\nto give up ownership, you can instead borrow with `dbg!(&expr)`\nfor some expression `expr`.\n\nThe `dbg!` macro works exactly the same in release builds.\nThis is useful when debugging issues that only occur in release\nbuilds or when debugging in release mode is significantly faster.\n\nNote that the macro is intended as a debugging tool and therefore you\nshould avoid having uses of it in version control for long periods\n(other than in tests and similar).\nDebug output from production code is better done with other facilities\nsuch as the [`debug!`] macro from the [`log`] crate.\n\n# Stability\n\nThe exact output printed by this macro should not be relied upon\nand is subject to future changes.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\n# Further examples\n\nWith a method call:\n\n```rust\nfn foo(n: usize) {\n if let Some(_) = dbg!(n.checked_sub(4)) {\n // ...\n }\n}\n\nfoo(3)\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:4] n.checked_sub(4) = None\n```\n\nNaive factorial implementation:\n\n```rust\nfn factorial(n: u32) -> u32 {\n if dbg!(n <= 1) {\n dbg!(1)\n } else {\n dbg!(n * factorial(n - 1))\n }\n}\n\ndbg!(factorial(4));\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = true\n[src/main.rs:4] 1 = 1\n[src/main.rs:5] n * factorial(n - 1) = 2\n[src/main.rs:5] n * factorial(n - 1) = 6\n[src/main.rs:5] n * factorial(n - 1) = 24\n[src/main.rs:11] factorial(4) = 24\n```\n\nThe `dbg!(..)` macro moves the input:\n\n```rust\n/// A wrapper around `usize` which importantly is not Copyable.\n#[derive(Debug)]\nstruct NoCopy(usize);\n\nlet a = NoCopy(42);\nlet _ = dbg!(a); // <-- `a` is moved here.\nlet _ = dbg!(a); // <-- `a` is moved again; error!\n```\n\nYou can also use `dbg!()` without a value to just print the\nfile and line whenever it's reached.\n\nFinally, if you want to `dbg!(..)` multiple values, it will treat them as\na tuple (and return it, too):\n\n```rust\nassert_eq!(dbg!(1usize, 2u32), (1, 2));\n```\n\nHowever, a single argument with a trailing comma will still not be treated\nas a tuple, following the convention of ignoring trailing commas in macro\ninvocations. You can use a 1-tuple directly if you need one:\n\n```rust\nassert_eq!(1, dbg!(1u32,)); // trailing comma ignored\nassert_eq!((1,), dbg!((1u32,))); // 1-tuple\n```\n\n[stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)\n[`debug!`]: https://docs.rs/log/*/log/macro.debug.html\n[`log`]: https://crates.io/crates/log"},"deprecated":false,"sortText":"ffffffef","filterText":"dbg!","insertTextFormat":2,"textEdit":{"newText":"dbg!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"vec![…]","kind":3,"detail":"macro_rules! vec","documentation":{"kind":"markdown","value":"Creates a [`Vec`] containing the arguments.\n\n`vec!` allows `Vec`s to be defined with the same syntax as array expressions.\nThere are two forms of this macro:\n\n- Create a [`Vec`] containing a given list of elements:\n\n```rust\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```\n\n- Create a [`Vec`] from a given element and size:\n\n```rust\nlet v = vec![1; 3];\nassert_eq!(v, [1, 1, 1]);\n```\n\nNote that unlike array expressions this syntax supports all elements\nwhich implement [`Clone`] and the number of elements doesn't have to be\na constant.\n\nThis will use `clone` to duplicate an expression, so one should be careful\nusing this with types having a nonstandard `Clone` implementation. For\nexample, `vec![Rc::new(1); 5]` will create a vector of five references\nto the same boxed integer value, not five references pointing to independently\nboxed integers.\n\nAlso, note that `vec![expr; 0]` is allowed, and produces an empty vector.\nThis will still evaluate `expr`, however, and immediately drop the resulting value, so\nbe mindful of side effects.\n\n[`Vec`]: crate::vec::Vec"},"deprecated":false,"sortText":"ffffffef","filterText":"vec!","insertTextFormat":2,"textEdit":{"newText":"vec![$0]","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"include!(…)","kind":3,"detail":"macro_rules! include","documentation":{"kind":"markdown","value":"Parses a file as an expression or an item according to the context.\n\n**Warning**: For multi-file Rust projects, the `include!` macro is probably not what you\nare looking for. Usually, multi-file Rust projects use\n[modules](https://doc.rust-lang.org/reference/items/modules.html). Multi-file projects and\nmodules are explained in the Rust-by-Example book\n[here](https://doc.rust-lang.org/rust-by-example/mod/split.html) and the module system is\nexplained in the Rust Book\n[here](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html).\n\nThe included file is placed in the surrounding code\n[unhygienically](https://doc.rust-lang.org/reference/macros-by-example.html#hygiene). If\nthe included file is parsed as an expression and variables or functions share names across\nboth files, it could result in variables or functions being different from what the\nincluded file expected.\n\nThe included file is located relative to the current file (similarly to how modules are\nfound). The provided path is interpreted in a platform-specific way at compile time. So,\nfor instance, an invocation with a Windows path containing backslashes `\\` would not\ncompile correctly on Unix.\n\n# Uses\n\nThe `include!` macro is primarily used for two purposes. It is used to include\ndocumentation that is written in a separate file and it is used to include [build artifacts\nusually as a result from the `build.rs`\nscript](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script).\n\nWhen using the `include` macro to include stretches of documentation, remember that the\nincluded file still needs to be a valid rust syntax. It is also possible to\nuse the [`include_str`] macro as `#![doc = include_str!(\"...\")]` (at the module level) or\n`#[doc = include_str!(\"...\")]` (at the item level) to include documentation from a plain\ntext or markdown file.\n\n# Examples\n\nAssume there are two files in the same directory with the following contents:\n\nFile 'monkeys.in':\n\n```rust\n['🙈', '🙊', '🙉']\n .iter()\n .cycle()\n .take(6)\n .collect::()\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_string = include!(\"monkeys.in\");\n assert_eq!(\"🙈🙊🙉🙈🙊🙉\", my_string);\n println!(\"{my_string}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print\n\"🙈🙊🙉🙈🙊🙉\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include!","insertTextFormat":2,"textEdit":{"newText":"include!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"print!(…)","kind":3,"detail":"macro_rules! print","documentation":{"kind":"markdown","value":"Prints to the standard output.\n\nEquivalent to the [`println!`] macro except that a newline is not printed at\nthe end of the message.\n\nNote that stdout is frequently line-buffered by default so it may be\nnecessary to use [`io::stdout().flush()`][flush] to ensure the output is emitted\nimmediately.\n\nThe `print!` macro will lock the standard output on each call. If you call\n`print!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwrite!(lock, \"hello world\").unwrap();\n```\n\nUse `print!` only for the primary output of your program. Use\n[`eprint!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[flush]: crate::io::Write::flush\n[`println!`]: crate::println\n[`eprint!`]: crate::eprint\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to `io::stdout()` fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\nuse std::io::{self, Write};\n\nprint!(\"this \");\nprint!(\"will \");\nprint!(\"be \");\nprint!(\"on \");\nprint!(\"the \");\nprint!(\"same \");\nprint!(\"line \");\n\nio::stdout().flush().unwrap();\n\nprint!(\"this string has a newline, why not choose println! instead?\\n\");\n\nio::stdout().flush().unwrap();\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"print!","insertTextFormat":2,"textEdit":{"newText":"print!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"cfg_match! {…}","kind":3,"detail":"macro cfg_match","documentation":{"kind":"markdown","value":"A macro for defining `#[cfg]` match-like statements.\n\nIt is similar to the `if/elif` C preprocessor macro by allowing definition of a cascade of\n`#[cfg]` cases, emitting the implementation which matches first.\n\nThis allows you to conveniently provide a long list `#[cfg]`'d blocks of code\nwithout having to rewrite each clause multiple times.\n\nTrailing `_` wildcard match arms are **optional** and they indicate a fallback branch when\nall previous declarations do not evaluate to true.\n\n# Example\n\n```rust\n#![feature(cfg_match)]\n\ncfg_match! {\n cfg(unix) => {\n fn foo() { /* unix specific functionality */ }\n }\n cfg(target_pointer_width = \"32\") => {\n fn foo() { /* non-unix, 32-bit functionality */ }\n }\n _ => {\n fn foo() { /* fallback implementation */ }\n }\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"cfg_match!","insertTextFormat":2,"textEdit":{"newText":"cfg_match! {$0}","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"concat_idents!(…)","kind":3,"detail":"macro_rules! concat_idents","documentation":{"kind":"markdown","value":"Concatenates identifiers into one identifier.\n\nThis macro takes any number of comma-separated identifiers, and\nconcatenates them all into one, yielding an expression which is a new\nidentifier. Note that hygiene makes it such that this macro cannot\ncapture local variables. Also, as a general rule, macros are only\nallowed in item, statement or expression position. That means while\nyou may use this macro for referring to existing variables, functions or\nmodules etc, you cannot define a new one with it.\n\n# Examples\n\n```rust\n#![feature(concat_idents)]\n\nfn foobar() -> u32 { 23 }\n\nlet f = concat_idents!(foo, bar);\nprintln!(\"{}\", f());\n\n// fn concat_idents!(new, fun, name) { } // not usable in this way!\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat_idents!","insertTextFormat":2,"textEdit":{"newText":"concat_idents!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"write!(…)","kind":3,"detail":"macro_rules! write","documentation":{"kind":"markdown","value":"Writes formatted data into a buffer.\n\nThis macro accepts a 'writer', a format string, and a list of arguments. Arguments will be\nformatted according to the specified format string and the result will be passed to the writer.\nThe writer may be any value with a `write_fmt` method; generally this comes from an\nimplementation of either the [`fmt::Write`] or the [`io::Write`] trait. The macro\nreturns whatever the `write_fmt` method returns; commonly a [`fmt::Result`], or an\n[`io::Result`].\n\nSee [`std::fmt`] for more information on the format string syntax.\n\n[`std::fmt`]: ../std/fmt/index.html\n[`fmt::Write`]: crate::fmt::Write\n[`io::Write`]: ../std/io/trait.Write.html\n[`fmt::Result`]: crate::fmt::Result\n[`io::Result`]: ../std/io/type.Result.html\n\n# Examples\n\n```rust\nuse std::io::Write;\n\nfn main() -> std::io::Result<()> {\n let mut w = Vec::new();\n write!(&mut w, \"test\")?;\n write!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(w, b\"testformatted arguments\");\n Ok(())\n}\n```\n\nA module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects\nimplementing either, as objects do not typically implement both. However, the module must\navoid conflict between the trait names, such as by importing them as `_` or otherwise renaming\nthem:\n\n```rust\nuse std::fmt::Write as _;\nuse std::io::Write as _;\n\nfn main() -> Result<(), Box> {\n let mut s = String::new();\n let mut v = Vec::new();\n\n write!(&mut s, \"{} {}\", \"abc\", 123)?; // uses fmt::Write::write_fmt\n write!(&mut v, \"s = {:?}\", s)?; // uses io::Write::write_fmt\n assert_eq!(v, b\"s = \\\"abc 123\\\"\");\n Ok(())\n}\n```\n\nIf you also need the trait names themselves, such as to implement one or both on your types,\nimport the containing module and then name them with a prefix:\n\n```rust\nuse std::fmt::{self, Write as _};\nuse std::io::{self, Write as _};\n\nstruct Example;\n\nimpl fmt::Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n```\n\nNote: This macro can be used in `no_std` setups as well.\nIn a `no_std` setup you are responsible for the implementation details of the components.\n\n```rust\nuse core::fmt::Write;\n\nstruct Example;\n\nimpl Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n\nlet mut m = Example{};\nwrite!(&mut m, \"Hello World\").expect(\"Not written\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"write!","insertTextFormat":2,"textEdit":{"newText":"write!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"line!(…)","kind":3,"detail":"macro_rules! line","documentation":{"kind":"markdown","value":"Expands to the line number on which it was invoked.\n\nWith [`column!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first line\nin each file evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned line is *not necessarily* the line of the `line!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `line!` macro.\n\n# Examples\n\n```rust\nlet current_line = line!();\nprintln!(\"defined on line: {current_line}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"line!","insertTextFormat":2,"textEdit":{"newText":"line!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"debug_assert!(…)","kind":3,"detail":"macro_rules! debug_assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\nLike [`assert!`], this macro also has a second version, where a custom panic\nmessage can be provided.\n\n# Uses\n\nUnlike [`assert!`], `debug_assert!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert!` is always type checked.\n\nAn unchecked assertion allows a program in an inconsistent state to keep\nrunning, which might have unexpected consequences but does not introduce\nunsafety as long as this only happens in safe code. The performance cost\nof assertions, however, is not measurable in general. Replacing [`assert!`]\nwith `debug_assert!` is thus only encouraged after thorough profiling, and\nmore importantly, only in safe code!\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\ndebug_assert!(true);\n\nfn some_expensive_computation() -> bool { true } // a very simple function\ndebug_assert!(some_expensive_computation());\n\n// assert with a custom message\nlet x = true;\ndebug_assert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\ndebug_assert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert!","insertTextFormat":2,"textEdit":{"newText":"debug_assert!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"include_bytes!(…)","kind":3,"detail":"macro_rules! include_bytes","documentation":{"kind":"markdown","value":"Includes a file as a reference to a byte array.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static [u8; N]` which is\nthe contents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let bytes = include_bytes!(\"spanish.in\");\n assert_eq!(bytes, b\"adi\\xc3\\xb3s\\n\");\n print!(\"{}\", String::from_utf8_lossy(bytes));\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include_bytes!","insertTextFormat":2,"textEdit":{"newText":"include_bytes!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"const_format_args!(…)","kind":3,"detail":"macro_rules! const_format_args","documentation":{"kind":"markdown","value":"Same as [`format_args`], but can be used in some const contexts.\n\nThis macro is used by the panic macros for the `const_panic` feature.\n\nThis macro will be removed once `format_args` is allowed in const contexts."},"deprecated":false,"sortText":"ffffffef","filterText":"const_format_args!","insertTextFormat":2,"textEdit":{"newText":"const_format_args!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"env!(…)","kind":3,"detail":"macro_rules! env","documentation":{"kind":"markdown","value":"Inspects an environment variable at compile time.\n\nThis macro will expand to the value of the named environment variable at\ncompile time, yielding an expression of type `&'static str`. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nIf the environment variable is not defined, then a compilation error\nwill be emitted. To not emit a compile error, use the [`option_env!`]\nmacro instead.\n\n# Examples\n\n```rust\nlet path: &'static str = env!(\"PATH\");\nprintln!(\"the $PATH variable at the time of compiling was: {path}\");\n```\n\nYou can customize the error message by passing a string as the second\nparameter:\n\n```rust\nlet doc: &'static str = env!(\"documentation\", \"what's that?!\");\n```\n\nIf the `documentation` environment variable is not defined, you'll get\nthe following error:\n\n```text\nerror: what's that?!\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"env!","insertTextFormat":2,"textEdit":{"newText":"env!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"try!(…)","kind":3,"detail":"macro_rules! r#try","documentation":{"kind":"markdown","value":"Unwraps a result or propagates its error.\n\nThe [`?` operator][propagating-errors] was added to replace `try!`\nand should be used instead. Furthermore, `try` is a reserved word\nin Rust 2018, so if you must use it, you will need to use the\n[raw-identifier syntax][ris]: `r#try`.\n\n[propagating-errors]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator\n[ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html\n\n`try!` matches the given [`Result`]. In case of the `Ok` variant, the\nexpression has the value of the wrapped value.\n\nIn case of the `Err` variant, it retrieves the inner error. `try!` then\nperforms conversion using `From`. This provides automatic conversion\nbetween specialized errors and more general ones. The resulting\nerror is then immediately returned.\n\nBecause of the early return, `try!` can only be used in functions that\nreturn [`Result`].\n\n# Examples\n\n```rust\nuse std::io;\nuse std::fs::File;\nuse std::io::prelude::*;\n\nenum MyError {\n FileWriteError\n}\n\nimpl From for MyError {\n fn from(e: io::Error) -> MyError {\n MyError::FileWriteError\n }\n}\n\n// The preferred method of quick returning Errors\nfn write_to_file_question() -> Result<(), MyError> {\n let mut file = File::create(\"my_best_friends.txt\")?;\n file.write_all(b\"This is a list of my best friends.\")?;\n Ok(())\n}\n\n// The previous method of quick returning Errors\nfn write_to_file_using_try() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n r#try!(file.write_all(b\"This is a list of my best friends.\"));\n Ok(())\n}\n\n// This is equivalent to:\nfn write_to_file_using_match() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n match file.write_all(b\"This is a list of my best friends.\") {\n Ok(v) => v,\n Err(e) => return Err(From::from(e)),\n }\n Ok(())\n}\n```"},"deprecated":true,"sortText":"ffffffef","filterText":"try!","insertTextFormat":2,"textEdit":{"newText":"r#try!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[],"tags":[1]},{"label":"file!(…)","kind":3,"detail":"macro_rules! file","documentation":{"kind":"markdown","value":"Expands to the file name in which it was invoked.\n\nWith [`line!`] and [`column!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `&'static str`, and the returned file\nis not the invocation of the `file!` macro itself, but rather the\nfirst macro invocation leading up to the invocation of the `file!`\nmacro.\n\n# Examples\n\n```rust\nlet this_file = file!();\nprintln!(\"defined in file: {this_file}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"file!","insertTextFormat":2,"textEdit":{"newText":"file!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"thread_local! {…}","kind":3,"detail":"macro_rules! thread_local","documentation":{"kind":"markdown","value":"Declare a new thread local storage key of type [`std::thread::LocalKey`].\n\n# Syntax\n\nThe macro wraps any number of static declarations and makes them thread local.\nPublicity and attributes for each static are allowed. Example:\n\n```rust\nuse std::cell::RefCell;\nthread_local! {\n pub static FOO: RefCell = RefCell::new(1);\n\n static BAR: RefCell = RefCell::new(1.0);\n}\n\nFOO.with(|foo| assert_eq!(*foo.borrow(), 1));\nBAR.with(|bar| assert_eq!(*bar.borrow(), 1.0));\n```\n\nThis macro supports a special `const {}` syntax that can be used\nwhen the initialization expression can be evaluated as a constant.\nThis can enable a more efficient thread local implementation that\ncan avoid lazy initialization. For types that do not\n[need to be dropped][crate::mem::needs_drop], this can enable an\neven more efficient implementation that does not need to\ntrack any additional state.\n\n```rust\nuse std::cell::Cell;\nthread_local! {\n pub static FOO: Cell = const { Cell::new(1) };\n}\n\nFOO.with(|foo| assert_eq!(foo.get(), 1));\n```\n\nSee [`LocalKey` documentation][`std::thread::LocalKey`] for more\ninformation.\n\n[`std::thread::LocalKey`]: crate::thread::LocalKey"},"deprecated":false,"sortText":"ffffffef","filterText":"thread_local!","insertTextFormat":2,"textEdit":{"newText":"thread_local! {$0}","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"assert!(…)","kind":3,"detail":"macro_rules! assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\n# Uses\n\nAssertions are always checked in both debug and release builds, and cannot\nbe disabled. See [`debug_assert!`] for assertions that are not enabled in\nrelease builds by default.\n\nUnsafe code may rely on `assert!` to enforce run-time invariants that, if\nviolated could lead to unsafety.\n\nOther use-cases of `assert!` include testing and enforcing run-time\ninvariants in safe code (whose violation cannot result in unsafety).\n\n# Custom Messages\n\nThis macro has a second form, where a custom panic message can\nbe provided with or without arguments for formatting. See [`std::fmt`]\nfor syntax for this form. Expressions used as format arguments will only\nbe evaluated if the assertion fails.\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\nassert!(true);\n\nfn some_computation() -> bool { true } // a very simple function\n\nassert!(some_computation());\n\n// assert with a custom message\nlet x = true;\nassert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\nassert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert!","insertTextFormat":2,"textEdit":{"newText":"assert!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"column!(…)","kind":3,"detail":"macro_rules! column","documentation":{"kind":"markdown","value":"Expands to the column number at which it was invoked.\n\nWith [`line!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first column\nin each line evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned column is *not necessarily* the line of the `column!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `column!` macro.\n\n# Examples\n\n```rust\nlet current_col = column!();\nprintln!(\"defined on column: {current_col}\");\n```\n\n`column!` counts Unicode code points, not bytes or graphemes. As a result, the first two\ninvocations return the same value, but the third does not.\n\n```rust\nlet a = (\"foobar\", column!()).1;\nlet b = (\"人之初性本善\", column!()).1;\nlet c = (\"f̅o̅o̅b̅a̅r̅\", column!()).1; // Uses combining overline (U+0305)\n\nassert_eq!(a, b);\nassert_ne!(b, c);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"column!","insertTextFormat":2,"textEdit":{"newText":"column!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"format_args_nl!(…)","kind":3,"detail":"macro_rules! format_args_nl","documentation":{"kind":"markdown","value":"Same as [`format_args`], but adds a newline in the end."},"deprecated":false,"sortText":"ffffffef","filterText":"format_args_nl!","insertTextFormat":2,"textEdit":{"newText":"format_args_nl!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"unreachable!(…)","kind":3,"detail":"macro_rules! unreachable","documentation":{"kind":"markdown","value":"Indicates unreachable code.\n\nThis is useful any time that the compiler can't determine that some code is unreachable. For\nexample:\n\n* Match arms with guard conditions.\n* Loops that dynamically terminate.\n* Iterators that dynamically terminate.\n\nIf the determination that the code is unreachable proves incorrect, the\nprogram immediately terminates with a [`panic!`].\n\nThe unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which\nwill cause undefined behavior if the code is reached.\n\n[`unreachable_unchecked`]: crate::hint::unreachable_unchecked\n\n# Panics\n\nThis will always [`panic!`] because `unreachable!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nMatch arms:\n\n```rust\nfn foo(x: Option) {\n match x {\n Some(n) if n >= 0 => println!(\"Some(Non-negative)\"),\n Some(n) if n < 0 => println!(\"Some(Negative)\"),\n Some(_) => unreachable!(), // compile error if commented out\n None => println!(\"None\")\n }\n}\n```\n\nIterators:\n\n```rust\nfn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3\n for i in 0.. {\n if 3*i < i { panic!(\"u32 overflow\"); }\n if x < 3*i { return i-1; }\n }\n unreachable!(\"The loop should always return\");\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"unreachable!","insertTextFormat":2,"textEdit":{"newText":"unreachable!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"eprintln!(…)","kind":3,"detail":"macro_rules! eprintln","documentation":{"kind":"markdown","value":"Prints to the standard error, with a newline.\n\nEquivalent to the [`println!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`println!`] for\nexample usage.\n\nUse `eprintln!` only for error and progress messages. Use `println!`\ninstead for the primary output of your program.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n[`println!`]: crate::println\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprintln!(\"Error: Could not complete task\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"eprintln!","insertTextFormat":2,"textEdit":{"newText":"eprintln!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"unimplemented!(…)","kind":3,"detail":"macro_rules! unimplemented","documentation":{"kind":"markdown","value":"Indicates unimplemented code by panicking with a message of \"not implemented\".\n\nThis allows your code to type-check, which is useful if you are prototyping or\nimplementing a trait that requires multiple methods which you don't plan to use all of.\n\nThe difference between `unimplemented!` and [`todo!`] is that while `todo!`\nconveys an intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `unimplemented!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n[`todo!`]: crate::todo\n\n# Examples\n\nSay we have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` for 'MyStruct', but for some reason it only makes sense\nto implement the `bar()` function. `baz()` and `qux()` will still need to be defined\nin our implementation of `Foo`, but we can use `unimplemented!` in their definitions\nto allow our code to compile.\n\nWe still want to have our program stop running if the unimplemented methods are\nreached.\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // It makes no sense to `baz` a `MyStruct`, so we have no logic here\n // at all.\n // This will display \"thread 'main' panicked at 'not implemented'\".\n unimplemented!();\n }\n\n fn qux(&self) -> Result {\n // We have some logic here,\n // We can add a message to unimplemented! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not implemented: MyStruct isn't quxable'\".\n unimplemented!(\"MyStruct isn't quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"unimplemented!","insertTextFormat":2,"textEdit":{"newText":"unimplemented!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"cfg!(…)","kind":3,"detail":"macro_rules! cfg","documentation":{"kind":"markdown","value":"Evaluates boolean combinations of configuration flags at compile-time.\n\nIn addition to the `#[cfg]` attribute, this macro is provided to allow\nboolean expression evaluation of configuration flags. This frequently\nleads to less duplicated code.\n\nThe syntax given to this macro is the same syntax as the [`cfg`]\nattribute.\n\n`cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For\nexample, all blocks in an if/else expression need to be valid when `cfg!` is used for\nthe condition, regardless of what `cfg!` is evaluating.\n\n[`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute\n\n# Examples\n\n```rust\nlet my_directory = if cfg!(windows) {\n \"windows-specific-directory\"\n} else {\n \"unix-directory\"\n};\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"cfg!","insertTextFormat":2,"textEdit":{"newText":"cfg!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"todo!(…)","kind":3,"detail":"macro_rules! todo","documentation":{"kind":"markdown","value":"Indicates unfinished code.\n\nThis can be useful if you are prototyping and just\nwant a placeholder to let your code pass type analysis.\n\nThe difference between [`unimplemented!`] and `todo!` is that while `todo!` conveys\nan intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `todo!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nHere's an example of some in-progress code. We have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` on one of our types, but we also want to work on\njust `bar()` first. In order for our code to compile, we need to implement\n`baz()` and `qux()`, so we can use `todo!`:\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // Let's not worry about implementing baz() for now\n todo!();\n }\n\n fn qux(&self) -> Result {\n // We can add a message to todo! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not yet implemented: MyStruct is not yet quxable'\".\n todo!(\"MyStruct is not yet quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n\n // We aren't even using baz() or qux(), so this is fine.\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"todo!","insertTextFormat":2,"textEdit":{"newText":"todo!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"trace_macros!(…)","kind":3,"detail":"macro_rules! trace_macros","documentation":{"kind":"markdown","value":"Enables or disables tracing functionality used for debugging other macros."},"deprecated":false,"sortText":"ffffffef","filterText":"trace_macros!","insertTextFormat":2,"textEdit":{"newText":"trace_macros!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"module_path!(…)","kind":3,"detail":"macro_rules! module_path","documentation":{"kind":"markdown","value":"Expands to a string that represents the current module path.\n\nThe current module path can be thought of as the hierarchy of modules\nleading back up to the crate root. The first component of the path\nreturned is the name of the crate currently being compiled.\n\n# Examples\n\n```rust\nmod test {\n pub fn foo() {\n assert!(module_path!().ends_with(\"test\"));\n }\n}\n\ntest::foo();\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"module_path!","insertTextFormat":2,"textEdit":{"newText":"module_path!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"option_env!(…)","kind":3,"detail":"macro_rules! option_env","documentation":{"kind":"markdown","value":"Optionally inspects an environment variable at compile time.\n\nIf the named environment variable is present at compile time, this will\nexpand into an expression of type `Option<&'static str>` whose value is\n`Some` of the value of the environment variable. If the environment\nvariable is not present, then this will expand to `None`. See\n[`Option`][Option] for more information on this type. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nA compile time error is never emitted when using this macro regardless\nof whether the environment variable is present or not.\nTo emit a compile error if the environment variable is not present,\nuse the [`env!`] macro instead.\n\n# Examples\n\n```rust\nlet key: Option<&'static str> = option_env!(\"SECRET_KEY\");\nprintln!(\"the secret key might be: {key:?}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"option_env!","insertTextFormat":2,"textEdit":{"newText":"option_env!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"writeln!(…)","kind":3,"detail":"macro_rules! writeln","documentation":{"kind":"markdown","value":"Write formatted data into a buffer, with a newline appended.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`).\n\nFor more information, see [`write!`]. For information on the format string syntax, see\n[`std::fmt`].\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\nuse std::io::{Write, Result};\n\nfn main() -> Result<()> {\n let mut w = Vec::new();\n writeln!(&mut w)?;\n writeln!(&mut w, \"test\")?;\n writeln!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(&w[..], \"\\ntest\\nformatted arguments\\n\".as_bytes());\n Ok(())\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"writeln!","insertTextFormat":2,"textEdit":{"newText":"writeln!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"assert_eq!(…)","kind":3,"detail":"macro_rules! assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\nassert_eq!(a, b);\n\nassert_eq!(a, b, \"we are testing addition with {} and {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert_eq!","insertTextFormat":2,"textEdit":{"newText":"assert_eq!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"compile_error!(…)","kind":3,"detail":"macro_rules! compile_error","documentation":{"kind":"markdown","value":"Causes compilation to fail with the given error message when encountered.\n\nThis macro should be used when a crate uses a conditional compilation strategy to provide\nbetter error messages for erroneous conditions. It's the compiler-level form of [`panic!`],\nbut emits an error during *compilation* rather than at *runtime*.\n\n# Examples\n\nTwo such examples are macros and `#[cfg]` environments.\n\nEmit a better compiler error if a macro is passed invalid values. Without the final branch,\nthe compiler would still emit an error, but the error's message would not mention the two\nvalid values.\n\n```rust\nmacro_rules! give_me_foo_or_bar {\n (foo) => {};\n (bar) => {};\n ($x:ident) => {\n compile_error!(\"This macro only accepts `foo` or `bar`\");\n }\n}\n\ngive_me_foo_or_bar!(neither);\n// ^ will fail at compile time with message \"This macro only accepts `foo` or `bar`\"\n```\n\nEmit a compiler error if one of a number of features isn't available.\n\n```rust\n#[cfg(not(any(feature = \"foo\", feature = \"bar\")))]\ncompile_error!(\"Either feature \\\"foo\\\" or \\\"bar\\\" must be enabled for this crate.\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"compile_error!","insertTextFormat":2,"textEdit":{"newText":"compile_error!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"matches!(…)","kind":3,"detail":"macro_rules! matches","documentation":{"kind":"markdown","value":"Returns whether the given expression matches any of the given patterns.\n\nLike in a `match` expression, the pattern can be optionally followed by `if`\nand a guard expression that has access to names bound by the pattern.\n\n# Examples\n\n```rust\nlet foo = 'f';\nassert!(matches!(foo, 'A'..='Z' | 'a'..='z'));\n\nlet bar = Some(4);\nassert!(matches!(bar, Some(x) if x > 2));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"matches!","insertTextFormat":2,"textEdit":{"newText":"matches!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"format_args!(…)","kind":3,"detail":"macro_rules! format_args","documentation":{"kind":"markdown","value":"Constructs parameters for the other string-formatting macros.\n\nThis macro functions by taking a formatting string literal containing\n`{}` for each additional argument passed. `format_args!` prepares the\nadditional parameters to ensure the output can be interpreted as a string\nand canonicalizes the arguments into a single type. Any value that implements\nthe [`Display`] trait can be passed to `format_args!`, as can any\n[`Debug`] implementation be passed to a `{:?}` within the formatting string.\n\nThis macro produces a value of type [`fmt::Arguments`]. This value can be\npassed to the macros within [`std::fmt`] for performing useful redirection.\nAll other formatting macros ([`format!`], [`write!`], [`println!`], etc) are\nproxied through this one. `format_args!`, unlike its derived macros, avoids\nheap allocations.\n\nYou can use the [`fmt::Arguments`] value that `format_args!` returns\nin `Debug` and `Display` contexts as seen below. The example also shows\nthat `Debug` and `Display` format to the same thing: the interpolated\nformat string in `format_args!`.\n\n```rust\nlet debug = format!(\"{:?}\", format_args!(\"{} foo {:?}\", 1, 2));\nlet display = format!(\"{}\", format_args!(\"{} foo {:?}\", 1, 2));\nassert_eq!(\"1 foo 2\", display);\nassert_eq!(display, debug);\n```\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax, and further information.\n\n[`Display`]: crate::fmt::Display\n[`Debug`]: crate::fmt::Debug\n[`fmt::Arguments`]: crate::fmt::Arguments\n[`std::fmt`]: ../std/fmt/index.html\n[`format!`]: ../std/macro.format.html\n[`println!`]: ../std/macro.println.html\n\n# Examples\n\n```rust\nuse std::fmt;\n\nlet s = fmt::format(format_args!(\"hello {}\", \"world\"));\nassert_eq!(s, format!(\"hello {}\", \"world\"));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"format_args!","insertTextFormat":2,"textEdit":{"newText":"format_args!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"is_x86_feature_detected!(…)","kind":3,"detail":"macro_rules! is_x86_feature_detected","documentation":{"kind":"markdown","value":"A macro to test at *runtime* whether a CPU feature is available on\nx86/x86-64 platforms.\n\nThis macro is provided in the standard library and will detect at runtime\nwhether the specified CPU feature is detected. This does **not** resolve at\ncompile time unless the specified feature is already enabled for the entire\ncrate. Runtime detection currently relies mostly on the `cpuid` instruction.\n\nThis macro only takes one argument which is a string literal of the feature\nbeing tested for. The feature names supported are the lowercase versions of\nthe ones defined by Intel in [their documentation][docs].\n\n## Supported arguments\n\nThis macro supports the same names that `#[target_feature]` supports. Unlike\n`#[target_feature]`, however, this macro does not support names separated\nwith a comma. Instead testing for multiple features must be done through\nseparate macro invocations for now.\n\nSupported arguments are:\n\n* `\"aes\"`\n* `\"pclmulqdq\"`\n* `\"rdrand\"`\n* `\"rdseed\"`\n* `\"tsc\"`\n* `\"mmx\"`\n* `\"sse\"`\n* `\"sse2\"`\n* `\"sse3\"`\n* `\"ssse3\"`\n* `\"sse4.1\"`\n* `\"sse4.2\"`\n* `\"sse4a\"`\n* `\"sha\"`\n* `\"avx\"`\n* `\"avx2\"`\n* `\"avx512f\"`\n* `\"avx512cd\"`\n* `\"avx512er\"`\n* `\"avx512pf\"`\n* `\"avx512bw\"`\n* `\"avx512dq\"`\n* `\"avx512vl\"`\n* `\"avx512ifma\"`\n* `\"avx512vbmi\"`\n* `\"avx512vpopcntdq\"`\n* `\"avx512vbmi2\"`\n* `\"gfni\"`\n* `\"vaes\"`\n* `\"vpclmulqdq\"`\n* `\"avx512vnni\"`\n* `\"avx512bitalg\"`\n* `\"avx512bf16\"`\n* `\"avx512vp2intersect\"`\n* `\"f16c\"`\n* `\"fma\"`\n* `\"bmi1\"`\n* `\"bmi2\"`\n* `\"abm\"`\n* `\"lzcnt\"`\n* `\"tbm\"`\n* `\"popcnt\"`\n* `\"fxsr\"`\n* `\"xsave\"`\n* `\"xsaveopt\"`\n* `\"xsaves\"`\n* `\"xsavec\"`\n* `\"cmpxchg16b\"`\n* `\"adx\"`\n* `\"rtm\"`\n* `\"movbe\"`\n* `\"ermsb\"`\n\n[docs]: https://software.intel.com/sites/landingpage/IntrinsicsGuide"},"deprecated":false,"sortText":"ffffffef","filterText":"is_x86_feature_detected!","insertTextFormat":2,"textEdit":{"newText":"is_x86_feature_detected!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"concat_bytes!(…)","kind":3,"detail":"macro_rules! concat_bytes","documentation":{"kind":"markdown","value":"Concatenates literals into a byte slice.\n\nThis macro takes any number of comma-separated literals, and concatenates them all into\none, yielding an expression of type `&[u8; _]`, which represents all of the literals\nconcatenated left-to-right. The literals passed can be any combination of:\n\n- byte literals (`b'r'`)\n- byte strings (`b\"Rust\"`)\n- arrays of bytes/numbers (`[b'A', 66, b'C']`)\n\n# Examples\n\n```rust\n#![feature(concat_bytes)]\n\nlet s: &[u8; 6] = concat_bytes!(b'A', b\"BC\", [68, b'E', 70]);\nassert_eq!(s, b\"ABCDEF\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat_bytes!","insertTextFormat":2,"textEdit":{"newText":"concat_bytes!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"eprint!(…)","kind":3,"detail":"macro_rules! eprint","documentation":{"kind":"markdown","value":"Prints to the standard error.\n\nEquivalent to the [`print!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`print!`] for\nexample usage.\n\nUse `eprint!` only for error and progress messages. Use `print!`\ninstead for the primary output of your program.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprint!(\"Error: Could not complete task\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"eprint!","insertTextFormat":2,"textEdit":{"newText":"eprint!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"debug_assert_ne!(…)","kind":3,"detail":"macro_rules! debug_assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_ne!`], `debug_assert_ne!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_ne!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_ne!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_ne!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\ndebug_assert_ne!(a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert_ne!","insertTextFormat":2,"textEdit":{"newText":"debug_assert_ne!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"std","kind":9,"documentation":{"kind":"markdown","value":"# The Rust Standard Library\n\nThe Rust Standard Library is the foundation of portable Rust software, a\nset of minimal and battle-tested shared abstractions for the [broader Rust\necosystem][crates.io]. It offers core types, like [`Vec`] and\n[`Option`], library-defined [operations on language\nprimitives](#primitives), [standard macros](#macros), [I/O] and\n[multithreading], among [many other things][other].\n\n`std` is available to all Rust crates by default. Therefore, the\nstandard library can be accessed in [`use`] statements through the path\n`std`, as in [`use std::env`].\n\n# How to read this documentation\n\nIf you already know the name of what you are looking for, the fastest way to\nfind it is to use the search\nbar at the top of the page.\n\nOtherwise, you may want to jump to one of these useful sections:\n\n* [`std::*` modules](#modules)\n* [Primitive types](#primitives)\n* [Standard macros](#macros)\n* [The Rust Prelude]\n\nIf this is your first time, the documentation for the standard library is\nwritten to be casually perused. Clicking on interesting things should\ngenerally lead you to interesting places. Still, there are important bits\nyou don't want to miss, so read on for a tour of the standard library and\nits documentation!\n\nOnce you are familiar with the contents of the standard library you may\nbegin to find the verbosity of the prose distracting. At this stage in your\ndevelopment you may want to press the `[-]` button near the top of the\npage to collapse it into a more skimmable view.\n\nWhile you are looking at that `[-]` button also notice the `source`\nlink. Rust's API documentation comes with the source code and you are\nencouraged to read it. The standard library source is generally high\nquality and a peek behind the curtains is often enlightening.\n\n# What is in the standard library documentation?\n\nFirst of all, The Rust Standard Library is divided into a number of focused\nmodules, [all listed further down this page](#modules). These modules are\nthe bedrock upon which all of Rust is forged, and they have mighty names\nlike [`std::slice`] and [`std::cmp`]. Modules' documentation typically\nincludes an overview of the module along with examples, and are a smart\nplace to start familiarizing yourself with the library.\n\nSecond, implicit methods on [primitive types] are documented here. This can\nbe a source of confusion for two reasons:\n\n1. While primitives are implemented by the compiler, the standard library\n implements methods directly on the primitive types (and it is the only\n library that does so), which are [documented in the section on\n primitives](#primitives).\n2. The standard library exports many modules *with the same name as\n primitive types*. These define additional items related to the primitive\n type, but not the all-important methods.\n\nSo for example there is a [page for the primitive type\n`i32`](primitive::i32) that lists all the methods that can be called on\n32-bit integers (very useful), and there is a [page for the module\n`std::i32`] that documents the constant values [`MIN`] and [`MAX`] (rarely\nuseful).\n\nNote the documentation for the primitives [`str`] and [`[T]`][prim@slice] (also\ncalled 'slice'). Many method calls on [`String`] and [`Vec`] are actually\ncalls to methods on [`str`] and [`[T]`][prim@slice] respectively, via [deref\ncoercions][deref-coercions].\n\nThird, the standard library defines [The Rust Prelude], a small collection\nof items - mostly traits - that are imported into every module of every\ncrate. The traits in the prelude are pervasive, making the prelude\ndocumentation a good entry point to learning about the library.\n\nAnd finally, the standard library exports a number of standard macros, and\n[lists them on this page](#macros) (technically, not all of the standard\nmacros are defined by the standard library - some are defined by the\ncompiler - but they are documented here the same). Like the prelude, the\nstandard macros are imported by default into all crates.\n\n# Contributing changes to the documentation\n\nCheck out the rust contribution guidelines [here](\nhttps://rustc-dev-guide.rust-lang.org/contributing.html#writing-documentation).\nThe source for this documentation can be found on\n[GitHub](https://github.com/rust-lang/rust).\nTo contribute changes, make sure you read the guidelines first, then submit\npull-requests for your suggested changes.\n\nContributions are appreciated! If you see a part of the docs that can be\nimproved, submit a PR, or chat with us first on [Discord][rust-discord]\n#docs.\n\n# A Tour of The Rust Standard Library\n\nThe rest of this crate documentation is dedicated to pointing out notable\nfeatures of The Rust Standard Library.\n\n## Containers and collections\n\nThe [`option`] and [`result`] modules define optional and error-handling\ntypes, [`Option`] and [`Result`]. The [`iter`] module defines\nRust's iterator trait, [`Iterator`], which works with the [`for`] loop to\naccess collections.\n\nThe standard library exposes three common ways to deal with contiguous\nregions of memory:\n\n* [`Vec`] - A heap-allocated *vector* that is resizable at runtime.\n* [`[T; N]`][prim@array] - An inline *array* with a fixed size at compile time.\n* [`[T]`][prim@slice] - A dynamically sized *slice* into any other kind of contiguous\n storage, whether heap-allocated or not.\n\nSlices can only be handled through some kind of *pointer*, and as such come\nin many flavors such as:\n\n* `&[T]` - *shared slice*\n* `&mut [T]` - *mutable slice*\n* [`Box<[T]>`][owned slice] - *owned slice*\n\n[`str`], a UTF-8 string slice, is a primitive type, and the standard library\ndefines many methods for it. Rust [`str`]s are typically accessed as\nimmutable references: `&str`. Use the owned [`String`] for building and\nmutating strings.\n\nFor converting to strings use the [`format!`] macro, and for converting from\nstrings use the [`FromStr`] trait.\n\nData may be shared by placing it in a reference-counted box or the [`Rc`]\ntype, and if further contained in a [`Cell`] or [`RefCell`], may be mutated\nas well as shared. Likewise, in a concurrent setting it is common to pair an\natomically-reference-counted box, [`Arc`], with a [`Mutex`] to get the same\neffect.\n\nThe [`collections`] module defines maps, sets, linked lists and other\ntypical collection types, including the common [`HashMap`].\n\n## Platform abstractions and I/O\n\nBesides basic data types, the standard library is largely concerned with\nabstracting over differences in common platforms, most notably Windows and\nUnix derivatives.\n\nCommon types of I/O, including [files], [TCP], and [UDP], are defined in\nthe [`io`], [`fs`], and [`net`] modules.\n\nThe [`thread`] module contains Rust's threading abstractions. [`sync`]\ncontains further primitive shared memory types, including [`atomic`] and\n[`mpsc`], which contains the channel types for message passing.\n\n# Use before and after `main()`\n\nMany parts of the standard library are expected to work before and after `main()`;\nbut this is not guaranteed or ensured by tests. It is recommended that you write your own tests\nand run them on each platform you wish to support.\nThis means that use of `std` before/after main, especially of features that interact with the\nOS or global state, is exempted from stability and portability guarantees and instead only\nprovided on a best-effort basis. Nevertheless bug reports are appreciated.\n\nOn the other hand `core` and `alloc` are most likely to work in such environments with\nthe caveat that any hookable behavior such as panics, oom handling or allocators will also\ndepend on the compatibility of the hooks.\n\nSome features may also behave differently outside main, e.g. stdio could become unbuffered,\nsome panics might turn into aborts, backtraces might not get symbolicated or similar.\n\nNon-exhaustive list of known limitations:\n\n- after-main use of thread-locals, which also affects additional features:\n - [`thread::current()`]\n - [`thread::scope()`]\n - [`sync::mpsc`]\n- before-main stdio file descriptors are not guaranteed to be open on unix platforms\n\n\n[I/O]: io\n[`MIN`]: i32::MIN\n[`MAX`]: i32::MAX\n[page for the module `std::i32`]: crate::i32\n[TCP]: net::TcpStream\n[The Rust Prelude]: prelude\n[UDP]: net::UdpSocket\n[`Arc`]: sync::Arc\n[owned slice]: boxed\n[`Cell`]: cell::Cell\n[`FromStr`]: str::FromStr\n[`HashMap`]: collections::HashMap\n[`Mutex`]: sync::Mutex\n[`Option`]: option::Option\n[`Rc`]: rc::Rc\n[`RefCell`]: cell::RefCell\n[`Result`]: result::Result\n[`Vec`]: vec::Vec\n[`atomic`]: sync::atomic\n[`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for\n[`str`]: prim@str\n[`mpsc`]: sync::mpsc\n[`std::cmp`]: cmp\n[`std::slice`]: mod@slice\n[`use std::env`]: env/index.html\n[`use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html\n[crates.io]: https://crates.io\n[deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods\n[files]: fs::File\n[multithreading]: thread\n[other]: #what-is-in-the-standard-library-documentation\n[primitive types]: ../book/ch03-02-data-types.html\n[rust-discord]: https://discord.gg/rust-lang\n[array]: prim@array\n[slice]: prim@slice"},"deprecated":false,"sortText":"ffffffef","filterText":"std","textEdit":{"newText":"std","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"alloc","kind":9,"documentation":{"kind":"markdown","value":"# The Rust core allocation and collections library\n\nThis library provides smart pointers and collections for managing\nheap-allocated values.\n\nThis library, like core, normally doesn’t need to be used directly\nsince its contents are re-exported in the [`std` crate](../std/index.html).\nCrates that use the `#![no_std]` attribute however will typically\nnot depend on `std`, so they’d use this crate instead.\n\n## Boxed values\n\nThe [`Box`] type is a smart pointer type. There can only be one owner of a\n[`Box`], and the owner can decide to mutate the contents, which live on the\nheap.\n\nThis type can be sent among threads efficiently as the size of a `Box` value\nis the same as that of a pointer. Tree-like data structures are often built\nwith boxes because each node often has only one owner, the parent.\n\n## Reference counted pointers\n\nThe [`Rc`] type is a non-threadsafe reference-counted pointer type intended\nfor sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and\nonly allows access to `&T`, a shared reference.\n\nThis type is useful when inherited mutability (such as using [`Box`]) is too\nconstraining for an application, and is often paired with the [`Cell`] or\n[`RefCell`] types in order to allow mutation.\n\n## Atomically reference counted pointers\n\nThe [`Arc`] type is the threadsafe equivalent of the [`Rc`] type. It\nprovides all the same functionality of [`Rc`], except it requires that the\ncontained type `T` is shareable. Additionally, [`Arc`][`Arc`] is itself\nsendable while [`Rc`][`Rc`] is not.\n\nThis type allows for shared access to the contained data, and is often\npaired with synchronization primitives such as mutexes to allow mutation of\nshared resources.\n\n## Collections\n\nImplementations of the most common general purpose data structures are\ndefined in this library. They are re-exported through the\n[standard collections library](../std/collections/index.html).\n\n## Heap interfaces\n\nThe [`alloc`](alloc/index.html) module defines the low-level interface to the\ndefault global allocator. It is not compatible with the libc allocator API.\n\n[`Arc`]: sync\n[`Box`]: boxed\n[`Cell`]: core::cell\n[`Rc`]: rc\n[`RefCell`]: core::cell"},"deprecated":false,"sortText":"ffffffef","filterText":"alloc","textEdit":{"newText":"alloc","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"core","kind":9,"documentation":{"kind":"markdown","value":"# The Rust Core Library\n\nThe Rust Core Library is the dependency-free[^free] foundation of [The\nRust Standard Library](../std/index.html). It is the portable glue\nbetween the language and its libraries, defining the intrinsic and\nprimitive building blocks of all Rust code. It links to no\nupstream libraries, no system libraries, and no libc.\n\n[^free]: Strictly speaking, there are some symbols which are needed but\n they aren't always necessary.\n\nThe core library is *minimal*: it isn't even aware of heap allocation,\nnor does it provide concurrency or I/O. These things require\nplatform integration, and this library is platform-agnostic.\n\n# How to use the core library\n\nPlease note that all of these details are currently not considered stable.\n\nThis library is built on the assumption of a few existing symbols:\n\n* `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines\n which are generated by Rust codegen backends. Additionally, this library can make explicit\n calls to `strlen`. Their signatures are the same as found in C, but there are extra\n assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if\n the `n` parameter is 0, the function is assumed to not be UB, even if the pointers are NULL or\n dangling. (Note that making extra assumptions about these functions is common among compilers:\n [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)\n These functions are often provided by the system libc, but can also be provided by the\n [compiler-builtins crate](https://crates.io/crates/compiler_builtins).\n Note that the library does not guarantee that it will always make these assumptions, so Rust\n user code directly calling the C functions should follow the C specification! The advice for\n Rust user code is to call the functions provided by this library instead (such as\n `ptr::copy`).\n\n* `rust_begin_panic` - This function takes four arguments, a\n `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments\n dictate the panic message, the file at which panic was invoked, and the\n line and column inside the file. It is up to consumers of this core\n library to define this panic function; it is only required to never\n return. This requires a `lang` attribute named `panic_impl`.\n\n* `rust_eh_personality` - is used by the failure mechanisms of the\n compiler. This is often mapped to GCC's personality function, but crates\n which do not trigger a panic can be assured that this function is never\n called. The `lang` attribute is called `eh_personality`."},"deprecated":false,"sortText":"ffffffef","filterText":"core","textEdit":{"newText":"core","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"u32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u32","textEdit":{"newText":"u32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"bool","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"bool","textEdit":{"newText":"bool","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"u8","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u8","textEdit":{"newText":"u8","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"isize","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"isize","textEdit":{"newText":"isize","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"u16","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u16","textEdit":{"newText":"u16","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"u64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u64","textEdit":{"newText":"u64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"u128","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u128","textEdit":{"newText":"u128","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"f32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"f32","textEdit":{"newText":"f32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"i128","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i128","textEdit":{"newText":"i128","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"i16","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i16","textEdit":{"newText":"i16","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"str","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"str","textEdit":{"newText":"str","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"i64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i64","textEdit":{"newText":"i64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"char","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"char","textEdit":{"newText":"char","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"f64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"f64","textEdit":{"newText":"f64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"i32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i32","textEdit":{"newText":"i32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"i8","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i8","textEdit":{"newText":"i8","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"usize","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"usize","textEdit":{"newText":"usize","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"AsMut","kind":8,"documentation":{"kind":"markdown","value":"Used to do a cheap mutable-to-mutable reference conversion.\n\nThis trait is similar to [`AsRef`] but used for converting between mutable\nreferences. If you need to do a costly conversion it is better to\nimplement [`From`] with type `&mut T` or write a custom function.\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsMut` auto-dereferences if the inner type is a mutable reference\n(e.g.: `foo.as_mut()` will work the same if `foo` has type `&mut Foo` or `&mut &mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[mutably dereferenceable types], e.g. `foo.as_mut()` will *not* work the same as\n`Box::new(foo).as_mut()`. Instead, many smart pointers provide an `as_mut` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsMut::as_mut`] should not be\nused for the sole purpose of mutable dereferencing; instead ['`Deref` coercion'] can be used:\n\n[mutably dereferenceable types]: core::ops::DerefMut\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::DerefMut#mutable-deref-coercion\n\n```rust\nlet mut x = Box::new(5i32);\n// Avoid this:\n// let y: &mut i32 = x.as_mut();\n// Better just write:\nlet y: &mut i32 = &mut x;\n```\n\nTypes which implement [`DerefMut`] should consider to add an implementation of `AsMut` as\nfollows:\n\n[`DerefMut`]: core::ops::DerefMut\n\n```rust\nimpl AsMut for SomeType\nwhere\n ::Target: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.deref_mut().as_mut()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsMut` would be reflexive, i.e. there would be an `impl AsMut for T`\nwith [`as_mut`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&mut T where T: AsMut` which allows `AsMut` to auto-dereference, see \"Generic\nImplementations\" above).\n\n[`as_mut`]: AsMut::as_mut\n\nA trivial implementation of `AsMut for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nUsing `AsMut` as trait bound for a generic function, we can accept all mutable references that\ncan be converted to type `&mut T`. Unlike [dereference], which has a single [target type],\nthere can be multiple implementations of `AsMut` for a type. In particular, `Vec` implements\nboth `AsMut>` and `AsMut<[T]>`.\n\nIn the following, the example functions `caesar` and `null_terminate` provide a generic\ninterface which work with any type that can be converted by cheap mutable-to-mutable conversion\ninto a byte slice (`[u8]`) or byte vector (`Vec`), respectively.\n\n[dereference]: core::ops::DerefMut\n[target type]: core::ops::Deref::Target\n\n```rust\nstruct Document {\n info: String,\n content: Vec,\n}\n\nimpl AsMut for Document\nwhere\n Vec: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.content.as_mut()\n }\n}\n\nfn caesar>(data: &mut T, key: u8) {\n for byte in data.as_mut() {\n *byte = byte.wrapping_add(key);\n }\n}\n\nfn null_terminate>>(data: &mut T) {\n // Using a non-generic inner function, which contains most of the\n // functionality, helps to minimize monomorphization overhead.\n fn doit(data: &mut Vec) {\n let len = data.len();\n if len == 0 || data[len-1] != 0 {\n data.push(0);\n }\n }\n doit(data.as_mut());\n}\n\nfn main() {\n let mut v: Vec = vec![1, 2, 3];\n caesar(&mut v, 5);\n assert_eq!(v, [6, 7, 8]);\n null_terminate(&mut v);\n assert_eq!(v, [6, 7, 8, 0]);\n let mut doc = Document {\n info: String::from(\"Example\"),\n content: vec![17, 19, 8],\n };\n caesar(&mut doc, 1);\n assert_eq!(doc.content, [18, 20, 9]);\n null_terminate(&mut doc);\n assert_eq!(doc.content, [18, 20, 9, 0]);\n}\n```\n\nNote, however, that APIs don't need to be generic. In many cases taking a `&mut [u8]` or\n`&mut Vec`, for example, is the better choice (callers need to pass the correct type then)."},"deprecated":false,"sortText":"ffffffef","filterText":"AsMut","textEdit":{"newText":"AsMut","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"AsRef","kind":8,"documentation":{"kind":"markdown","value":"Used to do a cheap reference-to-reference conversion.\n\nThis trait is similar to [`AsMut`] which is used for converting between mutable references.\nIf you need to do a costly conversion it is better to implement [`From`] with type\n`&T` or write a custom function.\n\n# Relation to `Borrow`\n\n`AsRef` has the same signature as [`Borrow`], but [`Borrow`] is different in a few aspects:\n\n- Unlike `AsRef`, [`Borrow`] has a blanket impl for any `T`, and can be used to accept either\n a reference or a value. (See also note on `AsRef`'s reflexibility below.)\n- [`Borrow`] also requires that [`Hash`], [`Eq`] and [`Ord`] for a borrowed value are\n equivalent to those of the owned value. For this reason, if you want to\n borrow only a single field of a struct you can implement `AsRef`, but not [`Borrow`].\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsRef` auto-dereferences if the inner type is a reference or a mutable reference\n(e.g.: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[dereferenceable types], e.g. `foo.as_ref()` will *not* work the same as\n`Box::new(foo).as_ref()`. Instead, many smart pointers provide an `as_ref` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsRef::as_ref`] should not be\nused for the sole purpose of dereferencing; instead ['`Deref` coercion'] can be used:\n\n[dereferenceable types]: core::ops::Deref\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::Deref#deref-coercion\n\n```rust\nlet x = Box::new(5i32);\n// Avoid this:\n// let y: &i32 = x.as_ref();\n// Better just write:\nlet y: &i32 = &x;\n```\n\nTypes which implement [`Deref`] should consider implementing `AsRef` as follows:\n\n[`Deref`]: core::ops::Deref\n\n```rust\nimpl AsRef for SomeType\nwhere\n T: ?Sized,\n ::Target: AsRef,\n{\n fn as_ref(&self) -> &T {\n self.deref().as_ref()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsRef` would be reflexive, i.e. there would be an `impl AsRef for T`\nwith [`as_ref`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&T where T: AsRef` which allows `AsRef` to auto-dereference, see \"Generic Implementations\"\nabove).\n\n[`as_ref`]: AsRef::as_ref\n\nA trivial implementation of `AsRef for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nBy using trait bounds we can accept arguments of different types as long as they can be\nconverted to the specified type `T`.\n\nFor example: By creating a generic function that takes an `AsRef` we express that we\nwant to accept all references that can be converted to [`&str`] as an argument.\nSince both [`String`] and [`&str`] implement `AsRef` we can accept both as input argument.\n\n[`&str`]: primitive@str\n[`Borrow`]: crate::borrow::Borrow\n[`Eq`]: crate::cmp::Eq\n[`Ord`]: crate::cmp::Ord\n[`String`]: ../../std/string/struct.String.html\n\n```rust\nfn is_hello>(s: T) {\n assert_eq!(\"hello\", s.as_ref());\n}\n\nlet s = \"hello\";\nis_hello(s);\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"AsRef","textEdit":{"newText":"AsRef","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Box","kind":22,"documentation":{"kind":"markdown","value":"A pointer type that uniquely owns a heap allocation of type `T`.\n\nSee the [module-level documentation](../../std/boxed/index.html) for more."},"deprecated":false,"sortText":"ffffffef","filterText":"Box","textEdit":{"newText":"Box","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Clone","kind":8,"documentation":{"kind":"markdown","value":"A common trait for the ability to explicitly duplicate an object.\n\nDiffers from [`Copy`] in that [`Copy`] is implicit and an inexpensive bit-wise copy, while\n`Clone` is always explicit and may or may not be expensive. In order to enforce\nthese characteristics, Rust does not allow you to reimplement [`Copy`], but you\nmay reimplement `Clone` and run arbitrary code.\n\nSince `Clone` is more general than [`Copy`], you can automatically make anything\n[`Copy`] be `Clone` as well.\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d\nimplementation of [`Clone`] calls [`clone`] on each field.\n\n[`clone`]: Clone::clone\n\nFor a generic struct, `#[derive]` implements `Clone` conditionally by adding bound `Clone` on\ngeneric parameters.\n\n```rust\n// `derive` implements Clone for Reading when T is Clone.\n#[derive(Clone)]\nstruct Reading {\n frequency: T,\n}\n```\n\n## How can I implement `Clone`?\n\nTypes that are [`Copy`] should have a trivial implementation of `Clone`. More formally:\nif `T: Copy`, `x: T`, and `y: &T`, then `let x = y.clone();` is equivalent to `let x = *y;`.\nManual implementations should be careful to uphold this invariant; however, unsafe code\nmust not rely on it to ensure memory safety.\n\nAn example is a generic struct holding a function pointer. In this case, the\nimplementation of `Clone` cannot be `derive`d, but can be implemented as:\n\n```rust\nstruct Generate(fn() -> T);\n\nimpl Copy for Generate {}\n\nimpl Clone for Generate {\n fn clone(&self) -> Self {\n *self\n }\n}\n```\n\nIf we `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n```\n\nthe auto-derived implementations will have unnecessary `T: Copy` and `T: Clone` bounds:\n\n```rust\n\n// Automatically derived\nimpl Copy for Generate { }\n\n// Automatically derived\nimpl Clone for Generate {\n fn clone(&self) -> Generate {\n Generate(Clone::clone(&self.0))\n }\n}\n```\n\nThe bounds are unnecessary because clearly the function itself should be\ncopy- and cloneable even if its return type is not:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n\nstruct NotCloneable;\n\nfn generate_not_cloneable() -> NotCloneable {\n NotCloneable\n}\n\nGenerate(generate_not_cloneable).clone(); // error: trait bounds were not satisfied\n// Note: With the manual implementations the above line will compile.\n```\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Clone`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Clone` themselves.\n Note that variables captured by shared reference always implement `Clone`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Clone`.\n\n[impls]: #implementors"},"deprecated":false,"sortText":"ffffffef","filterText":"Clone","textEdit":{"newText":"Clone","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Copy","kind":8,"documentation":{"kind":"markdown","value":"Types whose values can be duplicated simply by copying bits.\n\nBy default, variable bindings have 'move semantics.' In other\nwords:\n\n```rust\n#[derive(Debug)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `x` has moved into `y`, and so cannot be used\n\n// println!(\"{x:?}\"); // error: use of moved value\n```\n\nHowever, if a type implements `Copy`, it instead has 'copy semantics':\n\n```rust\n// We can derive a `Copy` implementation. `Clone` is also required, as it's\n// a supertrait of `Copy`.\n#[derive(Debug, Copy, Clone)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `y` is a copy of `x`\n\nprintln!(\"{x:?}\"); // A-OK!\n```\n\nIt's important to note that in these two examples, the only difference is whether you\nare allowed to access `x` after the assignment. Under the hood, both a copy and a move\ncan result in bits being copied in memory, although this is sometimes optimized away.\n\n## How can I implement `Copy`?\n\nThere are two ways to implement `Copy` on your type. The simplest is to use `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct MyStruct;\n```\n\nYou can also implement `Copy` and `Clone` manually:\n\n```rust\nstruct MyStruct;\n\nimpl Copy for MyStruct { }\n\nimpl Clone for MyStruct {\n fn clone(&self) -> MyStruct {\n *self\n }\n}\n```\n\nThere is a small difference between the two: the `derive` strategy will also place a `Copy`\nbound on type parameters, which isn't always desired.\n\n## What's the difference between `Copy` and `Clone`?\n\nCopies happen implicitly, for example as part of an assignment `y = x`. The behavior of\n`Copy` is not overloadable; it is always a simple bit-wise copy.\n\nCloning is an explicit action, `x.clone()`. The implementation of [`Clone`] can\nprovide any type-specific behavior necessary to duplicate values safely. For example,\nthe implementation of [`Clone`] for [`String`] needs to copy the pointed-to string\nbuffer in the heap. A simple bitwise copy of [`String`] values would merely copy the\npointer, leading to a double free down the line. For this reason, [`String`] is [`Clone`]\nbut not `Copy`.\n\n[`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement\n[`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`\n(see the example above).\n\n## When can my type be `Copy`?\n\nA type can implement `Copy` if all of its components implement `Copy`. For example, this\nstruct can be `Copy`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Point {\n x: i32,\n y: i32,\n}\n```\n\nA struct can be `Copy`, and [`i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.\nBy contrast, consider\n\n```rust\nstruct PointList {\n points: Vec,\n}\n```\n\nThe struct `PointList` cannot implement `Copy`, because [`Vec`] is not `Copy`. If we\nattempt to derive a `Copy` implementation, we'll get an error:\n\n```text\nthe trait `Copy` cannot be implemented for this type; field `points` does not implement `Copy`\n```\n\nShared references (`&T`) are also `Copy`, so a type can be `Copy`, even when it holds\nshared references of types `T` that are *not* `Copy`. Consider the following struct,\nwhich can implement `Copy`, because it only holds a *shared reference* to our non-`Copy`\ntype `PointList` from above:\n\n```rust\n#[derive(Copy, Clone)]\nstruct PointListWrapper<'a> {\n point_list_ref: &'a PointList,\n}\n```\n\n## When *can't* my type be `Copy`?\n\nSome types can't be copied safely. For example, copying `&mut T` would create an aliased\nmutable reference. Copying [`String`] would duplicate responsibility for managing the\n[`String`]'s buffer, leading to a double free.\n\nGeneralizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's\nmanaging some resource besides its own [`size_of::`] bytes.\n\nIf you try to implement `Copy` on a struct or enum containing non-`Copy` data, you will get\nthe error [E0204].\n\n[E0204]: ../../error_codes/E0204.html\n\n## When *should* my type be `Copy`?\n\nGenerally speaking, if your type _can_ implement `Copy`, it should. Keep in mind, though,\nthat implementing `Copy` is part of the public API of your type. If the type might become\nnon-`Copy` in the future, it could be prudent to omit the `Copy` implementation now, to\navoid a breaking API change.\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Copy`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Copy` themselves.\n Note that variables captured by shared reference always implement `Copy`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Copy`.\n\n[`Vec`]: ../../std/vec/struct.Vec.html\n[`String`]: ../../std/string/struct.String.html\n[`size_of::`]: crate::mem::size_of\n[impls]: #implementors"},"deprecated":false,"sortText":"ffffffef","filterText":"Copy","textEdit":{"newText":"Copy","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Default","kind":8,"documentation":{"kind":"markdown","value":"A trait for giving a type a useful default value.\n\nSometimes, you want to fall back to some kind of default value, and\ndon't particularly care what it is. This comes up often with `struct`s\nthat define a set of options:\n\n```rust\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```\n\nHow can we define some default values? You can use `Default`:\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n\nfn main() {\n let options: SomeOptions = Default::default();\n}\n```\n\nNow, you get all of the default values. Rust implements `Default` for various primitives types.\n\nIf you want to override a particular option, but still retain the other defaults:\n\n```rust\nfn main() {\n let options = SomeOptions { foo: 42, ..Default::default() };\n}\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all of the type's fields implement\n`Default`. When `derive`d, it will use the default value for each field's type.\n\n### `enum`s\n\nWhen using `#[derive(Default)]` on an `enum`, you need to choose which unit variant will be\ndefault. You do this by placing the `#[default]` attribute on the variant.\n\n```rust\n#[derive(Default)]\nenum Kind {\n #[default]\n A,\n B,\n C,\n}\n```\n\nYou cannot use the `#[default]` attribute on non-unit or non-exhaustive variants.\n\n## How can I implement `Default`?\n\nProvide an implementation for the `default()` method that returns the value of\nyour type that should be the default:\n\n```rust\nenum Kind {\n A,\n B,\n C,\n}\n\nimpl Default for Kind {\n fn default() -> Self { Kind::A }\n}\n```\n\n# Examples\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Default","textEdit":{"newText":"Default","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"DoubleEndedIterator","kind":8,"documentation":{"kind":"markdown","value":"An iterator able to yield elements from both ends.\n\nSomething that implements `DoubleEndedIterator` has one extra capability\nover something that implements [`Iterator`]: the ability to also take\n`Item`s from the back, as well as the front.\n\nIt is important to note that both back and forth work on the same range,\nand do not cross: iteration is over when they meet in the middle.\n\nIn a similar fashion to the [`Iterator`] protocol, once a\n`DoubleEndedIterator` returns [`None`] from a [`next_back()`], calling it\nagain may or may not ever return [`Some`] again. [`next()`] and\n[`next_back()`] are interchangeable for this purpose.\n\n[`next_back()`]: DoubleEndedIterator::next_back\n[`next()`]: Iterator::next\n\n# Examples\n\nBasic usage:\n\n```rust\nlet numbers = vec![1, 2, 3, 4, 5, 6];\n\nlet mut iter = numbers.iter();\n\nassert_eq!(Some(&1), iter.next());\nassert_eq!(Some(&6), iter.next_back());\nassert_eq!(Some(&5), iter.next_back());\nassert_eq!(Some(&2), iter.next());\nassert_eq!(Some(&3), iter.next());\nassert_eq!(Some(&4), iter.next());\nassert_eq!(None, iter.next());\nassert_eq!(None, iter.next_back());\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"DoubleEndedIterator","textEdit":{"newText":"DoubleEndedIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Drop","kind":8,"documentation":{"kind":"markdown","value":"Custom code within the destructor.\n\nWhen a value is no longer needed, Rust will run a \"destructor\" on that value.\nThe most common way that a value is no longer needed is when it goes out of\nscope. Destructors may still run in other circumstances, but we're going to\nfocus on scope for the examples here. To learn about some of those other cases,\nplease see [the reference] section on destructors.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\nThis destructor consists of two components:\n- A call to `Drop::drop` for that value, if this special `Drop` trait is implemented for its type.\n- The automatically generated \"drop glue\" which recursively calls the destructors\n of all the fields of this value.\n\nAs Rust automatically calls the destructors of all contained fields,\nyou don't have to implement `Drop` in most cases. But there are some cases where\nit is useful, for example for types which directly manage a resource.\nThat resource may be memory, it may be a file descriptor, it may be a network socket.\nOnce a value of that type is no longer going to be used, it should \"clean up\" its\nresource by freeing the memory or closing the file or socket. This is\nthe job of a destructor, and therefore the job of `Drop::drop`.\n\n## Examples\n\nTo see destructors in action, let's take a look at the following program:\n\n```rust\nstruct HasDrop;\n\nimpl Drop for HasDrop {\n fn drop(&mut self) {\n println!(\"Dropping HasDrop!\");\n }\n}\n\nstruct HasTwoDrops {\n one: HasDrop,\n two: HasDrop,\n}\n\nimpl Drop for HasTwoDrops {\n fn drop(&mut self) {\n println!(\"Dropping HasTwoDrops!\");\n }\n}\n\nfn main() {\n let _x = HasTwoDrops { one: HasDrop, two: HasDrop };\n println!(\"Running!\");\n}\n```\n\nRust will first call `Drop::drop` for `_x` and then for both `_x.one` and `_x.two`,\nmeaning that running this will print\n\n```text\nRunning!\nDropping HasTwoDrops!\nDropping HasDrop!\nDropping HasDrop!\n```\n\nEven if we remove the implementation of `Drop` for `HasTwoDrop`, the destructors of its fields are still called.\nThis would result in\n\n```test\nRunning!\nDropping HasDrop!\nDropping HasDrop!\n```\n\n## You cannot call `Drop::drop` yourself\n\nBecause `Drop::drop` is used to clean up a value, it may be dangerous to use this value after\nthe method has been called. As `Drop::drop` does not take ownership of its input,\nRust prevents misuse by not allowing you to call `Drop::drop` directly.\n\nIn other words, if you tried to explicitly call `Drop::drop` in the above example, you'd get a compiler error.\n\nIf you'd like to explicitly call the destructor of a value, [`mem::drop`] can be used instead.\n\n[`mem::drop`]: drop\n\n## Drop order\n\nWhich of our two `HasDrop` drops first, though? For structs, it's the same\norder that they're declared: first `one`, then `two`. If you'd like to try\nthis yourself, you can modify `HasDrop` above to contain some data, like an\ninteger, and then use it in the `println!` inside of `Drop`. This behavior is\nguaranteed by the language.\n\nUnlike for structs, local variables are dropped in reverse order:\n\n```rust\nstruct Foo;\n\nimpl Drop for Foo {\n fn drop(&mut self) {\n println!(\"Dropping Foo!\")\n }\n}\n\nstruct Bar;\n\nimpl Drop for Bar {\n fn drop(&mut self) {\n println!(\"Dropping Bar!\")\n }\n}\n\nfn main() {\n let _foo = Foo;\n let _bar = Bar;\n}\n```\n\nThis will print\n\n```text\nDropping Bar!\nDropping Foo!\n```\n\nPlease see [the reference] for the full rules.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\n## `Copy` and `Drop` are exclusive\n\nYou cannot implement both [`Copy`] and `Drop` on the same type. Types that\nare `Copy` get implicitly duplicated by the compiler, making it very\nhard to predict when, and how often destructors will be executed. As such,\nthese types cannot have destructors.\n\n## Drop check\n\nDropping interacts with the borrow checker in subtle ways: when a type `T` is being implicitly\ndropped as some variable of this type goes out of scope, the borrow checker needs to ensure that\ncalling `T`'s destructor at this moment is safe. In particular, it also needs to be safe to\nrecursively drop all the fields of `T`. For example, it is crucial that code like the following\nis being rejected:\n\n```rust\nuse std::cell::Cell;\n\nstruct S<'a>(Cell>>, Box);\nimpl Drop for S<'_> {\n fn drop(&mut self) {\n if let Some(r) = self.0.get() {\n // Print the contents of the `Box` in `r`.\n println!(\"{}\", r.1);\n }\n }\n}\n\nfn main() {\n // Set up two `S` that point to each other.\n let s1 = S(Cell::new(None), Box::new(42));\n let s2 = S(Cell::new(Some(&s1)), Box::new(42));\n s1.0.set(Some(&s2));\n // Now they both get dropped. But whichever is the 2nd one\n // to be dropped will access the `Box` in the first one,\n // which is a use-after-free!\n}\n```\n\nThe Nomicon discusses the need for [drop check in more detail][drop check].\n\nTo reject such code, the \"drop check\" analysis determines which types and lifetimes need to\nstill be live when `T` gets dropped. The exact details of this analysis are not yet\nstably guaranteed and **subject to change**. Currently, the analysis works as follows:\n- If `T` has no drop glue, then trivially nothing is required to be live. This is the case if\n neither `T` nor any of its (recursive) fields have a destructor (`impl Drop`). [`PhantomData`]\n and [`ManuallyDrop`] are considered to never have a destructor, no matter their field type.\n- If `T` has drop glue, then, for all types `U` that are *owned* by any field of `T`,\n recursively add the types and lifetimes that need to be live when `U` gets dropped. The set of\n owned types is determined by recursively traversing `T`:\n - Recursively descend through `PhantomData`, `Box`, tuples, and arrays (including arrays of\n length 0).\n - Stop at reference and raw pointer types as well as function pointers and function items;\n they do not own anything.\n - Stop at non-composite types (type parameters that remain generic in the current context and\n base types such as integers and `bool`); these types are owned.\n - When hitting an ADT with `impl Drop`, stop there; this type is owned.\n - When hitting an ADT without `impl Drop`, recursively descend to its fields. (For an `enum`,\n consider all fields of all variants.)\n- Furthermore, if `T` implements `Drop`, then all generic (lifetime and type) parameters of `T`\n must be live.\n\nIn the above example, the last clause implies that `'a` must be live when `S<'a>` is dropped,\nand hence the example is rejected. If we remove the `impl Drop`, the liveness requirement\ndisappears and the example is accepted.\n\nThere exists an unstable way for a type to opt-out of the last clause; this is called \"drop\ncheck eyepatch\" or `may_dangle`. For more details on this nightly-only feature, see the\n[discussion in the Nomicon][nomicon].\n\n[`ManuallyDrop`]: crate::mem::ManuallyDrop\n[`PhantomData`]: crate::marker::PhantomData\n[drop check]: ../../nomicon/dropck.html\n[nomicon]: ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standard-library-and-its-unstable-may_dangle"},"deprecated":false,"sortText":"ffffffef","filterText":"Drop","textEdit":{"newText":"Drop","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Eq (alias ==, !=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for comparisons corresponding to [equivalence relations](\nhttps://en.wikipedia.org/wiki/Equivalence_relation).\n\nThis means, that in addition to `a == b` and `a != b` being strict inverses,\nthe relation must be (for all `a`, `b` and `c`):\n\n- reflexive: `a == a`;\n- symmetric: `a == b` implies `b == a` (required by `PartialEq` as well); and\n- transitive: `a == b` and `b == c` implies `a == c` (required by `PartialEq` as well).\n\nThis property cannot be checked by the compiler, and therefore `Eq` implies\n[`PartialEq`], and has no extra methods.\n\nViolating this property is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\nImplement `Eq` in addition to `PartialEq` if it's guaranteed that\n`PartialEq::eq(a, a)` always returns `true` (reflexivity), in addition to\nthe symmetric and transitive properties already required by `PartialEq`.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d, because `Eq` has\nno extra methods, it is only informing the compiler that this is an\nequivalence relation rather than a partial equivalence relation. Note that\nthe `derive` strategy requires all fields are `Eq`, which isn't\nalways desired.\n\n## How can I implement `Eq`?\n\nIf you cannot use the `derive` strategy, specify that your type implements\n`Eq`, which has no methods:\n\n```rust\nenum BookFormat { Paperback, Hardback, Ebook }\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\nimpl Eq for Book {}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Eq","textEdit":{"newText":"Eq","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Err(…)","kind":20,"detail":"Err(E)","documentation":{"kind":"markdown","value":"Contains the error value"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Err()","insertTextFormat":2,"textEdit":{"newText":"Err(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"ExactSizeIterator","kind":8,"documentation":{"kind":"markdown","value":"An iterator that knows its exact length.\n\nMany [`Iterator`]s don't know how many times they will iterate, but some do.\nIf an iterator knows how many times it can iterate, providing access to\nthat information can be useful. For example, if you want to iterate\nbackwards, a good start is to know where the end is.\n\nWhen implementing an `ExactSizeIterator`, you must also implement\n[`Iterator`]. When doing so, the implementation of [`Iterator::size_hint`]\n*must* return the exact size of the iterator.\n\nThe [`len`] method has a default implementation, so you usually shouldn't\nimplement it. However, you may be able to provide a more performant\nimplementation than the default, so overriding it in this case makes sense.\n\nNote that this trait is a safe trait and as such does *not* and *cannot*\nguarantee that the returned length is correct. This means that `unsafe`\ncode **must not** rely on the correctness of [`Iterator::size_hint`]. The\nunstable and unsafe [`TrustedLen`](super::marker::TrustedLen) trait gives\nthis additional guarantee.\n\n[`len`]: ExactSizeIterator::len\n\n# When *shouldn't* an adapter be `ExactSizeIterator`?\n\nIf an adapter makes an iterator *longer*, then it's usually incorrect for\nthat adapter to implement `ExactSizeIterator`. The inner exact-sized\niterator might already be `usize::MAX`-long, and thus the length of the\nlonger adapted iterator would no longer be exactly representable in `usize`.\n\nThis is why [`Chain`](crate::iter::Chain) isn't `ExactSizeIterator`,\neven when `A` and `B` are both `ExactSizeIterator`.\n\n# Examples\n\nBasic usage:\n\n```rust\n// a finite range knows exactly how many times it will iterate\nlet five = 0..5;\n\nassert_eq!(5, five.len());\n```\n\nIn the [module-level docs], we implemented an [`Iterator`], `Counter`.\nLet's implement `ExactSizeIterator` for it as well:\n\n[module-level docs]: crate::iter\n\n```rust\nimpl ExactSizeIterator for Counter {\n // We can easily calculate the remaining number of iterations.\n fn len(&self) -> usize {\n 5 - self.count\n }\n}\n\n// And now we can use it!\n\nlet mut counter = Counter::new();\n\nassert_eq!(5, counter.len());\nlet _ = counter.next();\nassert_eq!(4, counter.len());\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"ExactSizeIterator","textEdit":{"newText":"ExactSizeIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Extend","kind":8,"documentation":{"kind":"markdown","value":"Extend a collection with the contents of an iterator.\n\nIterators produce a series of values, and collections can also be thought\nof as a series of values. The `Extend` trait bridges this gap, allowing you\nto extend a collection by including the contents of that iterator. When\nextending a collection with an already existing key, that entry is updated\nor, in the case of collections that permit multiple entries with equal\nkeys, that entry is inserted.\n\n# Examples\n\nBasic usage:\n\n```rust\n// You can extend a String with some chars:\nlet mut message = String::from(\"The first three letters are: \");\n\nmessage.extend(&['a', 'b', 'c']);\n\nassert_eq!(\"abc\", &message[29..32]);\n```\n\nImplementing `Extend`:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// since MyCollection has a list of i32s, we implement Extend for i32\nimpl Extend for MyCollection {\n\n // This is a bit simpler with the concrete type signature: we can call\n // extend on anything which can be turned into an Iterator which gives\n // us i32s. Because we need i32s to put into MyCollection.\n fn extend>(&mut self, iter: T) {\n\n // The implementation is very straightforward: loop through the\n // iterator, and add() each element to ourselves.\n for elem in iter {\n self.add(elem);\n }\n }\n}\n\nlet mut c = MyCollection::new();\n\nc.add(5);\nc.add(6);\nc.add(7);\n\n// let's extend our collection with three more numbers\nc.extend(vec![1, 2, 3]);\n\n// we've added these elements onto the end\nassert_eq!(\"MyCollection([5, 6, 7, 1, 2, 3])\", format!(\"{c:?}\"));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Extend","textEdit":{"newText":"Extend","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Fn","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes an immutable receiver.\n\nInstances of `Fn` can be called repeatedly without mutating state.\n\n*This trait (`Fn`) is not to be confused with [function pointers]\n(`fn`).*\n\n`Fn` is implemented automatically by closures which only take immutable\nreferences to captured variables or don't capture anything at all, as well\nas (safe) [function pointers] (with some caveats, see their documentation\nfor more details). Additionally, for any type `F` that implements `Fn`, `&F`\nimplements `Fn`, too.\n\nSince both [`FnMut`] and [`FnOnce`] are supertraits of `Fn`, any\ninstance of `Fn` can be used as a parameter where a [`FnMut`] or [`FnOnce`]\nis expected.\n\nUse `Fn` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly and without mutating state (e.g., when\ncalling it concurrently). If you do not need such strict requirements, use\n[`FnMut`] or [`FnOnce`] as bounds.\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a closure\n\n```rust\nlet square = |x| x * x;\nassert_eq!(square(5), 25);\n```\n\n## Using a `Fn` parameter\n\n```rust\nfn call_with_one(func: F) -> usize\n where F: Fn(usize) -> usize {\n func(1)\n}\n\nlet double = |x| x * 2;\nassert_eq!(call_with_one(double), 2);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Fn","textEdit":{"newText":"Fn","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"FnMut","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a mutable receiver.\n\nInstances of `FnMut` can be called repeatedly and may mutate state.\n\n`FnMut` is implemented automatically by closures which take mutable\nreferences to captured variables, as well as all types that implement\n[`Fn`], e.g., (safe) [function pointers] (since `FnMut` is a supertrait of\n[`Fn`]). Additionally, for any type `F` that implements `FnMut`, `&mut F`\nimplements `FnMut`, too.\n\nSince [`FnOnce`] is a supertrait of `FnMut`, any instance of `FnMut` can be\nused where a [`FnOnce`] is expected, and since [`Fn`] is a subtrait of\n`FnMut`, any instance of [`Fn`] can be used where `FnMut` is expected.\n\nUse `FnMut` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly, while allowing it to mutate state.\nIf you don't want the parameter to mutate state, use [`Fn`] as a\nbound; if you don't need to call it repeatedly, use [`FnOnce`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a mutably capturing closure\n\n```rust\nlet mut x = 5;\n{\n let mut square_x = || x *= x;\n square_x();\n}\nassert_eq!(x, 25);\n```\n\n## Using a `FnMut` parameter\n\n```rust\nfn do_twice(mut func: F)\n where F: FnMut()\n{\n func();\n func();\n}\n\nlet mut x: usize = 1;\n{\n let add_two_to_x = || x += 2;\n do_twice(add_two_to_x);\n}\n\nassert_eq!(x, 5);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FnMut","textEdit":{"newText":"FnMut","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"FnOnce","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a by-value receiver.\n\nInstances of `FnOnce` can be called, but might not be callable multiple\ntimes. Because of this, if the only thing known about a type is that it\nimplements `FnOnce`, it can only be called once.\n\n`FnOnce` is implemented automatically by closures that might consume captured\nvariables, as well as all types that implement [`FnMut`], e.g., (safe)\n[function pointers] (since `FnOnce` is a supertrait of [`FnMut`]).\n\nSince both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of\n[`Fn`] or [`FnMut`] can be used where a `FnOnce` is expected.\n\nUse `FnOnce` as a bound when you want to accept a parameter of function-like\ntype and only need to call it once. If you need to call the parameter\nrepeatedly, use [`FnMut`] as a bound; if you also need it to not mutate\nstate, use [`Fn`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Using a `FnOnce` parameter\n\n```rust\nfn consume_with_relish(func: F)\n where F: FnOnce() -> String\n{\n // `func` consumes its captured variables, so it cannot be run more\n // than once.\n println!(\"Consumed: {}\", func());\n\n println!(\"Delicious!\");\n\n // Attempting to invoke `func()` again will throw a `use of moved\n // value` error for `func`.\n}\n\nlet x = String::from(\"x\");\nlet consume_and_return_x = move || x;\nconsume_with_relish(consume_and_return_x);\n\n// `consume_and_return_x` can no longer be invoked at this point\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FnOnce","textEdit":{"newText":"FnOnce","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"From","kind":8,"documentation":{"kind":"markdown","value":"Used to do value-to-value conversions while consuming the input value. It is the reciprocal of\n[`Into`].\n\nOne should always prefer implementing `From` over [`Into`]\nbecause implementing `From` automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nOnly implement [`Into`] when targeting a version prior to Rust 1.41 and converting to a type\noutside the current crate.\n`From` was not able to do these types of conversions in earlier versions because of Rust's\norphaning rules.\nSee [`Into`] for more details.\n\nPrefer using [`Into`] over using `From` when specifying trait bounds on a generic function.\nThis way, types that directly implement [`Into`] can be used as arguments as well.\n\nThe `From` is also very useful when performing error handling. When constructing a function\nthat is capable of failing, the return type will generally be of the form `Result`.\nThe `From` trait simplifies error handling by allowing a function to return a single error type\nthat encapsulate multiple error types. See the \"Examples\" section and [the book][book] for more\ndetails.\n\n**Note: This trait must not fail**. The `From` trait is intended for perfect conversions.\nIf the conversion can fail or is not perfect, use [`TryFrom`].\n\n# Generic Implementations\n\n- `From for U` implies [`Into`]` for T`\n- `From` is reflexive, which means that `From for T` is implemented\n\n# When to implement `From`\n\nWhile there's no technical restrictions on which conversions can be done using\na `From` implementation, the general expectation is that the conversions\nshould typically be restricted as follows:\n\n* The conversion is *infallible*: if the conversion can fail, use [`TryFrom`]\n instead; don't provide a `From` impl that panics.\n\n* The conversion is *lossless*: semantically, it should not lose or discard\n information. For example, `i32: From` exists, where the original\n value can be recovered using `u16: TryFrom`. And `String: From<&str>`\n exists, where you can get something equivalent to the original value via\n `Deref`. But `From` cannot be used to convert from `u32` to `u16`, since\n that cannot succeed in a lossless way. (There's some wiggle room here for\n information not considered semantically relevant. For example,\n `Box<[T]>: From>` exists even though it might not preserve capacity,\n like how two vectors can be equal despite differing capacities.)\n\n* The conversion is *value-preserving*: the conceptual kind and meaning of\n the resulting value is the same, even though the Rust type and technical\n representation might be different. For example `-1_i8 as u8` is *lossless*,\n since `as` casting back can recover the original value, but that conversion\n is *not* available via `From` because `-1` and `255` are different conceptual\n values (despite being identical bit patterns technically). But\n `f32: From` *is* available because `1_i16` and `1.0_f32` are conceptually\n the same real number (despite having very different bit patterns technically).\n `String: From` is available because they're both *text*, but\n `String: From` is *not* available, since `1` (a number) and `\"1\"`\n (text) are too different. (Converting values to text is instead covered\n by the [`Display`](crate::fmt::Display) trait.)\n\n* The conversion is *obvious*: it's the only reasonable conversion between\n the two types. Otherwise it's better to have it be a named method or\n constructor, like how [`str::as_bytes`] is a method and how integers have\n methods like [`u32::from_ne_bytes`], [`u32::from_le_bytes`], and\n [`u32::from_be_bytes`], none of which are `From` implementations. Whereas\n there's only one reasonable way to wrap an [`Ipv6Addr`](crate::net::Ipv6Addr)\n into an [`IpAddr`](crate::net::IpAddr), thus `IpAddr: From` exists.\n\n# Examples\n\n[`String`] implements `From<&str>`:\n\nAn explicit conversion from a `&str` to a String is done as follows:\n\n```rust\nlet string = \"hello\".to_string();\nlet other_string = String::from(\"hello\");\n\nassert_eq!(string, other_string);\n```\n\nWhile performing error handling it is often useful to implement `From` for your own error type.\nBy converting underlying error types to our own custom error type that encapsulates the\nunderlying error type, we can return a single error type without losing information on the\nunderlying cause. The '?' operator automatically converts the underlying error type to our\ncustom error type with `From::from`.\n\n```rust\nuse std::fs;\nuse std::io;\nuse std::num;\n\nenum CliError {\n IoError(io::Error),\n ParseError(num::ParseIntError),\n}\n\nimpl From for CliError {\n fn from(error: io::Error) -> Self {\n CliError::IoError(error)\n }\n}\n\nimpl From for CliError {\n fn from(error: num::ParseIntError) -> Self {\n CliError::ParseError(error)\n }\n}\n\nfn open_and_parse_file(file_name: &str) -> Result {\n let mut contents = fs::read_to_string(&file_name)?;\n let num: i32 = contents.trim().parse()?;\n Ok(num)\n}\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`from`]: From::from\n[book]: ../../book/ch09-00-error-handling.html"},"deprecated":false,"sortText":"ffffffef","filterText":"From","textEdit":{"newText":"From","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"FromIterator","kind":8,"documentation":{"kind":"markdown","value":"Conversion from an [`Iterator`].\n\nBy implementing `FromIterator` for a type, you define how it will be\ncreated from an iterator. This is common for types which describe a\ncollection of some kind.\n\nIf you want to create a collection from the contents of an iterator, the\n[`Iterator::collect()`] method is preferred. However, when you need to\nspecify the container type, [`FromIterator::from_iter()`] can be more\nreadable than using a turbofish (e.g. `::>()`). See the\n[`Iterator::collect()`] documentation for more examples of its use.\n\nSee also: [`IntoIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v = Vec::from_iter(five_fives);\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`Iterator::collect()`] to implicitly use `FromIterator`:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v: Vec = five_fives.collect();\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`FromIterator::from_iter()`] as a more readable alternative to\n[`Iterator::collect()`]:\n\n```rust\nuse std::collections::VecDeque;\nlet first = (0..10).collect::>();\nlet second = VecDeque::from_iter(0..10);\n\nassert_eq!(first, second);\n```\n\nImplementing `FromIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement FromIterator\nimpl FromIterator for MyCollection {\n fn from_iter>(iter: I) -> Self {\n let mut c = MyCollection::new();\n\n for i in iter {\n c.add(i);\n }\n\n c\n }\n}\n\n// Now we can make a new iterator...\nlet iter = (0..5).into_iter();\n\n// ... and make a MyCollection out of it\nlet c = MyCollection::from_iter(iter);\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n\n// collect works too!\n\nlet iter = (0..5).into_iter();\nlet c: MyCollection = iter.collect();\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FromIterator","textEdit":{"newText":"FromIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Into","kind":8,"documentation":{"kind":"markdown","value":"A value-to-value conversion that consumes the input value. The\nopposite of [`From`].\n\nOne should avoid implementing [`Into`] and implement [`From`] instead.\nImplementing [`From`] automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nPrefer using [`Into`] over [`From`] when specifying trait bounds on a generic function\nto ensure that types that only implement [`Into`] can be used as well.\n\n**Note: This trait must not fail**. If the conversion can fail, use [`TryInto`].\n\n# Generic Implementations\n\n- [`From`]` for U` implies `Into for T`\n- [`Into`] is reflexive, which means that `Into for T` is implemented\n\n# Implementing [`Into`] for conversions to external types in old versions of Rust\n\nPrior to Rust 1.41, if the destination type was not part of the current crate\nthen you couldn't implement [`From`] directly.\nFor example, take this code:\n\n```rust\nstruct Wrapper(Vec);\nimpl From> for Vec {\n fn from(w: Wrapper) -> Vec {\n w.0\n }\n}\n```\nThis will fail to compile in older versions of the language because Rust's orphaning rules\nused to be a little bit more strict. To bypass this, you could implement [`Into`] directly:\n\n```rust\nstruct Wrapper(Vec);\nimpl Into> for Wrapper {\n fn into(self) -> Vec {\n self.0\n }\n}\n```\n\nIt is important to understand that [`Into`] does not provide a [`From`] implementation\n(as [`From`] does with [`Into`]). Therefore, you should always try to implement [`From`]\nand then fall back to [`Into`] if [`From`] can't be implemented.\n\n# Examples\n\n[`String`] implements [`Into`]`<`[`Vec`]`<`[`u8`]`>>`:\n\nIn order to express that we want a generic function to take all arguments that can be\nconverted to a specified type `T`, we can use a trait bound of [`Into`]``.\nFor example: The function `is_hello` takes all arguments that can be converted into a\n[`Vec`]`<`[`u8`]`>`.\n\n```rust\nfn is_hello>>(s: T) {\n let bytes = b\"hello\".to_vec();\n assert_eq!(bytes, s.into());\n}\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`Vec`]: ../../std/vec/struct.Vec.html"},"deprecated":false,"sortText":"ffffffef","filterText":"Into","textEdit":{"newText":"Into","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"IntoIterator","kind":8,"documentation":{"kind":"markdown","value":"Conversion into an [`Iterator`].\n\nBy implementing `IntoIterator` for a type, you define how it will be\nconverted to an iterator. This is common for types which describe a\ncollection of some kind.\n\nOne benefit of implementing `IntoIterator` is that your type will [work\nwith Rust's `for` loop syntax](crate::iter#for-loops-and-intoiterator).\n\nSee also: [`FromIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = [1, 2, 3];\nlet mut iter = v.into_iter();\n\nassert_eq!(Some(1), iter.next());\nassert_eq!(Some(2), iter.next());\nassert_eq!(Some(3), iter.next());\nassert_eq!(None, iter.next());\n```\nImplementing `IntoIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement IntoIterator\nimpl IntoIterator for MyCollection {\n type Item = i32;\n type IntoIter = std::vec::IntoIter;\n\n fn into_iter(self) -> Self::IntoIter {\n self.0.into_iter()\n }\n}\n\n// Now we can make a new collection...\nlet mut c = MyCollection::new();\n\n// ... add some stuff to it ...\nc.add(0);\nc.add(1);\nc.add(2);\n\n// ... and then turn it into an Iterator:\nfor (i, n) in c.into_iter().enumerate() {\n assert_eq!(i as i32, n);\n}\n```\n\nIt is common to use `IntoIterator` as a trait bound. This allows\nthe input collection type to change, so long as it is still an\niterator. Additional bounds can be specified by restricting on\n`Item`:\n\n```rust\nfn collect_as_strings(collection: T) -> Vec\nwhere\n T: IntoIterator,\n T::Item: std::fmt::Debug,\n{\n collection\n .into_iter()\n .map(|item| format!(\"{item:?}\"))\n .collect()\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"IntoIterator","textEdit":{"newText":"IntoIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Iterator","kind":8,"documentation":{"kind":"markdown","value":"A trait for dealing with iterators.\n\nThis is the main iterator trait. For more about the concept of iterators\ngenerally, please see the [module-level documentation]. In particular, you\nmay want to know how to [implement `Iterator`][impl].\n\n[module-level documentation]: crate::iter\n[impl]: crate::iter#implementing-iterator"},"deprecated":false,"sortText":"ffffffef","filterText":"Iterator","textEdit":{"newText":"Iterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"None","kind":20,"detail":"None","documentation":{"kind":"markdown","value":"No value."},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"None","insertTextFormat":2,"textEdit":{"newText":"None$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"Ok(…)","kind":20,"detail":"Ok(T)","documentation":{"kind":"markdown","value":"Contains the success value"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Ok()","insertTextFormat":2,"textEdit":{"newText":"Ok(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"Option","kind":13,"documentation":{"kind":"markdown","value":"The `Option` type. See [the module level documentation](self) for more."},"deprecated":false,"sortText":"ffffffef","filterText":"Option","textEdit":{"newText":"Option","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Ord (alias <, >, <=, >=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for types that form a [total order](https://en.wikipedia.org/wiki/Total_order).\n\nImplementations must be consistent with the [`PartialOrd`] implementation, and ensure\n`max`, `min`, and `clamp` are consistent with `cmp`:\n\n- `partial_cmp(a, b) == Some(cmp(a, b))`.\n- `max(a, b) == max_by(a, b, cmp)` (ensured by the default implementation).\n- `min(a, b) == min_by(a, b, cmp)` (ensured by the default implementation).\n- For `a.clamp(min, max)`, see the [method docs](#method.clamp)\n (ensured by the default implementation).\n\nIt's easy to accidentally make `cmp` and `partial_cmp` disagree by\nderiving some of the traits and manually implementing others.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nFrom the above and the requirements of `PartialOrd`, it follows that for\nall `a`, `b` and `c`:\n\n- exactly one of `a < b`, `a == b` or `a > b` is true; and\n- `<` is transitive: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n\nMathematically speaking, the `<` operator defines a strict [weak order]. In\ncases where `==` conforms to mathematical equality, it also defines a\nstrict [total order].\n\n[weak order]: https://en.wikipedia.org/wiki/Weak_ordering\n[total order]: https://en.wikipedia.org/wiki/Total_order\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## Lexicographical comparison\n\nLexicographical comparison is an operation with the following properties:\n - Two sequences are compared element by element.\n - The first mismatching element defines which sequence is lexicographically less or greater than the other.\n - If one sequence is a prefix of another, the shorter sequence is lexicographically less than the other.\n - If two sequences have equivalent elements and are of the same length, then the sequences are lexicographically equal.\n - An empty sequence is lexicographically less than any non-empty sequence.\n - Two empty sequences are lexicographically equal.\n\n## How can I implement `Ord`?\n\n`Ord` requires that the type also be [`PartialOrd`] and [`Eq`] (which requires [`PartialEq`]).\n\nThen you must define an implementation for [`cmp`]. You may find it useful to use\n[`cmp`] on your type's fields.\n\nHere's an example where you want to sort people by height only, disregarding `id`\nand `name`:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n[`cmp`]: Ord::cmp"},"deprecated":false,"sortText":"ffffffef","filterText":"Ord","textEdit":{"newText":"Ord","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"PartialEq (alias ==, !=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for comparisons using the equality operator.\n\nImplementing this trait for types provides the `==` and `!=` operators for\nthose types.\n\n`x.eq(y)` can also be written `x == y`, and `x.ne(y)` can be written `x != y`.\nWe use the easier-to-read infix notation in the remainder of this documentation.\n\nThis trait allows for comparisons using the equality operator, for types\nthat do not have a full equivalence relation. For example, in floating point\nnumbers `NaN != NaN`, so floating point types implement `PartialEq` but not\n[`trait@Eq`]. Formally speaking, when `Rhs == Self`, this trait corresponds\nto a [partial equivalence relation].\n\n[partial equivalence relation]: https://en.wikipedia.org/wiki/Partial_equivalence_relation\n\nImplementations must ensure that `eq` and `ne` are consistent with each other:\n\n- `a != b` if and only if `!(a == b)`.\n\nThe default implementation of `ne` provides this consistency and is almost\nalways sufficient. It should not be overridden without very good reason.\n\nIf [`PartialOrd`] or [`Ord`] are also implemented for `Self` and `Rhs`, their methods must also\nbe consistent with `PartialEq` (see the documentation of those traits for the exact\nrequirements). It's easy to accidentally make them disagree by deriving some of the traits and\nmanually implementing others.\n\nThe equality relation `==` must satisfy the following conditions\n(for all `a`, `b`, `c` of type `A`, `B`, `C`):\n\n- **Symmetric**: if `A: PartialEq` and `B: PartialEq`, then **`a == b`\n implies `b == a`**; and\n\n- **Transitive**: if `A: PartialEq` and `B: PartialEq` and `A:\n PartialEq`, then **`a == b` and `b == c` implies `a == c`**.\n\nNote that the `B: PartialEq` (symmetric) and `A: PartialEq`\n(transitive) impls are not forced to exist, but these requirements apply\nwhenever they do exist.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d on structs, two\ninstances are equal if all fields are equal, and not equal if any fields\nare not equal. When `derive`d on enums, two instances are equal if they\nare the same variant and all fields are equal.\n\n## How can I implement `PartialEq`?\n\nAn example implementation for a domain in which two books are considered\nthe same book if their ISBN matches, even if the formats differ:\n\n```rust\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\nlet b2 = Book { isbn: 3, format: BookFormat::Ebook };\nlet b3 = Book { isbn: 10, format: BookFormat::Paperback };\n\nassert!(b1 == b2);\nassert!(b1 != b3);\n```\n\n## How can I compare two different types?\n\nThe type you can compare with is controlled by `PartialEq`'s type parameter.\nFor example, let's tweak our previous code a bit:\n\n```rust\n// The derive implements == comparisons\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\n// Implement == comparisons\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\n// Implement == comparisons\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\n\nassert!(b1 == BookFormat::Paperback);\nassert!(BookFormat::Ebook != b1);\n```\n\nBy changing `impl PartialEq for Book` to `impl PartialEq for Book`,\nwe allow `BookFormat`s to be compared with `Book`s.\n\nA comparison like the one above, which ignores some fields of the struct,\ncan be dangerous. It can easily lead to an unintended violation of the\nrequirements for a partial equivalence relation. For example, if we kept\nthe above implementation of `PartialEq` for `BookFormat` and added an\nimplementation of `PartialEq` for `Book` (either via a `#[derive]` or\nvia the manual implementation from the first example) then the result would\nviolate transitivity:\n\n```rust\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\n#[derive(PartialEq)]\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nfn main() {\n let b1 = Book { isbn: 1, format: BookFormat::Paperback };\n let b2 = Book { isbn: 2, format: BookFormat::Paperback };\n\n assert!(b1 == BookFormat::Paperback);\n assert!(BookFormat::Paperback == b2);\n\n // The following should hold by transitivity but doesn't.\n assert!(b1 == b2); // <-- PANICS\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x == y, false);\nassert_eq!(x.eq(&y), false);\n```\n\n[`eq`]: PartialEq::eq\n[`ne`]: PartialEq::ne"},"deprecated":false,"sortText":"ffffffef","filterText":"PartialEq","textEdit":{"newText":"PartialEq","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"PartialOrd (alias >, <, <=, >=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for types that form a [partial order](https://en.wikipedia.org/wiki/Partial_order).\n\nThe `lt`, `le`, `gt`, and `ge` methods of this trait can be called using\nthe `<`, `<=`, `>`, and `>=` operators, respectively.\n\nThe methods of this trait must be consistent with each other and with those of [`PartialEq`].\nThe following conditions must hold:\n\n1. `a == b` if and only if `partial_cmp(a, b) == Some(Equal)`.\n2. `a < b` if and only if `partial_cmp(a, b) == Some(Less)`\n3. `a > b` if and only if `partial_cmp(a, b) == Some(Greater)`\n4. `a <= b` if and only if `a < b || a == b`\n5. `a >= b` if and only if `a > b || a == b`\n6. `a != b` if and only if `!(a == b)`.\n\nConditions 2–5 above are ensured by the default implementation.\nCondition 6 is already ensured by [`PartialEq`].\n\nIf [`Ord`] is also implemented for `Self` and `Rhs`, it must also be consistent with\n`partial_cmp` (see the documentation of that trait for the exact requirements). It's\neasy to accidentally make them disagree by deriving some of the traits and manually\nimplementing others.\n\nThe comparison must satisfy, for all `a`, `b` and `c`:\n\n- transitivity: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n- duality: `a < b` if and only if `b > a`.\n\nNote that these requirements mean that the trait itself must be implemented symmetrically and\ntransitively: if `T: PartialOrd` and `U: PartialOrd` then `U: PartialOrd` and `T:\nPartialOrd`.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nThe following corollaries follow from the above requirements:\n\n- irreflexivity of `<` and `>`: `!(a < a)`, `!(a > a)`\n- transitivity of `>`: if `a > b` and `b > c` then `a > c`\n- duality of `partial_cmp`: `partial_cmp(a, b) == partial_cmp(b, a).map(Ordering::reverse)`\n\n## Strict and non-strict partial orders\n\nThe `<` and `>` operators behave according to a *strict* partial order.\nHowever, `<=` and `>=` do **not** behave according to a *non-strict*\npartial order.\nThat is because mathematically, a non-strict partial order would require\nreflexivity, i.e. `a <= a` would need to be true for every `a`. This isn't\nalways the case for types that implement `PartialOrd`, for example:\n\n```rust\nlet a = f64::sqrt(-1.0);\nassert_eq!(a <= a, false);\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## How can I implement `PartialOrd`?\n\n`PartialOrd` only requires implementation of the [`partial_cmp`] method, with the others\ngenerated from default implementations.\n\nHowever it remains possible to implement the others separately for types which do not have a\ntotal order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==\nfalse` (cf. IEEE 754-2008 section 5.11).\n\n`PartialOrd` requires your type to be [`PartialEq`].\n\nIf your type is [`Ord`], you can implement [`partial_cmp`] by using [`cmp`]:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\nYou may also find it useful to use [`partial_cmp`] on your type's fields. Here\nis an example of `Person` types who have a floating-point `height` field that\nis the only field to be used for sorting:\n\n```rust\nuse std::cmp::Ordering;\n\nstruct Person {\n id: u32,\n name: String,\n height: f64,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n self.height.partial_cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x < y, true);\nassert_eq!(x.lt(&y), true);\n```\n\n[`partial_cmp`]: PartialOrd::partial_cmp\n[`cmp`]: Ord::cmp"},"deprecated":false,"sortText":"ffffffef","filterText":"PartialOrd","textEdit":{"newText":"PartialOrd","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Result","kind":13,"documentation":{"kind":"markdown","value":"`Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).\n\nSee the [module documentation](self) for details."},"deprecated":false,"sortText":"ffffffef","filterText":"Result","textEdit":{"newText":"Result","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"RustcDecodable","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"RustcDecodable","textEdit":{"newText":"RustcDecodable","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"RustcEncodable","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"RustcEncodable","textEdit":{"newText":"RustcEncodable","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Some(…)","kind":20,"detail":"Some(T)","documentation":{"kind":"markdown","value":"Some value of type `T`."},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Some()","insertTextFormat":2,"textEdit":{"newText":"Some(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"String","kind":22,"documentation":{"kind":"markdown","value":"A UTF-8–encoded, growable string.\n\nThe `String` type is the most common string type that has ownership over the\ncontents of the string. It has a close relationship with its borrowed\ncounterpart, the primitive [`str`].\n\n# Examples\n\nYou can create a `String` from [a literal string][`&str`] with [`String::from`]:\n\n[`String::from`]: From::from\n\n```rust\nlet hello = String::from(\"Hello, world!\");\n```\n\nYou can append a [`char`] to a `String` with the [`push`] method, and\nappend a [`&str`] with the [`push_str`] method:\n\n```rust\nlet mut hello = String::from(\"Hello, \");\n\nhello.push('w');\nhello.push_str(\"orld!\");\n```\n\n[`push`]: String::push\n[`push_str`]: String::push_str\n\nIf you have a vector of UTF-8 bytes, you can create a `String` from it with\nthe [`from_utf8`] method:\n\n```rust\n// some bytes, in a vector\nlet sparkle_heart = vec![240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `unwrap()`.\nlet sparkle_heart = String::from_utf8(sparkle_heart).unwrap();\n\nassert_eq!(\"💖\", sparkle_heart);\n```\n\n[`from_utf8`]: String::from_utf8\n\n# UTF-8\n\n`String`s are always valid UTF-8. If you need a non-UTF-8 string, consider\n[`OsString`]. It is similar, but without the UTF-8 constraint. Because UTF-8\nis a variable width encoding, `String`s are typically smaller than an array of\nthe same `chars`:\n\n```rust\nuse std::mem;\n\n// `s` is ASCII which represents each `char` as one byte\nlet s = \"hello\";\nassert_eq!(s.len(), 5);\n\n// A `char` array with the same contents would be longer because\n// every `char` is four bytes\nlet s = ['h', 'e', 'l', 'l', 'o'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n\n// However, for non-ASCII strings, the difference will be smaller\n// and sometimes they are the same\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.len(), 20);\n\nlet s = ['💖', '💖', '💖', '💖', '💖'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n```\n\nThis raises interesting questions as to how `s[i]` should work.\nWhat should `i` be here? Several options include byte indices and\n`char` indices but, because of UTF-8 encoding, only byte indices\nwould provide constant time indexing. Getting the `i`th `char`, for\nexample, is available using [`chars`]:\n\n```rust\nlet s = \"hello\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('l'));\n\nlet s = \"💖💖💖💖💖\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('💖'));\n```\n\nNext, what should `s[i]` return? Because indexing returns a reference\nto underlying data it could be `&u8`, `&[u8]`, or something else similar.\nSince we're only providing one index, `&u8` makes the most sense but that\nmight not be what the user expects and can be explicitly achieved with\n[`as_bytes()`]:\n\n```rust\n// The first byte is 104 - the byte value of `'h'`\nlet s = \"hello\";\nassert_eq!(s.as_bytes()[0], 104);\n// or\nassert_eq!(s.as_bytes()[0], b'h');\n\n// The first byte is 240 which isn't obviously useful\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.as_bytes()[0], 240);\n```\n\nDue to these ambiguities/restrictions, indexing with a `usize` is simply\nforbidden:\n\n```rust\nlet s = \"hello\";\n\n// The following will not compile!\nprintln!(\"The first letter of s is {}\", s[0]);\n```\n\nIt is more clear, however, how `&s[i..j]` should work (that is,\nindexing with a range). It should accept byte indices (to be constant-time)\nand return a `&str` which is UTF-8 encoded. This is also called \"string slicing\".\nNote this will panic if the byte indices provided are not character\nboundaries - see [`is_char_boundary`] for more details. See the implementations\nfor [`SliceIndex`] for more details on string slicing. For a non-panicking\nversion of string slicing, see [`get`].\n\n[`OsString`]: ../../std/ffi/struct.OsString.html \"ffi::OsString\"\n[`SliceIndex`]: core::slice::SliceIndex\n[`as_bytes()`]: str::as_bytes\n[`get`]: str::get\n[`is_char_boundary`]: str::is_char_boundary\n\nThe [`bytes`] and [`chars`] methods return iterators over the bytes and\ncodepoints of the string, respectively. To iterate over codepoints along\nwith byte indices, use [`char_indices`].\n\n[`bytes`]: str::bytes\n[`chars`]: str::chars\n[`char_indices`]: str::char_indices\n\n# Deref\n\n`String` implements [Deref], and so inherits all of [`str`]'s\nmethods. In addition, this means that you can pass a `String` to a\nfunction which takes a [`&str`] by using an ampersand (`&`):\n\n```rust\nfn takes_str(s: &str) { }\n\nlet s = String::from(\"Hello\");\n\ntakes_str(&s);\n```\n\nThis will create a [`&str`] from the `String` and pass it in. This\nconversion is very inexpensive, and so generally, functions will accept\n[`&str`]s as arguments unless they need a `String` for some specific\nreason.\n\nIn certain cases Rust doesn't have enough information to make this\nconversion, known as [`Deref`] coercion. In the following example a string\nslice [`&'a str`][`&str`] implements the trait `TraitExample`, and the function\n`example_func` takes anything that implements the trait. In this case Rust\nwould need to make two implicit conversions, which Rust doesn't have the\nmeans to do. For that reason, the following example will not compile.\n\n```rust\ntrait TraitExample {}\n\nimpl<'a> TraitExample for &'a str {}\n\nfn example_func(example_arg: A) {}\n\nlet example_string = String::from(\"example_string\");\nexample_func(&example_string);\n```\n\nThere are two options that would work instead. The first would be to\nchange the line `example_func(&example_string);` to\n`example_func(example_string.as_str());`, using the method [`as_str()`]\nto explicitly extract the string slice containing the string. The second\nway changes `example_func(&example_string);` to\n`example_func(&*example_string);`. In this case we are dereferencing a\n`String` to a [`str`], then referencing the [`str`] back to\n[`&str`]. The second way is more idiomatic, however both work to do the\nconversion explicitly rather than relying on the implicit conversion.\n\n# Representation\n\nA `String` is made up of three components: a pointer to some bytes, a\nlength, and a capacity. The pointer points to an internal buffer `String`\nuses to store its data. The length is the number of bytes currently stored\nin the buffer, and the capacity is the size of the buffer in bytes. As such,\nthe length will always be less than or equal to the capacity.\n\nThis buffer is always stored on the heap.\n\nYou can look at these with the [`as_ptr`], [`len`], and [`capacity`]\nmethods:\n\n```rust\nuse std::mem;\n\nlet story = String::from(\"Once upon a time...\");\n\n// Prevent automatically dropping the String's data\nlet mut story = mem::ManuallyDrop::new(story);\n\nlet ptr = story.as_mut_ptr();\nlet len = story.len();\nlet capacity = story.capacity();\n\n// story has nineteen bytes\nassert_eq!(19, len);\n\n// We can re-build a String out of ptr, len, and capacity. This is all\n// unsafe because we are responsible for making sure the components are\n// valid:\nlet s = unsafe { String::from_raw_parts(ptr, len, capacity) } ;\n\nassert_eq!(String::from(\"Once upon a time...\"), s);\n```\n\n[`as_ptr`]: str::as_ptr\n[`len`]: String::len\n[`capacity`]: String::capacity\n\nIf a `String` has enough capacity, adding elements to it will not\nre-allocate. For example, consider this program:\n\n```rust\nlet mut s = String::new();\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\nThis will output the following:\n\n```text\n0\n8\n16\n16\n32\n32\n```\n\nAt first, we have no memory allocated at all, but as we append to the\nstring, it increases its capacity appropriately. If we instead use the\n[`with_capacity`] method to allocate the correct capacity initially:\n\n```rust\nlet mut s = String::with_capacity(25);\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\n[`with_capacity`]: String::with_capacity\n\nWe end up with a different output:\n\n```text\n25\n25\n25\n25\n25\n25\n```\n\nHere, there's no need to allocate more memory inside the loop.\n\n[str]: prim@str \"str\"\n[`str`]: prim@str \"str\"\n[`&str`]: prim@str \"&str\"\n[Deref]: core::ops::Deref \"ops::Deref\"\n[`Deref`]: core::ops::Deref \"ops::Deref\"\n[`as_str()`]: String::as_str"},"deprecated":false,"sortText":"ffffffef","filterText":"String","textEdit":{"newText":"String","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"ToOwned","kind":8,"documentation":{"kind":"markdown","value":"A generalization of `Clone` to borrowed data.\n\nSome types make it possible to go from borrowed to owned, usually by\nimplementing the `Clone` trait. But `Clone` works only for going from `&T`\nto `T`. The `ToOwned` trait generalizes `Clone` to construct owned data\nfrom any borrow of a given type."},"deprecated":false,"sortText":"ffffffef","filterText":"ToOwned","textEdit":{"newText":"ToOwned","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"ToString","kind":8,"documentation":{"kind":"markdown","value":"A trait for converting a value to a `String`.\n\nThis trait is automatically implemented for any type which implements the\n[`Display`] trait. As such, `ToString` shouldn't be implemented directly:\n[`Display`] should be implemented instead, and you get the `ToString`\nimplementation for free.\n\n[`Display`]: fmt::Display"},"deprecated":false,"sortText":"ffffffef","filterText":"ToString","textEdit":{"newText":"ToString","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"TryFrom","kind":8,"documentation":{"kind":"markdown","value":"Simple and safe type conversions that may fail in a controlled\nway under some circumstances. It is the reciprocal of [`TryInto`].\n\nThis is useful when you are doing a type conversion that may\ntrivially succeed but may also need special handling.\nFor example, there is no way to convert an [`i64`] into an [`i32`]\nusing the [`From`] trait, because an [`i64`] may contain a value\nthat an [`i32`] cannot represent and so the conversion would lose data.\nThis might be handled by truncating the [`i64`] to an [`i32`] or by\nsimply returning [`i32::MAX`], or by some other method. The [`From`]\ntrait is intended for perfect conversions, so the `TryFrom` trait\ninforms the programmer when a type conversion could go bad and lets\nthem decide how to handle it.\n\n# Generic Implementations\n\n- `TryFrom for U` implies [`TryInto`]` for T`\n- [`try_from`] is reflexive, which means that `TryFrom for T`\nis implemented and cannot fail -- the associated `Error` type for\ncalling `T::try_from()` on a value of type `T` is [`Infallible`].\nWhen the [`!`] type is stabilized [`Infallible`] and [`!`] will be\nequivalent.\n\n`TryFrom` can be implemented as follows:\n\n```rust\nstruct GreaterThanZero(i32);\n\nimpl TryFrom for GreaterThanZero {\n type Error = &'static str;\n\n fn try_from(value: i32) -> Result {\n if value <= 0 {\n Err(\"GreaterThanZero only accepts values greater than zero!\")\n } else {\n Ok(GreaterThanZero(value))\n }\n }\n}\n```\n\n# Examples\n\nAs described, [`i32`] implements `TryFrom<`[`i64`]`>`:\n\n```rust\nlet big_number = 1_000_000_000_000i64;\n// Silently truncates `big_number`, requires detecting\n// and handling the truncation after the fact.\nlet smaller_number = big_number as i32;\nassert_eq!(smaller_number, -727379968);\n\n// Returns an error because `big_number` is too big to\n// fit in an `i32`.\nlet try_smaller_number = i32::try_from(big_number);\nassert!(try_smaller_number.is_err());\n\n// Returns `Ok(3)`.\nlet try_successful_smaller_number = i32::try_from(3);\nassert!(try_successful_smaller_number.is_ok());\n```\n\n[`try_from`]: TryFrom::try_from"},"deprecated":false,"sortText":"ffffffef","filterText":"TryFrom","textEdit":{"newText":"TryFrom","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"TryInto","kind":8,"documentation":{"kind":"markdown","value":"An attempted conversion that consumes `self`, which may or may not be\nexpensive.\n\nLibrary authors should usually not directly implement this trait,\nbut should prefer implementing the [`TryFrom`] trait, which offers\ngreater flexibility and provides an equivalent `TryInto`\nimplementation for free, thanks to a blanket implementation in the\nstandard library. For more information on this, see the\ndocumentation for [`Into`].\n\n# Implementing `TryInto`\n\nThis suffers the same restrictions and reasoning as implementing\n[`Into`], see there for details."},"deprecated":false,"sortText":"ffffffef","filterText":"TryInto","textEdit":{"newText":"TryInto","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"Vec","kind":22,"documentation":{"kind":"markdown","value":"A contiguous growable array type, written as `Vec`, short for 'vector'.\n\n# Examples\n\n```rust\nlet mut vec = Vec::new();\nvec.push(1);\nvec.push(2);\n\nassert_eq!(vec.len(), 2);\nassert_eq!(vec[0], 1);\n\nassert_eq!(vec.pop(), Some(2));\nassert_eq!(vec.len(), 1);\n\nvec[0] = 7;\nassert_eq!(vec[0], 7);\n\nvec.extend([1, 2, 3]);\n\nfor x in &vec {\n println!(\"{x}\");\n}\nassert_eq!(vec, [7, 1, 2, 3]);\n```\n\nThe [`vec!`] macro is provided for convenient initialization:\n\n```rust\nlet mut vec1 = vec![1, 2, 3];\nvec1.push(4);\nlet vec2 = Vec::from([1, 2, 3, 4]);\nassert_eq!(vec1, vec2);\n```\n\nIt can also initialize each element of a `Vec` with a given value.\nThis may be more efficient than performing allocation and initialization\nin separate steps, especially when initializing a vector of zeros:\n\n```rust\nlet vec = vec![0; 5];\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n\n// The following is equivalent, but potentially slower:\nlet mut vec = Vec::with_capacity(5);\nvec.resize(5, 0);\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n```\n\nFor more information, see\n[Capacity and Reallocation](#capacity-and-reallocation).\n\nUse a `Vec` as an efficient stack:\n\n```rust\nlet mut stack = Vec::new();\n\nstack.push(1);\nstack.push(2);\nstack.push(3);\n\nwhile let Some(top) = stack.pop() {\n // Prints 3, 2, 1\n println!(\"{top}\");\n}\n```\n\n# Indexing\n\nThe `Vec` type allows access to values by index, because it implements the\n[`Index`] trait. An example will be more explicit:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[1]); // it will display '2'\n```\n\nHowever be careful: if you try to access an index which isn't in the `Vec`,\nyour software will panic! You cannot do this:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[6]); // it will panic!\n```\n\nUse [`get`] and [`get_mut`] if you want to check whether the index is in\nthe `Vec`.\n\n# Slicing\n\nA `Vec` can be mutable. On the other hand, slices are read-only objects.\nTo get a [slice][prim@slice], use [`&`]. Example:\n\n```rust\nfn read_slice(slice: &[usize]) {\n // ...\n}\n\nlet v = vec![0, 1];\nread_slice(&v);\n\n// ... and that's all!\n// you can also do it like this:\nlet u: &[usize] = &v;\n// or like this:\nlet u: &[_] = &v;\n```\n\nIn Rust, it's more common to pass slices as arguments rather than vectors\nwhen you just want to provide read access. The same goes for [`String`] and\n[`&str`].\n\n# Capacity and reallocation\n\nThe capacity of a vector is the amount of space allocated for any future\nelements that will be added onto the vector. This is not to be confused with\nthe *length* of a vector, which specifies the number of actual elements\nwithin the vector. If a vector's length exceeds its capacity, its capacity\nwill automatically be increased, but its elements will have to be\nreallocated.\n\nFor example, a vector with capacity 10 and length 0 would be an empty vector\nwith space for 10 more elements. Pushing 10 or fewer elements onto the\nvector will not change its capacity or cause reallocation to occur. However,\nif the vector's length is increased to 11, it will have to reallocate, which\ncan be slow. For this reason, it is recommended to use [`Vec::with_capacity`]\nwhenever possible to specify how big the vector is expected to get.\n\n# Guarantees\n\nDue to its incredibly fundamental nature, `Vec` makes a lot of guarantees\nabout its design. This ensures that it's as low-overhead as possible in\nthe general case, and can be correctly manipulated in primitive ways\nby unsafe code. Note that these guarantees refer to an unqualified `Vec`.\nIf additional type parameters are added (e.g., to support custom allocators),\noverriding their defaults may change the behavior.\n\nMost fundamentally, `Vec` is and always will be a (pointer, capacity, length)\ntriplet. No more, no less. The order of these fields is completely\nunspecified, and you should use the appropriate methods to modify these.\nThe pointer will never be null, so this type is null-pointer-optimized.\n\nHowever, the pointer might not actually point to allocated memory. In particular,\nif you construct a `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],\n[`Vec::with_capacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]\non an empty Vec, it will not allocate memory. Similarly, if you store zero-sized\ntypes inside a `Vec`, it will not allocate space for them. *Note that in this case\nthe `Vec` might not report a [`capacity`] of 0*. `Vec` will allocate if and only\nif [mem::size_of::\\]\\() * [capacity]\\() > 0. In general, `Vec`'s allocation\ndetails are very subtle --- if you intend to allocate memory using a `Vec`\nand use it for something else (either to pass to unsafe code, or to build your\nown memory-backed collection), be sure to deallocate this memory by using\n`from_raw_parts` to recover the `Vec` and then dropping it.\n\nIf a `Vec` *has* allocated memory, then the memory it points to is on the heap\n(as defined by the allocator Rust is configured to use by default), and its\npointer points to [`len`] initialized, contiguous elements in order (what\nyou would see if you coerced it to a slice), followed by [capacity] - [len]\nlogically uninitialized, contiguous elements.\n\nA vector containing the elements `'a'` and `'b'` with capacity 4 can be\nvisualized as below. The top part is the `Vec` struct, it contains a\npointer to the head of the allocation in the heap, length and capacity.\nThe bottom part is the allocation on the heap, a contiguous memory block.\n\n```text\n ptr len capacity\n +--------+--------+--------+\n | 0x0123 | 2 | 4 |\n +--------+--------+--------+\n |\n v\nHeap +--------+--------+--------+--------+\n | 'a' | 'b' | uninit | uninit |\n +--------+--------+--------+--------+\n```\n\n- **uninit** represents memory that is not initialized, see [`MaybeUninit`].\n- Note: the ABI is not stable and `Vec` makes no guarantees about its memory\n layout (including the order of fields).\n\n`Vec` will never perform a \"small optimization\" where elements are actually\nstored on the stack for two reasons:\n\n* It would make it more difficult for unsafe code to correctly manipulate\n a `Vec`. The contents of a `Vec` wouldn't have a stable address if it were\n only moved, and it would be more difficult to determine if a `Vec` had\n actually allocated memory.\n\n* It would penalize the general case, incurring an additional branch\n on every access.\n\n`Vec` will never automatically shrink itself, even if completely empty. This\nensures no unnecessary allocations or deallocations occur. Emptying a `Vec`\nand then filling it back up to the same [`len`] should incur no calls to\nthe allocator. If you wish to free up unused memory, use\n[`shrink_to_fit`] or [`shrink_to`].\n\n[`push`] and [`insert`] will never (re)allocate if the reported capacity is\nsufficient. [`push`] and [`insert`] *will* (re)allocate if\n[len] == [capacity]. That is, the reported capacity is completely\naccurate, and can be relied on. It can even be used to manually free the memory\nallocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even\nwhen not necessary.\n\n`Vec` does not guarantee any particular growth strategy when reallocating\nwhen full, nor when [`reserve`] is called. The current strategy is basic\nand it may prove desirable to use a non-constant growth factor. Whatever\nstrategy is used will of course guarantee *O*(1) amortized [`push`].\n\n`vec![x; n]`, `vec![a, b, c, d]`, and\n[`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`\nwith exactly the requested capacity. If [len] == [capacity],\n(as is the case for the [`vec!`] macro), then a `Vec` can be converted to\nand from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.\n\n`Vec` will not specifically overwrite any data that is removed from it,\nbut also won't specifically preserve it. Its uninitialized memory is\nscratch space that it may use however it wants. It will generally just do\nwhatever is most efficient or otherwise easy to implement. Do not rely on\nremoved data to be erased for security purposes. Even if you drop a `Vec`, its\nbuffer may simply be reused by another allocation. Even if you zero a `Vec`'s memory\nfirst, that might not actually happen because the optimizer does not consider\nthis a side-effect that must be preserved. There is one case which we will\nnot break, however: using `unsafe` code to write to the excess capacity,\nand then increasing the length to match, is always valid.\n\nCurrently, `Vec` does not guarantee the order in which elements are dropped.\nThe order has changed in the past and may change again.\n\n[`get`]: slice::get\n[`get_mut`]: slice::get_mut\n[`String`]: crate::string::String\n[`&str`]: type@str\n[`shrink_to_fit`]: Vec::shrink_to_fit\n[`shrink_to`]: Vec::shrink_to\n[capacity]: Vec::capacity\n[`capacity`]: Vec::capacity\n[mem::size_of::\\]: core::mem::size_of\n[len]: Vec::len\n[`len`]: Vec::len\n[`push`]: Vec::push\n[`insert`]: Vec::insert\n[`reserve`]: Vec::reserve\n[`MaybeUninit`]: core::mem::MaybeUninit\n[owned slice]: Box"},"deprecated":false,"sortText":"ffffffef","filterText":"Vec","textEdit":{"newText":"Vec","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"alloc_error_handler","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"alloc_error_handler","textEdit":{"newText":"alloc_error_handler","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"drop(…)","kind":3,"detail":"fn(T)","documentation":{"kind":"markdown","value":"Disposes of a value.\n\nThis does so by calling the argument's implementation of [`Drop`][drop].\n\nThis effectively does nothing for types which implement `Copy`, e.g.\nintegers. Such values are copied and _then_ moved into the function, so the\nvalue persists after this function call.\n\nThis function is not magic; it is literally defined as\n\n```rust\npub fn drop(_x: T) {}\n```\n\nBecause `_x` is moved into the function, it is automatically dropped before\nthe function returns.\n\n[drop]: Drop\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = vec![1, 2, 3];\n\ndrop(v); // explicitly drop the vector\n```\n\nSince [`RefCell`] enforces the borrow rules at runtime, `drop` can\nrelease a [`RefCell`] borrow:\n\n```rust\nuse std::cell::RefCell;\n\nlet x = RefCell::new(1);\n\nlet mut mutable_borrow = x.borrow_mut();\n*mutable_borrow = 1;\n\ndrop(mutable_borrow); // relinquish the mutable borrow on this slot\n\nlet borrow = x.borrow();\nprintln!(\"{}\", *borrow);\n```\n\nIntegers and other types implementing [`Copy`] are unaffected by `drop`.\n\n```rust\n#[derive(Copy, Clone)]\nstruct Foo(u8);\n\nlet x = 1;\nlet y = Foo(2);\ndrop(x); // a copy of `x` is moved and dropped\ndrop(y); // a copy of `y` is moved and dropped\n\nprintln!(\"x: {}, y: {}\", x, y.0); // still available\n```\n\n[`RefCell`]: crate::cell::RefCell"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"drop","insertTextFormat":2,"textEdit":{"newText":"drop(${1:x})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"type_ascribe","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"type_ascribe","textEdit":{"newText":"type_ascribe","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"unsafe","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"unsafe","insertTextFormat":2,"textEdit":{"newText":"unsafe {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"match","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"match","insertTextFormat":2,"textEdit":{"newText":"match $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"while","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"while","insertTextFormat":2,"textEdit":{"newText":"while $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"while let","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"while let","insertTextFormat":2,"textEdit":{"newText":"while let $1 = $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"loop","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"loop","insertTextFormat":2,"textEdit":{"newText":"loop {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"if","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"if","insertTextFormat":2,"textEdit":{"newText":"if $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"if let","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"if let","insertTextFormat":2,"textEdit":{"newText":"if let $1 = $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"for","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"for","insertTextFormat":2,"textEdit":{"newText":"for $1 in $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"true","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"true","insertTextFormat":2,"textEdit":{"newText":"true","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"false","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"false","insertTextFormat":2,"textEdit":{"newText":"false","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]},{"label":"return","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"return","insertTextFormat":2,"textEdit":{"newText":"return","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":14}}},"additionalTextEdits":[]}]}} 2023-12-27T20:29:07.620 helix_lsp::transport [INFO] rust-analyzer <- {"isIncomplete":true,"items":[{"additionalTextEdits":[],"deprecated":false,"filterText":"self::","kind":14,"label":"self::","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"self::","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"crate::","kind":14,"label":"crate::","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"crate::","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"fn()","filterText":"main","insertTextFormat":2,"kind":3,"label":"main()","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"main()$0","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! panic","filterText":"panic!","insertTextFormat":2,"kind":3,"label":"panic!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"panic!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! println","documentation":{"kind":"markdown","value":"Prints to the standard output, with a newline.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`)).\n\nThis macro uses the same syntax as [`format!`], but writes to the standard output instead.\nSee [`std::fmt`] for more information.\n\nThe `println!` macro will lock the standard output on each call. If you call\n`println!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwriteln!(lock, \"hello world\").unwrap();\n```\n\nUse `println!` only for the primary output of your program. Use\n[`eprintln!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`std::fmt`]: crate::fmt\n[`eprintln!`]: crate::eprintln\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to [`io::stdout`] fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n[`io::stdout`]: crate::io::stdout\n\n# Examples\n\n```rust\nprintln!(); // prints just a newline\nprintln!(\"hello there!\");\nprintln!(\"format {} arguments\", \"some\");\nlet local_variable = \"some\";\nprintln!(\"format {local_variable} arguments\");\n```"},"filterText":"println!","insertTextFormat":2,"kind":3,"label":"println!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"println!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_eq!`], `debug_assert_eq!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_eq!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_eq!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_eq!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\ndebug_assert_eq!(a, b);\n```"},"filterText":"debug_assert_eq!","insertTextFormat":2,"kind":3,"label":"debug_assert_eq!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert_eq!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include_str","documentation":{"kind":"markdown","value":"Includes a UTF-8 encoded file as a string.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static str` which is the\ncontents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_str = include_str!(\"spanish.in\");\n assert_eq!(my_str, \"adiós\\n\");\n print!(\"{my_str}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"filterText":"include_str!","insertTextFormat":2,"kind":3,"label":"include_str!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"include_str!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat","documentation":{"kind":"markdown","value":"Concatenates literals into a static string slice.\n\nThis macro takes any number of comma-separated literals, yielding an\nexpression of type `&'static str` which represents all of the literals\nconcatenated left-to-right.\n\nInteger and floating point literals are [stringified](core::stringify) in order to be\nconcatenated.\n\n# Examples\n\n```rust\nlet s = concat!(\"test\", 10, 'b', true);\nassert_eq!(s, \"test10btrue\");\n```"},"filterText":"concat!","insertTextFormat":2,"kind":3,"label":"concat!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"concat!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format","documentation":{"kind":"markdown","value":"Creates a `String` using interpolation of runtime expressions.\n\nThe first argument `format!` receives is a format string. This must be a string\nliteral. The power of the formatting string is in the `{}`s contained.\nAdditional parameters passed to `format!` replace the `{}`s within the\nformatting string in the order given unless named or positional parameters\nare used.\n\nSee [the formatting syntax documentation in `std::fmt`](../std/fmt/index.html)\nfor details.\n\nA common use for `format!` is concatenation and interpolation of strings.\nThe same convention is used with [`print!`] and [`write!`] macros,\ndepending on the intended destination of the string; all these macros internally use [`format_args!`].\n\nTo convert a single value to a string, use the [`to_string`] method. This\nwill use the [`Display`] formatting trait.\n\nTo concatenate literals into a `&'static str`, use the [`concat!`] macro.\n\n[`print!`]: ../std/macro.print.html\n[`write!`]: core::write\n[`format_args!`]: core::format_args\n[`to_string`]: crate::string::ToString\n[`Display`]: core::fmt::Display\n[`concat!`]: core::concat\n\n# Panics\n\n`format!` panics if a formatting trait implementation returns an error.\nThis indicates an incorrect implementation\nsince `fmt::Write for String` never returns an error itself.\n\n# Examples\n\n```rust\nformat!(\"test\"); // => \"test\"\nformat!(\"hello {}\", \"world!\"); // => \"hello world!\"\nformat!(\"x = {}, y = {val}\", 10, val = 30); // => \"x = 10, y = 30\"\nlet (x, y) = (1, 2);\nformat!(\"{x} + {y} = 3\"); // => \"1 + 2 = 3\"\n```"},"filterText":"format!","insertTextFormat":2,"kind":3,"label":"format!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"format!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! log_syntax","documentation":{"kind":"markdown","value":"Prints passed tokens into the standard output."},"filterText":"log_syntax!","insertTextFormat":2,"kind":3,"label":"log_syntax!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"log_syntax!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! stringify","documentation":{"kind":"markdown","value":"Stringifies its arguments.\n\nThis macro will yield an expression of type `&'static str` which is the\nstringification of all the tokens passed to the macro. No restrictions\nare placed on the syntax of the macro invocation itself.\n\nNote that the expanded results of the input tokens may change in the\nfuture. You should be careful if you rely on the output.\n\n# Examples\n\n```rust\nlet one_plus_one = stringify!(1 + 1);\nassert_eq!(one_plus_one, \"1 + 1\");\n```"},"filterText":"stringify!","insertTextFormat":2,"kind":3,"label":"stringify!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"stringify!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\nassert_ne!(a, b);\n\nassert_ne!(a, b, \"we are testing that the values are not equal\");\n```"},"filterText":"assert_ne!","insertTextFormat":2,"kind":3,"label":"assert_ne!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"assert_ne!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! dbg","documentation":{"kind":"markdown","value":"Prints and returns the value of a given expression for quick and dirty\ndebugging.\n\nAn example:\n\n```rust\nlet a = 2;\nlet b = dbg!(a * 2) + 1;\n// ^-- prints: [src/main.rs:2] a * 2 = 4\nassert_eq!(b, 5);\n```\n\nThe macro works by using the `Debug` implementation of the type of\nthe given expression to print the value to [stderr] along with the\nsource location of the macro invocation as well as the source code\nof the expression.\n\nInvoking the macro on an expression moves and takes ownership of it\nbefore returning the evaluated expression unchanged. If the type\nof the expression does not implement `Copy` and you don't want\nto give up ownership, you can instead borrow with `dbg!(&expr)`\nfor some expression `expr`.\n\nThe `dbg!` macro works exactly the same in release builds.\nThis is useful when debugging issues that only occur in release\nbuilds or when debugging in release mode is significantly faster.\n\nNote that the macro is intended as a debugging tool and therefore you\nshould avoid having uses of it in version control for long periods\n(other than in tests and similar).\nDebug output from production code is better done with other facilities\nsuch as the [`debug!`] macro from the [`log`] crate.\n\n# Stability\n\nThe exact output printed by this macro should not be relied upon\nand is subject to future changes.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\n# Further examples\n\nWith a method call:\n\n```rust\nfn foo(n: usize) {\n if let Some(_) = dbg!(n.checked_sub(4)) {\n // ...\n }\n}\n\nfoo(3)\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:4] n.checked_sub(4) = None\n```\n\nNaive factorial implementation:\n\n```rust\nfn factorial(n: u32) -> u32 {\n if dbg!(n <= 1) {\n dbg!(1)\n } else {\n dbg!(n * factorial(n - 1))\n }\n}\n\ndbg!(factorial(4));\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = true\n[src/main.rs:4] 1 = 1\n[src/main.rs:5] n * factorial(n - 1) = 2\n[src/main.rs:5] n * factorial(n - 1) = 6\n[src/main.rs:5] n * factorial(n - 1) = 24\n[src/main.rs:11] factorial(4) = 24\n```\n\nThe `dbg!(..)` macro moves the input:\n\n```rust\n/// A wrapper around `usize` which importantly is not Copyable.\n#[derive(Debug)]\nstruct NoCopy(usize);\n\nlet a = NoCopy(42);\nlet _ = dbg!(a); // <-- `a` is moved here.\nlet _ = dbg!(a); // <-- `a` is moved again; error!\n```\n\nYou can also use `dbg!()` without a value to just print the\nfile and line whenever it's reached.\n\nFinally, if you want to `dbg!(..)` multiple values, it will treat them as\na tuple (and return it, too):\n\n```rust\nassert_eq!(dbg!(1usize, 2u32), (1, 2));\n```\n\nHowever, a single argument with a trailing comma will still not be treated\nas a tuple, following the convention of ignoring trailing commas in macro\ninvocations. You can use a 1-tuple directly if you need one:\n\n```rust\nassert_eq!(1, dbg!(1u32,)); // trailing comma ignored\nassert_eq!((1,), dbg!((1u32,))); // 1-tuple\n```\n\n[stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)\n[`debug!`]: https://docs.rs/log/*/log/macro.debug.html\n[`log`]: https://crates.io/crates/log"},"filterText":"dbg!","insertTextFormat":2,"kind":3,"label":"dbg!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"dbg!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! vec","documentation":{"kind":"markdown","value":"Creates a [`Vec`] containing the arguments.\n\n`vec!` allows `Vec`s to be defined with the same syntax as array expressions.\nThere are two forms of this macro:\n\n- Create a [`Vec`] containing a given list of elements:\n\n```rust\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```\n\n- Create a [`Vec`] from a given element and size:\n\n```rust\nlet v = vec![1; 3];\nassert_eq!(v, [1, 1, 1]);\n```\n\nNote that unlike array expressions this syntax supports all elements\nwhich implement [`Clone`] and the number of elements doesn't have to be\na constant.\n\nThis will use `clone` to duplicate an expression, so one should be careful\nusing this with types having a nonstandard `Clone` implementation. For\nexample, `vec![Rc::new(1); 5]` will create a vector of five references\nto the same boxed integer value, not five references pointing to independently\nboxed integers.\n\nAlso, note that `vec![expr; 0]` is allowed, and produces an empty vector.\nThis will still evaluate `expr`, however, and immediately drop the resulting value, so\nbe mindful of side effects.\n\n[`Vec`]: crate::vec::Vec"},"filterText":"vec!","insertTextFormat":2,"kind":3,"label":"vec![…]","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"vec![$0]","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include","documentation":{"kind":"markdown","value":"Parses a file as an expression or an item according to the context.\n\n**Warning**: For multi-file Rust projects, the `include!` macro is probably not what you\nare looking for. Usually, multi-file Rust projects use\n[modules](https://doc.rust-lang.org/reference/items/modules.html). Multi-file projects and\nmodules are explained in the Rust-by-Example book\n[here](https://doc.rust-lang.org/rust-by-example/mod/split.html) and the module system is\nexplained in the Rust Book\n[here](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html).\n\nThe included file is placed in the surrounding code\n[unhygienically](https://doc.rust-lang.org/reference/macros-by-example.html#hygiene). If\nthe included file is parsed as an expression and variables or functions share names across\nboth files, it could result in variables or functions being different from what the\nincluded file expected.\n\nThe included file is located relative to the current file (similarly to how modules are\nfound). The provided path is interpreted in a platform-specific way at compile time. So,\nfor instance, an invocation with a Windows path containing backslashes `\\` would not\ncompile correctly on Unix.\n\n# Uses\n\nThe `include!` macro is primarily used for two purposes. It is used to include\ndocumentation that is written in a separate file and it is used to include [build artifacts\nusually as a result from the `build.rs`\nscript](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script).\n\nWhen using the `include` macro to include stretches of documentation, remember that the\nincluded file still needs to be a valid rust syntax. It is also possible to\nuse the [`include_str`] macro as `#![doc = include_str!(\"...\")]` (at the module level) or\n`#[doc = include_str!(\"...\")]` (at the item level) to include documentation from a plain\ntext or markdown file.\n\n# Examples\n\nAssume there are two files in the same directory with the following contents:\n\nFile 'monkeys.in':\n\n```rust\n['🙈', '🙊', '🙉']\n .iter()\n .cycle()\n .take(6)\n .collect::()\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_string = include!(\"monkeys.in\");\n assert_eq!(\"🙈🙊🙉🙈🙊🙉\", my_string);\n println!(\"{my_string}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print\n\"🙈🙊🙉🙈🙊🙉\"."},"filterText":"include!","insertTextFormat":2,"kind":3,"label":"include!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"include!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! print","documentation":{"kind":"markdown","value":"Prints to the standard output.\n\nEquivalent to the [`println!`] macro except that a newline is not printed at\nthe end of the message.\n\nNote that stdout is frequently line-buffered by default so it may be\nnecessary to use [`io::stdout().flush()`][flush] to ensure the output is emitted\nimmediately.\n\nThe `print!` macro will lock the standard output on each call. If you call\n`print!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwrite!(lock, \"hello world\").unwrap();\n```\n\nUse `print!` only for the primary output of your program. Use\n[`eprint!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[flush]: crate::io::Write::flush\n[`println!`]: crate::println\n[`eprint!`]: crate::eprint\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to `io::stdout()` fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\nuse std::io::{self, Write};\n\nprint!(\"this \");\nprint!(\"will \");\nprint!(\"be \");\nprint!(\"on \");\nprint!(\"the \");\nprint!(\"same \");\nprint!(\"line \");\n\nio::stdout().flush().unwrap();\n\nprint!(\"this string has a newline, why not choose println! instead?\\n\");\n\nio::stdout().flush().unwrap();\n```"},"filterText":"print!","insertTextFormat":2,"kind":3,"label":"print!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"print!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro cfg_match","documentation":{"kind":"markdown","value":"A macro for defining `#[cfg]` match-like statements.\n\nIt is similar to the `if/elif` C preprocessor macro by allowing definition of a cascade of\n`#[cfg]` cases, emitting the implementation which matches first.\n\nThis allows you to conveniently provide a long list `#[cfg]`'d blocks of code\nwithout having to rewrite each clause multiple times.\n\nTrailing `_` wildcard match arms are **optional** and they indicate a fallback branch when\nall previous declarations do not evaluate to true.\n\n# Example\n\n```rust\n#![feature(cfg_match)]\n\ncfg_match! {\n cfg(unix) => {\n fn foo() { /* unix specific functionality */ }\n }\n cfg(target_pointer_width = \"32\") => {\n fn foo() { /* non-unix, 32-bit functionality */ }\n }\n _ => {\n fn foo() { /* fallback implementation */ }\n }\n}\n```"},"filterText":"cfg_match!","insertTextFormat":2,"kind":3,"label":"cfg_match! {…}","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"cfg_match! {$0}","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat_idents","documentation":{"kind":"markdown","value":"Concatenates identifiers into one identifier.\n\nThis macro takes any number of comma-separated identifiers, and\nconcatenates them all into one, yielding an expression which is a new\nidentifier. Note that hygiene makes it such that this macro cannot\ncapture local variables. Also, as a general rule, macros are only\nallowed in item, statement or expression position. That means while\nyou may use this macro for referring to existing variables, functions or\nmodules etc, you cannot define a new one with it.\n\n# Examples\n\n```rust\n#![feature(concat_idents)]\n\nfn foobar() -> u32 { 23 }\n\nlet f = concat_idents!(foo, bar);\nprintln!(\"{}\", f());\n\n// fn concat_idents!(new, fun, name) { } // not usable in this way!\n```"},"filterText":"concat_idents!","insertTextFormat":2,"kind":3,"label":"concat_idents!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"concat_idents!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! write","documentation":{"kind":"markdown","value":"Writes formatted data into a buffer.\n\nThis macro accepts a 'writer', a format string, and a list of arguments. Arguments will be\nformatted according to the specified format string and the result will be passed to the writer.\nThe writer may be any value with a `write_fmt` method; generally this comes from an\nimplementation of either the [`fmt::Write`] or the [`io::Write`] trait. The macro\nreturns whatever the `write_fmt` method returns; commonly a [`fmt::Result`], or an\n[`io::Result`].\n\nSee [`std::fmt`] for more information on the format string syntax.\n\n[`std::fmt`]: ../std/fmt/index.html\n[`fmt::Write`]: crate::fmt::Write\n[`io::Write`]: ../std/io/trait.Write.html\n[`fmt::Result`]: crate::fmt::Result\n[`io::Result`]: ../std/io/type.Result.html\n\n# Examples\n\n```rust\nuse std::io::Write;\n\nfn main() -> std::io::Result<()> {\n let mut w = Vec::new();\n write!(&mut w, \"test\")?;\n write!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(w, b\"testformatted arguments\");\n Ok(())\n}\n```\n\nA module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects\nimplementing either, as objects do not typically implement both. However, the module must\navoid conflict between the trait names, such as by importing them as `_` or otherwise renaming\nthem:\n\n```rust\nuse std::fmt::Write as _;\nuse std::io::Write as _;\n\nfn main() -> Result<(), Box> {\n let mut s = String::new();\n let mut v = Vec::new();\n\n write!(&mut s, \"{} {}\", \"abc\", 123)?; // uses fmt::Write::write_fmt\n write!(&mut v, \"s = {:?}\", s)?; // uses io::Write::write_fmt\n assert_eq!(v, b\"s = \\\"abc 123\\\"\");\n Ok(())\n}\n```\n\nIf you also need the trait names themselves, such as to implement one or both on your types,\nimport the containing module and then name them with a prefix:\n\n```rust\nuse std::fmt::{self, Write as _};\nuse std::io::{self, Write as _};\n\nstruct Example;\n\nimpl fmt::Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n```\n\nNote: This macro can be used in `no_std` setups as well.\nIn a `no_std` setup you are responsible for the implementation details of the components.\n\n```rust\nuse core::fmt::Write;\n\nstruct Example;\n\nimpl Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n\nlet mut m = Example{};\nwrite!(&mut m, \"Hello World\").expect(\"Not written\");\n```"},"filterText":"write!","insertTextFormat":2,"kind":3,"label":"write!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"write!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! line","documentation":{"kind":"markdown","value":"Expands to the line number on which it was invoked.\n\nWith [`column!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first line\nin each file evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned line is *not necessarily* the line of the `line!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `line!` macro.\n\n# Examples\n\n```rust\nlet current_line = line!();\nprintln!(\"defined on line: {current_line}\");\n```"},"filterText":"line!","insertTextFormat":2,"kind":3,"label":"line!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"line!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\nLike [`assert!`], this macro also has a second version, where a custom panic\nmessage can be provided.\n\n# Uses\n\nUnlike [`assert!`], `debug_assert!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert!` is always type checked.\n\nAn unchecked assertion allows a program in an inconsistent state to keep\nrunning, which might have unexpected consequences but does not introduce\nunsafety as long as this only happens in safe code. The performance cost\nof assertions, however, is not measurable in general. Replacing [`assert!`]\nwith `debug_assert!` is thus only encouraged after thorough profiling, and\nmore importantly, only in safe code!\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\ndebug_assert!(true);\n\nfn some_expensive_computation() -> bool { true } // a very simple function\ndebug_assert!(some_expensive_computation());\n\n// assert with a custom message\nlet x = true;\ndebug_assert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\ndebug_assert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"filterText":"debug_assert!","insertTextFormat":2,"kind":3,"label":"debug_assert!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include_bytes","documentation":{"kind":"markdown","value":"Includes a file as a reference to a byte array.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static [u8; N]` which is\nthe contents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let bytes = include_bytes!(\"spanish.in\");\n assert_eq!(bytes, b\"adi\\xc3\\xb3s\\n\");\n print!(\"{}\", String::from_utf8_lossy(bytes));\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"filterText":"include_bytes!","insertTextFormat":2,"kind":3,"label":"include_bytes!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"include_bytes!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! const_format_args","documentation":{"kind":"markdown","value":"Same as [`format_args`], but can be used in some const contexts.\n\nThis macro is used by the panic macros for the `const_panic` feature.\n\nThis macro will be removed once `format_args` is allowed in const contexts."},"filterText":"const_format_args!","insertTextFormat":2,"kind":3,"label":"const_format_args!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"const_format_args!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! env","documentation":{"kind":"markdown","value":"Inspects an environment variable at compile time.\n\nThis macro will expand to the value of the named environment variable at\ncompile time, yielding an expression of type `&'static str`. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nIf the environment variable is not defined, then a compilation error\nwill be emitted. To not emit a compile error, use the [`option_env!`]\nmacro instead.\n\n# Examples\n\n```rust\nlet path: &'static str = env!(\"PATH\");\nprintln!(\"the $PATH variable at the time of compiling was: {path}\");\n```\n\nYou can customize the error message by passing a string as the second\nparameter:\n\n```rust\nlet doc: &'static str = env!(\"documentation\", \"what's that?!\");\n```\n\nIf the `documentation` environment variable is not defined, you'll get\nthe following error:\n\n```text\nerror: what's that?!\n```"},"filterText":"env!","insertTextFormat":2,"kind":3,"label":"env!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"env!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":true,"detail":"macro_rules! r#try","documentation":{"kind":"markdown","value":"Unwraps a result or propagates its error.\n\nThe [`?` operator][propagating-errors] was added to replace `try!`\nand should be used instead. Furthermore, `try` is a reserved word\nin Rust 2018, so if you must use it, you will need to use the\n[raw-identifier syntax][ris]: `r#try`.\n\n[propagating-errors]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator\n[ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html\n\n`try!` matches the given [`Result`]. In case of the `Ok` variant, the\nexpression has the value of the wrapped value.\n\nIn case of the `Err` variant, it retrieves the inner error. `try!` then\nperforms conversion using `From`. This provides automatic conversion\nbetween specialized errors and more general ones. The resulting\nerror is then immediately returned.\n\nBecause of the early return, `try!` can only be used in functions that\nreturn [`Result`].\n\n# Examples\n\n```rust\nuse std::io;\nuse std::fs::File;\nuse std::io::prelude::*;\n\nenum MyError {\n FileWriteError\n}\n\nimpl From for MyError {\n fn from(e: io::Error) -> MyError {\n MyError::FileWriteError\n }\n}\n\n// The preferred method of quick returning Errors\nfn write_to_file_question() -> Result<(), MyError> {\n let mut file = File::create(\"my_best_friends.txt\")?;\n file.write_all(b\"This is a list of my best friends.\")?;\n Ok(())\n}\n\n// The previous method of quick returning Errors\nfn write_to_file_using_try() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n r#try!(file.write_all(b\"This is a list of my best friends.\"));\n Ok(())\n}\n\n// This is equivalent to:\nfn write_to_file_using_match() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n match file.write_all(b\"This is a list of my best friends.\") {\n Ok(v) => v,\n Err(e) => return Err(From::from(e)),\n }\n Ok(())\n}\n```"},"filterText":"try!","insertTextFormat":2,"kind":3,"label":"try!(…)","sortText":"ffffffef","tags":[1],"textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"r#try!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! file","documentation":{"kind":"markdown","value":"Expands to the file name in which it was invoked.\n\nWith [`line!`] and [`column!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `&'static str`, and the returned file\nis not the invocation of the `file!` macro itself, but rather the\nfirst macro invocation leading up to the invocation of the `file!`\nmacro.\n\n# Examples\n\n```rust\nlet this_file = file!();\nprintln!(\"defined in file: {this_file}\");\n```"},"filterText":"file!","insertTextFormat":2,"kind":3,"label":"file!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"file!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! thread_local","documentation":{"kind":"markdown","value":"Declare a new thread local storage key of type [`std::thread::LocalKey`].\n\n# Syntax\n\nThe macro wraps any number of static declarations and makes them thread local.\nPublicity and attributes for each static are allowed. Example:\n\n```rust\nuse std::cell::RefCell;\nthread_local! {\n pub static FOO: RefCell = RefCell::new(1);\n\n static BAR: RefCell = RefCell::new(1.0);\n}\n\nFOO.with(|foo| assert_eq!(*foo.borrow(), 1));\nBAR.with(|bar| assert_eq!(*bar.borrow(), 1.0));\n```\n\nThis macro supports a special `const {}` syntax that can be used\nwhen the initialization expression can be evaluated as a constant.\nThis can enable a more efficient thread local implementation that\ncan avoid lazy initialization. For types that do not\n[need to be dropped][crate::mem::needs_drop], this can enable an\neven more efficient implementation that does not need to\ntrack any additional state.\n\n```rust\nuse std::cell::Cell;\nthread_local! {\n pub static FOO: Cell = const { Cell::new(1) };\n}\n\nFOO.with(|foo| assert_eq!(foo.get(), 1));\n```\n\nSee [`LocalKey` documentation][`std::thread::LocalKey`] for more\ninformation.\n\n[`std::thread::LocalKey`]: crate::thread::LocalKey"},"filterText":"thread_local!","insertTextFormat":2,"kind":3,"label":"thread_local! {…}","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"thread_local! {$0}","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\n# Uses\n\nAssertions are always checked in both debug and release builds, and cannot\nbe disabled. See [`debug_assert!`] for assertions that are not enabled in\nrelease builds by default.\n\nUnsafe code may rely on `assert!` to enforce run-time invariants that, if\nviolated could lead to unsafety.\n\nOther use-cases of `assert!` include testing and enforcing run-time\ninvariants in safe code (whose violation cannot result in unsafety).\n\n# Custom Messages\n\nThis macro has a second form, where a custom panic message can\nbe provided with or without arguments for formatting. See [`std::fmt`]\nfor syntax for this form. Expressions used as format arguments will only\nbe evaluated if the assertion fails.\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\nassert!(true);\n\nfn some_computation() -> bool { true } // a very simple function\n\nassert!(some_computation());\n\n// assert with a custom message\nlet x = true;\nassert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\nassert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"filterText":"assert!","insertTextFormat":2,"kind":3,"label":"assert!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"assert!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! column","documentation":{"kind":"markdown","value":"Expands to the column number at which it was invoked.\n\nWith [`line!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first column\nin each line evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned column is *not necessarily* the line of the `column!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `column!` macro.\n\n# Examples\n\n```rust\nlet current_col = column!();\nprintln!(\"defined on column: {current_col}\");\n```\n\n`column!` counts Unicode code points, not bytes or graphemes. As a result, the first two\ninvocations return the same value, but the third does not.\n\n```rust\nlet a = (\"foobar\", column!()).1;\nlet b = (\"人之初性本善\", column!()).1;\nlet c = (\"f̅o̅o̅b̅a̅r̅\", column!()).1; // Uses combining overline (U+0305)\n\nassert_eq!(a, b);\nassert_ne!(b, c);\n```"},"filterText":"column!","insertTextFormat":2,"kind":3,"label":"column!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"column!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format_args_nl","documentation":{"kind":"markdown","value":"Same as [`format_args`], but adds a newline in the end."},"filterText":"format_args_nl!","insertTextFormat":2,"kind":3,"label":"format_args_nl!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"format_args_nl!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! unreachable","documentation":{"kind":"markdown","value":"Indicates unreachable code.\n\nThis is useful any time that the compiler can't determine that some code is unreachable. For\nexample:\n\n* Match arms with guard conditions.\n* Loops that dynamically terminate.\n* Iterators that dynamically terminate.\n\nIf the determination that the code is unreachable proves incorrect, the\nprogram immediately terminates with a [`panic!`].\n\nThe unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which\nwill cause undefined behavior if the code is reached.\n\n[`unreachable_unchecked`]: crate::hint::unreachable_unchecked\n\n# Panics\n\nThis will always [`panic!`] because `unreachable!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nMatch arms:\n\n```rust\nfn foo(x: Option) {\n match x {\n Some(n) if n >= 0 => println!(\"Some(Non-negative)\"),\n Some(n) if n < 0 => println!(\"Some(Negative)\"),\n Some(_) => unreachable!(), // compile error if commented out\n None => println!(\"None\")\n }\n}\n```\n\nIterators:\n\n```rust\nfn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3\n for i in 0.. {\n if 3*i < i { panic!(\"u32 overflow\"); }\n if x < 3*i { return i-1; }\n }\n unreachable!(\"The loop should always return\");\n}\n```"},"filterText":"unreachable!","insertTextFormat":2,"kind":3,"label":"unreachable!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"unreachable!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! eprintln","documentation":{"kind":"markdown","value":"Prints to the standard error, with a newline.\n\nEquivalent to the [`println!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`println!`] for\nexample usage.\n\nUse `eprintln!` only for error and progress messages. Use `println!`\ninstead for the primary output of your program.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n[`println!`]: crate::println\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprintln!(\"Error: Could not complete task\");\n```"},"filterText":"eprintln!","insertTextFormat":2,"kind":3,"label":"eprintln!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"eprintln!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! unimplemented","documentation":{"kind":"markdown","value":"Indicates unimplemented code by panicking with a message of \"not implemented\".\n\nThis allows your code to type-check, which is useful if you are prototyping or\nimplementing a trait that requires multiple methods which you don't plan to use all of.\n\nThe difference between `unimplemented!` and [`todo!`] is that while `todo!`\nconveys an intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `unimplemented!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n[`todo!`]: crate::todo\n\n# Examples\n\nSay we have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` for 'MyStruct', but for some reason it only makes sense\nto implement the `bar()` function. `baz()` and `qux()` will still need to be defined\nin our implementation of `Foo`, but we can use `unimplemented!` in their definitions\nto allow our code to compile.\n\nWe still want to have our program stop running if the unimplemented methods are\nreached.\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // It makes no sense to `baz` a `MyStruct`, so we have no logic here\n // at all.\n // This will display \"thread 'main' panicked at 'not implemented'\".\n unimplemented!();\n }\n\n fn qux(&self) -> Result {\n // We have some logic here,\n // We can add a message to unimplemented! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not implemented: MyStruct isn't quxable'\".\n unimplemented!(\"MyStruct isn't quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n}\n```"},"filterText":"unimplemented!","insertTextFormat":2,"kind":3,"label":"unimplemented!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"unimplemented!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! cfg","documentation":{"kind":"markdown","value":"Evaluates boolean combinations of configuration flags at compile-time.\n\nIn addition to the `#[cfg]` attribute, this macro is provided to allow\nboolean expression evaluation of configuration flags. This frequently\nleads to less duplicated code.\n\nThe syntax given to this macro is the same syntax as the [`cfg`]\nattribute.\n\n`cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For\nexample, all blocks in an if/else expression need to be valid when `cfg!` is used for\nthe condition, regardless of what `cfg!` is evaluating.\n\n[`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute\n\n# Examples\n\n```rust\nlet my_directory = if cfg!(windows) {\n \"windows-specific-directory\"\n} else {\n \"unix-directory\"\n};\n```"},"filterText":"cfg!","insertTextFormat":2,"kind":3,"label":"cfg!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"cfg!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! todo","documentation":{"kind":"markdown","value":"Indicates unfinished code.\n\nThis can be useful if you are prototyping and just\nwant a placeholder to let your code pass type analysis.\n\nThe difference between [`unimplemented!`] and `todo!` is that while `todo!` conveys\nan intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `todo!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nHere's an example of some in-progress code. We have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` on one of our types, but we also want to work on\njust `bar()` first. In order for our code to compile, we need to implement\n`baz()` and `qux()`, so we can use `todo!`:\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // Let's not worry about implementing baz() for now\n todo!();\n }\n\n fn qux(&self) -> Result {\n // We can add a message to todo! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not yet implemented: MyStruct is not yet quxable'\".\n todo!(\"MyStruct is not yet quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n\n // We aren't even using baz() or qux(), so this is fine.\n}\n```"},"filterText":"todo!","insertTextFormat":2,"kind":3,"label":"todo!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"todo!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! trace_macros","documentation":{"kind":"markdown","value":"Enables or disables tracing functionality used for debugging other macros."},"filterText":"trace_macros!","insertTextFormat":2,"kind":3,"label":"trace_macros!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"trace_macros!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! module_path","documentation":{"kind":"markdown","value":"Expands to a string that represents the current module path.\n\nThe current module path can be thought of as the hierarchy of modules\nleading back up to the crate root. The first component of the path\nreturned is the name of the crate currently being compiled.\n\n# Examples\n\n```rust\nmod test {\n pub fn foo() {\n assert!(module_path!().ends_with(\"test\"));\n }\n}\n\ntest::foo();\n```"},"filterText":"module_path!","insertTextFormat":2,"kind":3,"label":"module_path!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"module_path!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! option_env","documentation":{"kind":"markdown","value":"Optionally inspects an environment variable at compile time.\n\nIf the named environment variable is present at compile time, this will\nexpand into an expression of type `Option<&'static str>` whose value is\n`Some` of the value of the environment variable. If the environment\nvariable is not present, then this will expand to `None`. See\n[`Option`][Option] for more information on this type. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nA compile time error is never emitted when using this macro regardless\nof whether the environment variable is present or not.\nTo emit a compile error if the environment variable is not present,\nuse the [`env!`] macro instead.\n\n# Examples\n\n```rust\nlet key: Option<&'static str> = option_env!(\"SECRET_KEY\");\nprintln!(\"the secret key might be: {key:?}\");\n```"},"filterText":"option_env!","insertTextFormat":2,"kind":3,"label":"option_env!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"option_env!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! writeln","documentation":{"kind":"markdown","value":"Write formatted data into a buffer, with a newline appended.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`).\n\nFor more information, see [`write!`]. For information on the format string syntax, see\n[`std::fmt`].\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\nuse std::io::{Write, Result};\n\nfn main() -> Result<()> {\n let mut w = Vec::new();\n writeln!(&mut w)?;\n writeln!(&mut w, \"test\")?;\n writeln!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(&w[..], \"\\ntest\\nformatted arguments\\n\".as_bytes());\n Ok(())\n}\n```"},"filterText":"writeln!","insertTextFormat":2,"kind":3,"label":"writeln!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"writeln!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\nassert_eq!(a, b);\n\nassert_eq!(a, b, \"we are testing addition with {} and {}\", a, b);\n```"},"filterText":"assert_eq!","insertTextFormat":2,"kind":3,"label":"assert_eq!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"assert_eq!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! compile_error","documentation":{"kind":"markdown","value":"Causes compilation to fail with the given error message when encountered.\n\nThis macro should be used when a crate uses a conditional compilation strategy to provide\nbetter error messages for erroneous conditions. It's the compiler-level form of [`panic!`],\nbut emits an error during *compilation* rather than at *runtime*.\n\n# Examples\n\nTwo such examples are macros and `#[cfg]` environments.\n\nEmit a better compiler error if a macro is passed invalid values. Without the final branch,\nthe compiler would still emit an error, but the error's message would not mention the two\nvalid values.\n\n```rust\nmacro_rules! give_me_foo_or_bar {\n (foo) => {};\n (bar) => {};\n ($x:ident) => {\n compile_error!(\"This macro only accepts `foo` or `bar`\");\n }\n}\n\ngive_me_foo_or_bar!(neither);\n// ^ will fail at compile time with message \"This macro only accepts `foo` or `bar`\"\n```\n\nEmit a compiler error if one of a number of features isn't available.\n\n```rust\n#[cfg(not(any(feature = \"foo\", feature = \"bar\")))]\ncompile_error!(\"Either feature \\\"foo\\\" or \\\"bar\\\" must be enabled for this crate.\");\n```"},"filterText":"compile_error!","insertTextFormat":2,"kind":3,"label":"compile_error!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"compile_error!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! matches","documentation":{"kind":"markdown","value":"Returns whether the given expression matches any of the given patterns.\n\nLike in a `match` expression, the pattern can be optionally followed by `if`\nand a guard expression that has access to names bound by the pattern.\n\n# Examples\n\n```rust\nlet foo = 'f';\nassert!(matches!(foo, 'A'..='Z' | 'a'..='z'));\n\nlet bar = Some(4);\nassert!(matches!(bar, Some(x) if x > 2));\n```"},"filterText":"matches!","insertTextFormat":2,"kind":3,"label":"matches!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"matches!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format_args","documentation":{"kind":"markdown","value":"Constructs parameters for the other string-formatting macros.\n\nThis macro functions by taking a formatting string literal containing\n`{}` for each additional argument passed. `format_args!` prepares the\nadditional parameters to ensure the output can be interpreted as a string\nand canonicalizes the arguments into a single type. Any value that implements\nthe [`Display`] trait can be passed to `format_args!`, as can any\n[`Debug`] implementation be passed to a `{:?}` within the formatting string.\n\nThis macro produces a value of type [`fmt::Arguments`]. This value can be\npassed to the macros within [`std::fmt`] for performing useful redirection.\nAll other formatting macros ([`format!`], [`write!`], [`println!`], etc) are\nproxied through this one. `format_args!`, unlike its derived macros, avoids\nheap allocations.\n\nYou can use the [`fmt::Arguments`] value that `format_args!` returns\nin `Debug` and `Display` contexts as seen below. The example also shows\nthat `Debug` and `Display` format to the same thing: the interpolated\nformat string in `format_args!`.\n\n```rust\nlet debug = format!(\"{:?}\", format_args!(\"{} foo {:?}\", 1, 2));\nlet display = format!(\"{}\", format_args!(\"{} foo {:?}\", 1, 2));\nassert_eq!(\"1 foo 2\", display);\nassert_eq!(display, debug);\n```\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax, and further information.\n\n[`Display`]: crate::fmt::Display\n[`Debug`]: crate::fmt::Debug\n[`fmt::Arguments`]: crate::fmt::Arguments\n[`std::fmt`]: ../std/fmt/index.html\n[`format!`]: ../std/macro.format.html\n[`println!`]: ../std/macro.println.html\n\n# Examples\n\n```rust\nuse std::fmt;\n\nlet s = fmt::format(format_args!(\"hello {}\", \"world\"));\nassert_eq!(s, format!(\"hello {}\", \"world\"));\n```"},"filterText":"format_args!","insertTextFormat":2,"kind":3,"label":"format_args!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"format_args!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! is_x86_feature_detected","documentation":{"kind":"markdown","value":"A macro to test at *runtime* whether a CPU feature is available on\nx86/x86-64 platforms.\n\nThis macro is provided in the standard library and will detect at runtime\nwhether the specified CPU feature is detected. This does **not** resolve at\ncompile time unless the specified feature is already enabled for the entire\ncrate. Runtime detection currently relies mostly on the `cpuid` instruction.\n\nThis macro only takes one argument which is a string literal of the feature\nbeing tested for. The feature names supported are the lowercase versions of\nthe ones defined by Intel in [their documentation][docs].\n\n## Supported arguments\n\nThis macro supports the same names that `#[target_feature]` supports. Unlike\n`#[target_feature]`, however, this macro does not support names separated\nwith a comma. Instead testing for multiple features must be done through\nseparate macro invocations for now.\n\nSupported arguments are:\n\n* `\"aes\"`\n* `\"pclmulqdq\"`\n* `\"rdrand\"`\n* `\"rdseed\"`\n* `\"tsc\"`\n* `\"mmx\"`\n* `\"sse\"`\n* `\"sse2\"`\n* `\"sse3\"`\n* `\"ssse3\"`\n* `\"sse4.1\"`\n* `\"sse4.2\"`\n* `\"sse4a\"`\n* `\"sha\"`\n* `\"avx\"`\n* `\"avx2\"`\n* `\"avx512f\"`\n* `\"avx512cd\"`\n* `\"avx512er\"`\n* `\"avx512pf\"`\n* `\"avx512bw\"`\n* `\"avx512dq\"`\n* `\"avx512vl\"`\n* `\"avx512ifma\"`\n* `\"avx512vbmi\"`\n* `\"avx512vpopcntdq\"`\n* `\"avx512vbmi2\"`\n* `\"gfni\"`\n* `\"vaes\"`\n* `\"vpclmulqdq\"`\n* `\"avx512vnni\"`\n* `\"avx512bitalg\"`\n* `\"avx512bf16\"`\n* `\"avx512vp2intersect\"`\n* `\"f16c\"`\n* `\"fma\"`\n* `\"bmi1\"`\n* `\"bmi2\"`\n* `\"abm\"`\n* `\"lzcnt\"`\n* `\"tbm\"`\n* `\"popcnt\"`\n* `\"fxsr\"`\n* `\"xsave\"`\n* `\"xsaveopt\"`\n* `\"xsaves\"`\n* `\"xsavec\"`\n* `\"cmpxchg16b\"`\n* `\"adx\"`\n* `\"rtm\"`\n* `\"movbe\"`\n* `\"ermsb\"`\n\n[docs]: https://software.intel.com/sites/landingpage/IntrinsicsGuide"},"filterText":"is_x86_feature_detected!","insertTextFormat":2,"kind":3,"label":"is_x86_feature_detected!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"is_x86_feature_detected!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat_bytes","documentation":{"kind":"markdown","value":"Concatenates literals into a byte slice.\n\nThis macro takes any number of comma-separated literals, and concatenates them all into\none, yielding an expression of type `&[u8; _]`, which represents all of the literals\nconcatenated left-to-right. The literals passed can be any combination of:\n\n- byte literals (`b'r'`)\n- byte strings (`b\"Rust\"`)\n- arrays of bytes/numbers (`[b'A', 66, b'C']`)\n\n# Examples\n\n```rust\n#![feature(concat_bytes)]\n\nlet s: &[u8; 6] = concat_bytes!(b'A', b\"BC\", [68, b'E', 70]);\nassert_eq!(s, b\"ABCDEF\");\n```"},"filterText":"concat_bytes!","insertTextFormat":2,"kind":3,"label":"concat_bytes!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"concat_bytes!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! eprint","documentation":{"kind":"markdown","value":"Prints to the standard error.\n\nEquivalent to the [`print!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`print!`] for\nexample usage.\n\nUse `eprint!` only for error and progress messages. Use `print!`\ninstead for the primary output of your program.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprint!(\"Error: Could not complete task\");\n```"},"filterText":"eprint!","insertTextFormat":2,"kind":3,"label":"eprint!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"eprint!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_ne!`], `debug_assert_ne!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_ne!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_ne!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_ne!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\ndebug_assert_ne!(a, b);\n```"},"filterText":"debug_assert_ne!","insertTextFormat":2,"kind":3,"label":"debug_assert_ne!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert_ne!($0)","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust Standard Library\n\nThe Rust Standard Library is the foundation of portable Rust software, a\nset of minimal and battle-tested shared abstractions for the [broader Rust\necosystem][crates.io]. It offers core types, like [`Vec`] and\n[`Option`], library-defined [operations on language\nprimitives](#primitives), [standard macros](#macros), [I/O] and\n[multithreading], among [many other things][other].\n\n`std` is available to all Rust crates by default. Therefore, the\nstandard library can be accessed in [`use`] statements through the path\n`std`, as in [`use std::env`].\n\n# How to read this documentation\n\nIf you already know the name of what you are looking for, the fastest way to\nfind it is to use the search\nbar at the top of the page.\n\nOtherwise, you may want to jump to one of these useful sections:\n\n* [`std::*` modules](#modules)\n* [Primitive types](#primitives)\n* [Standard macros](#macros)\n* [The Rust Prelude]\n\nIf this is your first time, the documentation for the standard library is\nwritten to be casually perused. Clicking on interesting things should\ngenerally lead you to interesting places. Still, there are important bits\nyou don't want to miss, so read on for a tour of the standard library and\nits documentation!\n\nOnce you are familiar with the contents of the standard library you may\nbegin to find the verbosity of the prose distracting. At this stage in your\ndevelopment you may want to press the `[-]` button near the top of the\npage to collapse it into a more skimmable view.\n\nWhile you are looking at that `[-]` button also notice the `source`\nlink. Rust's API documentation comes with the source code and you are\nencouraged to read it. The standard library source is generally high\nquality and a peek behind the curtains is often enlightening.\n\n# What is in the standard library documentation?\n\nFirst of all, The Rust Standard Library is divided into a number of focused\nmodules, [all listed further down this page](#modules). These modules are\nthe bedrock upon which all of Rust is forged, and they have mighty names\nlike [`std::slice`] and [`std::cmp`]. Modules' documentation typically\nincludes an overview of the module along with examples, and are a smart\nplace to start familiarizing yourself with the library.\n\nSecond, implicit methods on [primitive types] are documented here. This can\nbe a source of confusion for two reasons:\n\n1. While primitives are implemented by the compiler, the standard library\n implements methods directly on the primitive types (and it is the only\n library that does so), which are [documented in the section on\n primitives](#primitives).\n2. The standard library exports many modules *with the same name as\n primitive types*. These define additional items related to the primitive\n type, but not the all-important methods.\n\nSo for example there is a [page for the primitive type\n`i32`](primitive::i32) that lists all the methods that can be called on\n32-bit integers (very useful), and there is a [page for the module\n`std::i32`] that documents the constant values [`MIN`] and [`MAX`] (rarely\nuseful).\n\nNote the documentation for the primitives [`str`] and [`[T]`][prim@slice] (also\ncalled 'slice'). Many method calls on [`String`] and [`Vec`] are actually\ncalls to methods on [`str`] and [`[T]`][prim@slice] respectively, via [deref\ncoercions][deref-coercions].\n\nThird, the standard library defines [The Rust Prelude], a small collection\nof items - mostly traits - that are imported into every module of every\ncrate. The traits in the prelude are pervasive, making the prelude\ndocumentation a good entry point to learning about the library.\n\nAnd finally, the standard library exports a number of standard macros, and\n[lists them on this page](#macros) (technically, not all of the standard\nmacros are defined by the standard library - some are defined by the\ncompiler - but they are documented here the same). Like the prelude, the\nstandard macros are imported by default into all crates.\n\n# Contributing changes to the documentation\n\nCheck out the rust contribution guidelines [here](\nhttps://rustc-dev-guide.rust-lang.org/contributing.html#writing-documentation).\nThe source for this documentation can be found on\n[GitHub](https://github.com/rust-lang/rust).\nTo contribute changes, make sure you read the guidelines first, then submit\npull-requests for your suggested changes.\n\nContributions are appreciated! If you see a part of the docs that can be\nimproved, submit a PR, or chat with us first on [Discord][rust-discord]\n#docs.\n\n# A Tour of The Rust Standard Library\n\nThe rest of this crate documentation is dedicated to pointing out notable\nfeatures of The Rust Standard Library.\n\n## Containers and collections\n\nThe [`option`] and [`result`] modules define optional and error-handling\ntypes, [`Option`] and [`Result`]. The [`iter`] module defines\nRust's iterator trait, [`Iterator`], which works with the [`for`] loop to\naccess collections.\n\nThe standard library exposes three common ways to deal with contiguous\nregions of memory:\n\n* [`Vec`] - A heap-allocated *vector* that is resizable at runtime.\n* [`[T; N]`][prim@array] - An inline *array* with a fixed size at compile time.\n* [`[T]`][prim@slice] - A dynamically sized *slice* into any other kind of contiguous\n storage, whether heap-allocated or not.\n\nSlices can only be handled through some kind of *pointer*, and as such come\nin many flavors such as:\n\n* `&[T]` - *shared slice*\n* `&mut [T]` - *mutable slice*\n* [`Box<[T]>`][owned slice] - *owned slice*\n\n[`str`], a UTF-8 string slice, is a primitive type, and the standard library\ndefines many methods for it. Rust [`str`]s are typically accessed as\nimmutable references: `&str`. Use the owned [`String`] for building and\nmutating strings.\n\nFor converting to strings use the [`format!`] macro, and for converting from\nstrings use the [`FromStr`] trait.\n\nData may be shared by placing it in a reference-counted box or the [`Rc`]\ntype, and if further contained in a [`Cell`] or [`RefCell`], may be mutated\nas well as shared. Likewise, in a concurrent setting it is common to pair an\natomically-reference-counted box, [`Arc`], with a [`Mutex`] to get the same\neffect.\n\nThe [`collections`] module defines maps, sets, linked lists and other\ntypical collection types, including the common [`HashMap`].\n\n## Platform abstractions and I/O\n\nBesides basic data types, the standard library is largely concerned with\nabstracting over differences in common platforms, most notably Windows and\nUnix derivatives.\n\nCommon types of I/O, including [files], [TCP], and [UDP], are defined in\nthe [`io`], [`fs`], and [`net`] modules.\n\nThe [`thread`] module contains Rust's threading abstractions. [`sync`]\ncontains further primitive shared memory types, including [`atomic`] and\n[`mpsc`], which contains the channel types for message passing.\n\n# Use before and after `main()`\n\nMany parts of the standard library are expected to work before and after `main()`;\nbut this is not guaranteed or ensured by tests. It is recommended that you write your own tests\nand run them on each platform you wish to support.\nThis means that use of `std` before/after main, especially of features that interact with the\nOS or global state, is exempted from stability and portability guarantees and instead only\nprovided on a best-effort basis. Nevertheless bug reports are appreciated.\n\nOn the other hand `core` and `alloc` are most likely to work in such environments with\nthe caveat that any hookable behavior such as panics, oom handling or allocators will also\ndepend on the compatibility of the hooks.\n\nSome features may also behave differently outside main, e.g. stdio could become unbuffered,\nsome panics might turn into aborts, backtraces might not get symbolicated or similar.\n\nNon-exhaustive list of known limitations:\n\n- after-main use of thread-locals, which also affects additional features:\n - [`thread::current()`]\n - [`thread::scope()`]\n - [`sync::mpsc`]\n- before-main stdio file descriptors are not guaranteed to be open on unix platforms\n\n\n[I/O]: io\n[`MIN`]: i32::MIN\n[`MAX`]: i32::MAX\n[page for the module `std::i32`]: crate::i32\n[TCP]: net::TcpStream\n[The Rust Prelude]: prelude\n[UDP]: net::UdpSocket\n[`Arc`]: sync::Arc\n[owned slice]: boxed\n[`Cell`]: cell::Cell\n[`FromStr`]: str::FromStr\n[`HashMap`]: collections::HashMap\n[`Mutex`]: sync::Mutex\n[`Option`]: option::Option\n[`Rc`]: rc::Rc\n[`RefCell`]: cell::RefCell\n[`Result`]: result::Result\n[`Vec`]: vec::Vec\n[`atomic`]: sync::atomic\n[`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for\n[`str`]: prim@str\n[`mpsc`]: sync::mpsc\n[`std::cmp`]: cmp\n[`std::slice`]: mod@slice\n[`use std::env`]: env/index.html\n[`use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html\n[crates.io]: https://crates.io\n[deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods\n[files]: fs::File\n[multithreading]: thread\n[other]: #what-is-in-the-standard-library-documentation\n[primitive types]: ../book/ch03-02-data-types.html\n[rust-discord]: https://discord.gg/rust-lang\n[array]: prim@array\n[slice]: prim@slice"},"filterText":"std","kind":9,"label":"std","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"std","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust core allocation and collections library\n\nThis library provides smart pointers and collections for managing\nheap-allocated values.\n\nThis library, like core, normally doesn’t need to be used directly\nsince its contents are re-exported in the [`std` crate](../std/index.html).\nCrates that use the `#![no_std]` attribute however will typically\nnot depend on `std`, so they’d use this crate instead.\n\n## Boxed values\n\nThe [`Box`] type is a smart pointer type. There can only be one owner of a\n[`Box`], and the owner can decide to mutate the contents, which live on the\nheap.\n\nThis type can be sent among threads efficiently as the size of a `Box` value\nis the same as that of a pointer. Tree-like data structures are often built\nwith boxes because each node often has only one owner, the parent.\n\n## Reference counted pointers\n\nThe [`Rc`] type is a non-threadsafe reference-counted pointer type intended\nfor sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and\nonly allows access to `&T`, a shared reference.\n\nThis type is useful when inherited mutability (such as using [`Box`]) is too\nconstraining for an application, and is often paired with the [`Cell`] or\n[`RefCell`] types in order to allow mutation.\n\n## Atomically reference counted pointers\n\nThe [`Arc`] type is the threadsafe equivalent of the [`Rc`] type. It\nprovides all the same functionality of [`Rc`], except it requires that the\ncontained type `T` is shareable. Additionally, [`Arc`][`Arc`] is itself\nsendable while [`Rc`][`Rc`] is not.\n\nThis type allows for shared access to the contained data, and is often\npaired with synchronization primitives such as mutexes to allow mutation of\nshared resources.\n\n## Collections\n\nImplementations of the most common general purpose data structures are\ndefined in this library. They are re-exported through the\n[standard collections library](../std/collections/index.html).\n\n## Heap interfaces\n\nThe [`alloc`](alloc/index.html) module defines the low-level interface to the\ndefault global allocator. It is not compatible with the libc allocator API.\n\n[`Arc`]: sync\n[`Box`]: boxed\n[`Cell`]: core::cell\n[`Rc`]: rc\n[`RefCell`]: core::cell"},"filterText":"alloc","kind":9,"label":"alloc","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"alloc","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust Core Library\n\nThe Rust Core Library is the dependency-free[^free] foundation of [The\nRust Standard Library](../std/index.html). It is the portable glue\nbetween the language and its libraries, defining the intrinsic and\nprimitive building blocks of all Rust code. It links to no\nupstream libraries, no system libraries, and no libc.\n\n[^free]: Strictly speaking, there are some symbols which are needed but\n they aren't always necessary.\n\nThe core library is *minimal*: it isn't even aware of heap allocation,\nnor does it provide concurrency or I/O. These things require\nplatform integration, and this library is platform-agnostic.\n\n# How to use the core library\n\nPlease note that all of these details are currently not considered stable.\n\nThis library is built on the assumption of a few existing symbols:\n\n* `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines\n which are generated by Rust codegen backends. Additionally, this library can make explicit\n calls to `strlen`. Their signatures are the same as found in C, but there are extra\n assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if\n the `n` parameter is 0, the function is assumed to not be UB, even if the pointers are NULL or\n dangling. (Note that making extra assumptions about these functions is common among compilers:\n [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)\n These functions are often provided by the system libc, but can also be provided by the\n [compiler-builtins crate](https://crates.io/crates/compiler_builtins).\n Note that the library does not guarantee that it will always make these assumptions, so Rust\n user code directly calling the C functions should follow the C specification! The advice for\n Rust user code is to call the functions provided by this library instead (such as\n `ptr::copy`).\n\n* `rust_begin_panic` - This function takes four arguments, a\n `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments\n dictate the panic message, the file at which panic was invoked, and the\n line and column inside the file. It is up to consumers of this core\n library to define this panic function; it is only required to never\n return. This requires a `lang` attribute named `panic_impl`.\n\n* `rust_eh_personality` - is used by the failure mechanisms of the\n compiler. This is often mapped to GCC's personality function, but crates\n which do not trigger a panic can be assured that this function is never\n called. The `lang` attribute is called `eh_personality`."},"filterText":"core","kind":9,"label":"core","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"core","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u32","kind":22,"label":"u32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"u32","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"bool","kind":22,"label":"bool","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"bool","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u8","kind":22,"label":"u8","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"u8","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"isize","kind":22,"label":"isize","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"isize","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u16","kind":22,"label":"u16","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"u16","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u64","kind":22,"label":"u64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"u64","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u128","kind":22,"label":"u128","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"u128","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"f32","kind":22,"label":"f32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"f32","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i128","kind":22,"label":"i128","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"i128","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i16","kind":22,"label":"i16","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"i16","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"str","kind":22,"label":"str","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"str","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i64","kind":22,"label":"i64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"i64","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"char","kind":22,"label":"char","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"char","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"f64","kind":22,"label":"f64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"f64","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i32","kind":22,"label":"i32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"i32","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i8","kind":22,"label":"i8","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"i8","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"usize","kind":22,"label":"usize","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"usize","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do a cheap mutable-to-mutable reference conversion.\n\nThis trait is similar to [`AsRef`] but used for converting between mutable\nreferences. If you need to do a costly conversion it is better to\nimplement [`From`] with type `&mut T` or write a custom function.\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsMut` auto-dereferences if the inner type is a mutable reference\n(e.g.: `foo.as_mut()` will work the same if `foo` has type `&mut Foo` or `&mut &mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[mutably dereferenceable types], e.g. `foo.as_mut()` will *not* work the same as\n`Box::new(foo).as_mut()`. Instead, many smart pointers provide an `as_mut` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsMut::as_mut`] should not be\nused for the sole purpose of mutable dereferencing; instead ['`Deref` coercion'] can be used:\n\n[mutably dereferenceable types]: core::ops::DerefMut\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::DerefMut#mutable-deref-coercion\n\n```rust\nlet mut x = Box::new(5i32);\n// Avoid this:\n// let y: &mut i32 = x.as_mut();\n// Better just write:\nlet y: &mut i32 = &mut x;\n```\n\nTypes which implement [`DerefMut`] should consider to add an implementation of `AsMut` as\nfollows:\n\n[`DerefMut`]: core::ops::DerefMut\n\n```rust\nimpl AsMut for SomeType\nwhere\n ::Target: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.deref_mut().as_mut()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsMut` would be reflexive, i.e. there would be an `impl AsMut for T`\nwith [`as_mut`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&mut T where T: AsMut` which allows `AsMut` to auto-dereference, see \"Generic\nImplementations\" above).\n\n[`as_mut`]: AsMut::as_mut\n\nA trivial implementation of `AsMut for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nUsing `AsMut` as trait bound for a generic function, we can accept all mutable references that\ncan be converted to type `&mut T`. Unlike [dereference], which has a single [target type],\nthere can be multiple implementations of `AsMut` for a type. In particular, `Vec` implements\nboth `AsMut>` and `AsMut<[T]>`.\n\nIn the following, the example functions `caesar` and `null_terminate` provide a generic\ninterface which work with any type that can be converted by cheap mutable-to-mutable conversion\ninto a byte slice (`[u8]`) or byte vector (`Vec`), respectively.\n\n[dereference]: core::ops::DerefMut\n[target type]: core::ops::Deref::Target\n\n```rust\nstruct Document {\n info: String,\n content: Vec,\n}\n\nimpl AsMut for Document\nwhere\n Vec: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.content.as_mut()\n }\n}\n\nfn caesar>(data: &mut T, key: u8) {\n for byte in data.as_mut() {\n *byte = byte.wrapping_add(key);\n }\n}\n\nfn null_terminate>>(data: &mut T) {\n // Using a non-generic inner function, which contains most of the\n // functionality, helps to minimize monomorphization overhead.\n fn doit(data: &mut Vec) {\n let len = data.len();\n if len == 0 || data[len-1] != 0 {\n data.push(0);\n }\n }\n doit(data.as_mut());\n}\n\nfn main() {\n let mut v: Vec = vec![1, 2, 3];\n caesar(&mut v, 5);\n assert_eq!(v, [6, 7, 8]);\n null_terminate(&mut v);\n assert_eq!(v, [6, 7, 8, 0]);\n let mut doc = Document {\n info: String::from(\"Example\"),\n content: vec![17, 19, 8],\n };\n caesar(&mut doc, 1);\n assert_eq!(doc.content, [18, 20, 9]);\n null_terminate(&mut doc);\n assert_eq!(doc.content, [18, 20, 9, 0]);\n}\n```\n\nNote, however, that APIs don't need to be generic. In many cases taking a `&mut [u8]` or\n`&mut Vec`, for example, is the better choice (callers need to pass the correct type then)."},"filterText":"AsMut","kind":8,"label":"AsMut","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"AsMut","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do a cheap reference-to-reference conversion.\n\nThis trait is similar to [`AsMut`] which is used for converting between mutable references.\nIf you need to do a costly conversion it is better to implement [`From`] with type\n`&T` or write a custom function.\n\n# Relation to `Borrow`\n\n`AsRef` has the same signature as [`Borrow`], but [`Borrow`] is different in a few aspects:\n\n- Unlike `AsRef`, [`Borrow`] has a blanket impl for any `T`, and can be used to accept either\n a reference or a value. (See also note on `AsRef`'s reflexibility below.)\n- [`Borrow`] also requires that [`Hash`], [`Eq`] and [`Ord`] for a borrowed value are\n equivalent to those of the owned value. For this reason, if you want to\n borrow only a single field of a struct you can implement `AsRef`, but not [`Borrow`].\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsRef` auto-dereferences if the inner type is a reference or a mutable reference\n(e.g.: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[dereferenceable types], e.g. `foo.as_ref()` will *not* work the same as\n`Box::new(foo).as_ref()`. Instead, many smart pointers provide an `as_ref` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsRef::as_ref`] should not be\nused for the sole purpose of dereferencing; instead ['`Deref` coercion'] can be used:\n\n[dereferenceable types]: core::ops::Deref\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::Deref#deref-coercion\n\n```rust\nlet x = Box::new(5i32);\n// Avoid this:\n// let y: &i32 = x.as_ref();\n// Better just write:\nlet y: &i32 = &x;\n```\n\nTypes which implement [`Deref`] should consider implementing `AsRef` as follows:\n\n[`Deref`]: core::ops::Deref\n\n```rust\nimpl AsRef for SomeType\nwhere\n T: ?Sized,\n ::Target: AsRef,\n{\n fn as_ref(&self) -> &T {\n self.deref().as_ref()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsRef` would be reflexive, i.e. there would be an `impl AsRef for T`\nwith [`as_ref`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&T where T: AsRef` which allows `AsRef` to auto-dereference, see \"Generic Implementations\"\nabove).\n\n[`as_ref`]: AsRef::as_ref\n\nA trivial implementation of `AsRef for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nBy using trait bounds we can accept arguments of different types as long as they can be\nconverted to the specified type `T`.\n\nFor example: By creating a generic function that takes an `AsRef` we express that we\nwant to accept all references that can be converted to [`&str`] as an argument.\nSince both [`String`] and [`&str`] implement `AsRef` we can accept both as input argument.\n\n[`&str`]: primitive@str\n[`Borrow`]: crate::borrow::Borrow\n[`Eq`]: crate::cmp::Eq\n[`Ord`]: crate::cmp::Ord\n[`String`]: ../../std/string/struct.String.html\n\n```rust\nfn is_hello>(s: T) {\n assert_eq!(\"hello\", s.as_ref());\n}\n\nlet s = \"hello\";\nis_hello(s);\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```"},"filterText":"AsRef","kind":8,"label":"AsRef","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"AsRef","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A pointer type that uniquely owns a heap allocation of type `T`.\n\nSee the [module-level documentation](../../std/boxed/index.html) for more."},"filterText":"Box","kind":22,"label":"Box","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Box","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A common trait for the ability to explicitly duplicate an object.\n\nDiffers from [`Copy`] in that [`Copy`] is implicit and an inexpensive bit-wise copy, while\n`Clone` is always explicit and may or may not be expensive. In order to enforce\nthese characteristics, Rust does not allow you to reimplement [`Copy`], but you\nmay reimplement `Clone` and run arbitrary code.\n\nSince `Clone` is more general than [`Copy`], you can automatically make anything\n[`Copy`] be `Clone` as well.\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d\nimplementation of [`Clone`] calls [`clone`] on each field.\n\n[`clone`]: Clone::clone\n\nFor a generic struct, `#[derive]` implements `Clone` conditionally by adding bound `Clone` on\ngeneric parameters.\n\n```rust\n// `derive` implements Clone for Reading when T is Clone.\n#[derive(Clone)]\nstruct Reading {\n frequency: T,\n}\n```\n\n## How can I implement `Clone`?\n\nTypes that are [`Copy`] should have a trivial implementation of `Clone`. More formally:\nif `T: Copy`, `x: T`, and `y: &T`, then `let x = y.clone();` is equivalent to `let x = *y;`.\nManual implementations should be careful to uphold this invariant; however, unsafe code\nmust not rely on it to ensure memory safety.\n\nAn example is a generic struct holding a function pointer. In this case, the\nimplementation of `Clone` cannot be `derive`d, but can be implemented as:\n\n```rust\nstruct Generate(fn() -> T);\n\nimpl Copy for Generate {}\n\nimpl Clone for Generate {\n fn clone(&self) -> Self {\n *self\n }\n}\n```\n\nIf we `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n```\n\nthe auto-derived implementations will have unnecessary `T: Copy` and `T: Clone` bounds:\n\n```rust\n\n// Automatically derived\nimpl Copy for Generate { }\n\n// Automatically derived\nimpl Clone for Generate {\n fn clone(&self) -> Generate {\n Generate(Clone::clone(&self.0))\n }\n}\n```\n\nThe bounds are unnecessary because clearly the function itself should be\ncopy- and cloneable even if its return type is not:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n\nstruct NotCloneable;\n\nfn generate_not_cloneable() -> NotCloneable {\n NotCloneable\n}\n\nGenerate(generate_not_cloneable).clone(); // error: trait bounds were not satisfied\n// Note: With the manual implementations the above line will compile.\n```\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Clone`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Clone` themselves.\n Note that variables captured by shared reference always implement `Clone`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Clone`.\n\n[impls]: #implementors"},"filterText":"Clone","kind":8,"label":"Clone","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Clone","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Types whose values can be duplicated simply by copying bits.\n\nBy default, variable bindings have 'move semantics.' In other\nwords:\n\n```rust\n#[derive(Debug)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `x` has moved into `y`, and so cannot be used\n\n// println!(\"{x:?}\"); // error: use of moved value\n```\n\nHowever, if a type implements `Copy`, it instead has 'copy semantics':\n\n```rust\n// We can derive a `Copy` implementation. `Clone` is also required, as it's\n// a supertrait of `Copy`.\n#[derive(Debug, Copy, Clone)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `y` is a copy of `x`\n\nprintln!(\"{x:?}\"); // A-OK!\n```\n\nIt's important to note that in these two examples, the only difference is whether you\nare allowed to access `x` after the assignment. Under the hood, both a copy and a move\ncan result in bits being copied in memory, although this is sometimes optimized away.\n\n## How can I implement `Copy`?\n\nThere are two ways to implement `Copy` on your type. The simplest is to use `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct MyStruct;\n```\n\nYou can also implement `Copy` and `Clone` manually:\n\n```rust\nstruct MyStruct;\n\nimpl Copy for MyStruct { }\n\nimpl Clone for MyStruct {\n fn clone(&self) -> MyStruct {\n *self\n }\n}\n```\n\nThere is a small difference between the two: the `derive` strategy will also place a `Copy`\nbound on type parameters, which isn't always desired.\n\n## What's the difference between `Copy` and `Clone`?\n\nCopies happen implicitly, for example as part of an assignment `y = x`. The behavior of\n`Copy` is not overloadable; it is always a simple bit-wise copy.\n\nCloning is an explicit action, `x.clone()`. The implementation of [`Clone`] can\nprovide any type-specific behavior necessary to duplicate values safely. For example,\nthe implementation of [`Clone`] for [`String`] needs to copy the pointed-to string\nbuffer in the heap. A simple bitwise copy of [`String`] values would merely copy the\npointer, leading to a double free down the line. For this reason, [`String`] is [`Clone`]\nbut not `Copy`.\n\n[`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement\n[`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`\n(see the example above).\n\n## When can my type be `Copy`?\n\nA type can implement `Copy` if all of its components implement `Copy`. For example, this\nstruct can be `Copy`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Point {\n x: i32,\n y: i32,\n}\n```\n\nA struct can be `Copy`, and [`i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.\nBy contrast, consider\n\n```rust\nstruct PointList {\n points: Vec,\n}\n```\n\nThe struct `PointList` cannot implement `Copy`, because [`Vec`] is not `Copy`. If we\nattempt to derive a `Copy` implementation, we'll get an error:\n\n```text\nthe trait `Copy` cannot be implemented for this type; field `points` does not implement `Copy`\n```\n\nShared references (`&T`) are also `Copy`, so a type can be `Copy`, even when it holds\nshared references of types `T` that are *not* `Copy`. Consider the following struct,\nwhich can implement `Copy`, because it only holds a *shared reference* to our non-`Copy`\ntype `PointList` from above:\n\n```rust\n#[derive(Copy, Clone)]\nstruct PointListWrapper<'a> {\n point_list_ref: &'a PointList,\n}\n```\n\n## When *can't* my type be `Copy`?\n\nSome types can't be copied safely. For example, copying `&mut T` would create an aliased\nmutable reference. Copying [`String`] would duplicate responsibility for managing the\n[`String`]'s buffer, leading to a double free.\n\nGeneralizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's\nmanaging some resource besides its own [`size_of::`] bytes.\n\nIf you try to implement `Copy` on a struct or enum containing non-`Copy` data, you will get\nthe error [E0204].\n\n[E0204]: ../../error_codes/E0204.html\n\n## When *should* my type be `Copy`?\n\nGenerally speaking, if your type _can_ implement `Copy`, it should. Keep in mind, though,\nthat implementing `Copy` is part of the public API of your type. If the type might become\nnon-`Copy` in the future, it could be prudent to omit the `Copy` implementation now, to\navoid a breaking API change.\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Copy`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Copy` themselves.\n Note that variables captured by shared reference always implement `Copy`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Copy`.\n\n[`Vec`]: ../../std/vec/struct.Vec.html\n[`String`]: ../../std/string/struct.String.html\n[`size_of::`]: crate::mem::size_of\n[impls]: #implementors"},"filterText":"Copy","kind":8,"label":"Copy","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Copy","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for giving a type a useful default value.\n\nSometimes, you want to fall back to some kind of default value, and\ndon't particularly care what it is. This comes up often with `struct`s\nthat define a set of options:\n\n```rust\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```\n\nHow can we define some default values? You can use `Default`:\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n\nfn main() {\n let options: SomeOptions = Default::default();\n}\n```\n\nNow, you get all of the default values. Rust implements `Default` for various primitives types.\n\nIf you want to override a particular option, but still retain the other defaults:\n\n```rust\nfn main() {\n let options = SomeOptions { foo: 42, ..Default::default() };\n}\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all of the type's fields implement\n`Default`. When `derive`d, it will use the default value for each field's type.\n\n### `enum`s\n\nWhen using `#[derive(Default)]` on an `enum`, you need to choose which unit variant will be\ndefault. You do this by placing the `#[default]` attribute on the variant.\n\n```rust\n#[derive(Default)]\nenum Kind {\n #[default]\n A,\n B,\n C,\n}\n```\n\nYou cannot use the `#[default]` attribute on non-unit or non-exhaustive variants.\n\n## How can I implement `Default`?\n\nProvide an implementation for the `default()` method that returns the value of\nyour type that should be the default:\n\n```rust\nenum Kind {\n A,\n B,\n C,\n}\n\nimpl Default for Kind {\n fn default() -> Self { Kind::A }\n}\n```\n\n# Examples\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```"},"filterText":"Default","kind":8,"label":"Default","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Default","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An iterator able to yield elements from both ends.\n\nSomething that implements `DoubleEndedIterator` has one extra capability\nover something that implements [`Iterator`]: the ability to also take\n`Item`s from the back, as well as the front.\n\nIt is important to note that both back and forth work on the same range,\nand do not cross: iteration is over when they meet in the middle.\n\nIn a similar fashion to the [`Iterator`] protocol, once a\n`DoubleEndedIterator` returns [`None`] from a [`next_back()`], calling it\nagain may or may not ever return [`Some`] again. [`next()`] and\n[`next_back()`] are interchangeable for this purpose.\n\n[`next_back()`]: DoubleEndedIterator::next_back\n[`next()`]: Iterator::next\n\n# Examples\n\nBasic usage:\n\n```rust\nlet numbers = vec![1, 2, 3, 4, 5, 6];\n\nlet mut iter = numbers.iter();\n\nassert_eq!(Some(&1), iter.next());\nassert_eq!(Some(&6), iter.next_back());\nassert_eq!(Some(&5), iter.next_back());\nassert_eq!(Some(&2), iter.next());\nassert_eq!(Some(&3), iter.next());\nassert_eq!(Some(&4), iter.next());\nassert_eq!(None, iter.next());\nassert_eq!(None, iter.next_back());\n```"},"filterText":"DoubleEndedIterator","kind":8,"label":"DoubleEndedIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"DoubleEndedIterator","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Custom code within the destructor.\n\nWhen a value is no longer needed, Rust will run a \"destructor\" on that value.\nThe most common way that a value is no longer needed is when it goes out of\nscope. Destructors may still run in other circumstances, but we're going to\nfocus on scope for the examples here. To learn about some of those other cases,\nplease see [the reference] section on destructors.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\nThis destructor consists of two components:\n- A call to `Drop::drop` for that value, if this special `Drop` trait is implemented for its type.\n- The automatically generated \"drop glue\" which recursively calls the destructors\n of all the fields of this value.\n\nAs Rust automatically calls the destructors of all contained fields,\nyou don't have to implement `Drop` in most cases. But there are some cases where\nit is useful, for example for types which directly manage a resource.\nThat resource may be memory, it may be a file descriptor, it may be a network socket.\nOnce a value of that type is no longer going to be used, it should \"clean up\" its\nresource by freeing the memory or closing the file or socket. This is\nthe job of a destructor, and therefore the job of `Drop::drop`.\n\n## Examples\n\nTo see destructors in action, let's take a look at the following program:\n\n```rust\nstruct HasDrop;\n\nimpl Drop for HasDrop {\n fn drop(&mut self) {\n println!(\"Dropping HasDrop!\");\n }\n}\n\nstruct HasTwoDrops {\n one: HasDrop,\n two: HasDrop,\n}\n\nimpl Drop for HasTwoDrops {\n fn drop(&mut self) {\n println!(\"Dropping HasTwoDrops!\");\n }\n}\n\nfn main() {\n let _x = HasTwoDrops { one: HasDrop, two: HasDrop };\n println!(\"Running!\");\n}\n```\n\nRust will first call `Drop::drop` for `_x` and then for both `_x.one` and `_x.two`,\nmeaning that running this will print\n\n```text\nRunning!\nDropping HasTwoDrops!\nDropping HasDrop!\nDropping HasDrop!\n```\n\nEven if we remove the implementation of `Drop` for `HasTwoDrop`, the destructors of its fields are still called.\nThis would result in\n\n```test\nRunning!\nDropping HasDrop!\nDropping HasDrop!\n```\n\n## You cannot call `Drop::drop` yourself\n\nBecause `Drop::drop` is used to clean up a value, it may be dangerous to use this value after\nthe method has been called. As `Drop::drop` does not take ownership of its input,\nRust prevents misuse by not allowing you to call `Drop::drop` directly.\n\nIn other words, if you tried to explicitly call `Drop::drop` in the above example, you'd get a compiler error.\n\nIf you'd like to explicitly call the destructor of a value, [`mem::drop`] can be used instead.\n\n[`mem::drop`]: drop\n\n## Drop order\n\nWhich of our two `HasDrop` drops first, though? For structs, it's the same\norder that they're declared: first `one`, then `two`. If you'd like to try\nthis yourself, you can modify `HasDrop` above to contain some data, like an\ninteger, and then use it in the `println!` inside of `Drop`. This behavior is\nguaranteed by the language.\n\nUnlike for structs, local variables are dropped in reverse order:\n\n```rust\nstruct Foo;\n\nimpl Drop for Foo {\n fn drop(&mut self) {\n println!(\"Dropping Foo!\")\n }\n}\n\nstruct Bar;\n\nimpl Drop for Bar {\n fn drop(&mut self) {\n println!(\"Dropping Bar!\")\n }\n}\n\nfn main() {\n let _foo = Foo;\n let _bar = Bar;\n}\n```\n\nThis will print\n\n```text\nDropping Bar!\nDropping Foo!\n```\n\nPlease see [the reference] for the full rules.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\n## `Copy` and `Drop` are exclusive\n\nYou cannot implement both [`Copy`] and `Drop` on the same type. Types that\nare `Copy` get implicitly duplicated by the compiler, making it very\nhard to predict when, and how often destructors will be executed. As such,\nthese types cannot have destructors.\n\n## Drop check\n\nDropping interacts with the borrow checker in subtle ways: when a type `T` is being implicitly\ndropped as some variable of this type goes out of scope, the borrow checker needs to ensure that\ncalling `T`'s destructor at this moment is safe. In particular, it also needs to be safe to\nrecursively drop all the fields of `T`. For example, it is crucial that code like the following\nis being rejected:\n\n```rust\nuse std::cell::Cell;\n\nstruct S<'a>(Cell>>, Box);\nimpl Drop for S<'_> {\n fn drop(&mut self) {\n if let Some(r) = self.0.get() {\n // Print the contents of the `Box` in `r`.\n println!(\"{}\", r.1);\n }\n }\n}\n\nfn main() {\n // Set up two `S` that point to each other.\n let s1 = S(Cell::new(None), Box::new(42));\n let s2 = S(Cell::new(Some(&s1)), Box::new(42));\n s1.0.set(Some(&s2));\n // Now they both get dropped. But whichever is the 2nd one\n // to be dropped will access the `Box` in the first one,\n // which is a use-after-free!\n}\n```\n\nThe Nomicon discusses the need for [drop check in more detail][drop check].\n\nTo reject such code, the \"drop check\" analysis determines which types and lifetimes need to\nstill be live when `T` gets dropped. The exact details of this analysis are not yet\nstably guaranteed and **subject to change**. Currently, the analysis works as follows:\n- If `T` has no drop glue, then trivially nothing is required to be live. This is the case if\n neither `T` nor any of its (recursive) fields have a destructor (`impl Drop`). [`PhantomData`]\n and [`ManuallyDrop`] are considered to never have a destructor, no matter their field type.\n- If `T` has drop glue, then, for all types `U` that are *owned* by any field of `T`,\n recursively add the types and lifetimes that need to be live when `U` gets dropped. The set of\n owned types is determined by recursively traversing `T`:\n - Recursively descend through `PhantomData`, `Box`, tuples, and arrays (including arrays of\n length 0).\n - Stop at reference and raw pointer types as well as function pointers and function items;\n they do not own anything.\n - Stop at non-composite types (type parameters that remain generic in the current context and\n base types such as integers and `bool`); these types are owned.\n - When hitting an ADT with `impl Drop`, stop there; this type is owned.\n - When hitting an ADT without `impl Drop`, recursively descend to its fields. (For an `enum`,\n consider all fields of all variants.)\n- Furthermore, if `T` implements `Drop`, then all generic (lifetime and type) parameters of `T`\n must be live.\n\nIn the above example, the last clause implies that `'a` must be live when `S<'a>` is dropped,\nand hence the example is rejected. If we remove the `impl Drop`, the liveness requirement\ndisappears and the example is accepted.\n\nThere exists an unstable way for a type to opt-out of the last clause; this is called \"drop\ncheck eyepatch\" or `may_dangle`. For more details on this nightly-only feature, see the\n[discussion in the Nomicon][nomicon].\n\n[`ManuallyDrop`]: crate::mem::ManuallyDrop\n[`PhantomData`]: crate::marker::PhantomData\n[drop check]: ../../nomicon/dropck.html\n[nomicon]: ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standard-library-and-its-unstable-may_dangle"},"filterText":"Drop","kind":8,"label":"Drop","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Drop","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for comparisons corresponding to [equivalence relations](\nhttps://en.wikipedia.org/wiki/Equivalence_relation).\n\nThis means, that in addition to `a == b` and `a != b` being strict inverses,\nthe relation must be (for all `a`, `b` and `c`):\n\n- reflexive: `a == a`;\n- symmetric: `a == b` implies `b == a` (required by `PartialEq` as well); and\n- transitive: `a == b` and `b == c` implies `a == c` (required by `PartialEq` as well).\n\nThis property cannot be checked by the compiler, and therefore `Eq` implies\n[`PartialEq`], and has no extra methods.\n\nViolating this property is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\nImplement `Eq` in addition to `PartialEq` if it's guaranteed that\n`PartialEq::eq(a, a)` always returns `true` (reflexivity), in addition to\nthe symmetric and transitive properties already required by `PartialEq`.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d, because `Eq` has\nno extra methods, it is only informing the compiler that this is an\nequivalence relation rather than a partial equivalence relation. Note that\nthe `derive` strategy requires all fields are `Eq`, which isn't\nalways desired.\n\n## How can I implement `Eq`?\n\nIf you cannot use the `derive` strategy, specify that your type implements\n`Eq`, which has no methods:\n\n```rust\nenum BookFormat { Paperback, Hardback, Ebook }\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\nimpl Eq for Book {}\n```"},"filterText":"Eq","kind":8,"label":"Eq (alias ==, !=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Eq","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Err(E)","documentation":{"kind":"markdown","value":"Contains the error value"},"filterText":"Err()","insertTextFormat":2,"kind":20,"label":"Err(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Err(${1:()})$0","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An iterator that knows its exact length.\n\nMany [`Iterator`]s don't know how many times they will iterate, but some do.\nIf an iterator knows how many times it can iterate, providing access to\nthat information can be useful. For example, if you want to iterate\nbackwards, a good start is to know where the end is.\n\nWhen implementing an `ExactSizeIterator`, you must also implement\n[`Iterator`]. When doing so, the implementation of [`Iterator::size_hint`]\n*must* return the exact size of the iterator.\n\nThe [`len`] method has a default implementation, so you usually shouldn't\nimplement it. However, you may be able to provide a more performant\nimplementation than the default, so overriding it in this case makes sense.\n\nNote that this trait is a safe trait and as such does *not* and *cannot*\nguarantee that the returned length is correct. This means that `unsafe`\ncode **must not** rely on the correctness of [`Iterator::size_hint`]. The\nunstable and unsafe [`TrustedLen`](super::marker::TrustedLen) trait gives\nthis additional guarantee.\n\n[`len`]: ExactSizeIterator::len\n\n# When *shouldn't* an adapter be `ExactSizeIterator`?\n\nIf an adapter makes an iterator *longer*, then it's usually incorrect for\nthat adapter to implement `ExactSizeIterator`. The inner exact-sized\niterator might already be `usize::MAX`-long, and thus the length of the\nlonger adapted iterator would no longer be exactly representable in `usize`.\n\nThis is why [`Chain`](crate::iter::Chain) isn't `ExactSizeIterator`,\neven when `A` and `B` are both `ExactSizeIterator`.\n\n# Examples\n\nBasic usage:\n\n```rust\n// a finite range knows exactly how many times it will iterate\nlet five = 0..5;\n\nassert_eq!(5, five.len());\n```\n\nIn the [module-level docs], we implemented an [`Iterator`], `Counter`.\nLet's implement `ExactSizeIterator` for it as well:\n\n[module-level docs]: crate::iter\n\n```rust\nimpl ExactSizeIterator for Counter {\n // We can easily calculate the remaining number of iterations.\n fn len(&self) -> usize {\n 5 - self.count\n }\n}\n\n// And now we can use it!\n\nlet mut counter = Counter::new();\n\nassert_eq!(5, counter.len());\nlet _ = counter.next();\nassert_eq!(4, counter.len());\n```"},"filterText":"ExactSizeIterator","kind":8,"label":"ExactSizeIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"ExactSizeIterator","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Extend a collection with the contents of an iterator.\n\nIterators produce a series of values, and collections can also be thought\nof as a series of values. The `Extend` trait bridges this gap, allowing you\nto extend a collection by including the contents of that iterator. When\nextending a collection with an already existing key, that entry is updated\nor, in the case of collections that permit multiple entries with equal\nkeys, that entry is inserted.\n\n# Examples\n\nBasic usage:\n\n```rust\n// You can extend a String with some chars:\nlet mut message = String::from(\"The first three letters are: \");\n\nmessage.extend(&['a', 'b', 'c']);\n\nassert_eq!(\"abc\", &message[29..32]);\n```\n\nImplementing `Extend`:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// since MyCollection has a list of i32s, we implement Extend for i32\nimpl Extend for MyCollection {\n\n // This is a bit simpler with the concrete type signature: we can call\n // extend on anything which can be turned into an Iterator which gives\n // us i32s. Because we need i32s to put into MyCollection.\n fn extend>(&mut self, iter: T) {\n\n // The implementation is very straightforward: loop through the\n // iterator, and add() each element to ourselves.\n for elem in iter {\n self.add(elem);\n }\n }\n}\n\nlet mut c = MyCollection::new();\n\nc.add(5);\nc.add(6);\nc.add(7);\n\n// let's extend our collection with three more numbers\nc.extend(vec![1, 2, 3]);\n\n// we've added these elements onto the end\nassert_eq!(\"MyCollection([5, 6, 7, 1, 2, 3])\", format!(\"{c:?}\"));\n```"},"filterText":"Extend","kind":8,"label":"Extend","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Extend","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes an immutable receiver.\n\nInstances of `Fn` can be called repeatedly without mutating state.\n\n*This trait (`Fn`) is not to be confused with [function pointers]\n(`fn`).*\n\n`Fn` is implemented automatically by closures which only take immutable\nreferences to captured variables or don't capture anything at all, as well\nas (safe) [function pointers] (with some caveats, see their documentation\nfor more details). Additionally, for any type `F` that implements `Fn`, `&F`\nimplements `Fn`, too.\n\nSince both [`FnMut`] and [`FnOnce`] are supertraits of `Fn`, any\ninstance of `Fn` can be used as a parameter where a [`FnMut`] or [`FnOnce`]\nis expected.\n\nUse `Fn` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly and without mutating state (e.g., when\ncalling it concurrently). If you do not need such strict requirements, use\n[`FnMut`] or [`FnOnce`] as bounds.\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a closure\n\n```rust\nlet square = |x| x * x;\nassert_eq!(square(5), 25);\n```\n\n## Using a `Fn` parameter\n\n```rust\nfn call_with_one(func: F) -> usize\n where F: Fn(usize) -> usize {\n func(1)\n}\n\nlet double = |x| x * 2;\nassert_eq!(call_with_one(double), 2);\n```"},"filterText":"Fn","kind":8,"label":"Fn","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Fn","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a mutable receiver.\n\nInstances of `FnMut` can be called repeatedly and may mutate state.\n\n`FnMut` is implemented automatically by closures which take mutable\nreferences to captured variables, as well as all types that implement\n[`Fn`], e.g., (safe) [function pointers] (since `FnMut` is a supertrait of\n[`Fn`]). Additionally, for any type `F` that implements `FnMut`, `&mut F`\nimplements `FnMut`, too.\n\nSince [`FnOnce`] is a supertrait of `FnMut`, any instance of `FnMut` can be\nused where a [`FnOnce`] is expected, and since [`Fn`] is a subtrait of\n`FnMut`, any instance of [`Fn`] can be used where `FnMut` is expected.\n\nUse `FnMut` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly, while allowing it to mutate state.\nIf you don't want the parameter to mutate state, use [`Fn`] as a\nbound; if you don't need to call it repeatedly, use [`FnOnce`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a mutably capturing closure\n\n```rust\nlet mut x = 5;\n{\n let mut square_x = || x *= x;\n square_x();\n}\nassert_eq!(x, 25);\n```\n\n## Using a `FnMut` parameter\n\n```rust\nfn do_twice(mut func: F)\n where F: FnMut()\n{\n func();\n func();\n}\n\nlet mut x: usize = 1;\n{\n let add_two_to_x = || x += 2;\n do_twice(add_two_to_x);\n}\n\nassert_eq!(x, 5);\n```"},"filterText":"FnMut","kind":8,"label":"FnMut","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"FnMut","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a by-value receiver.\n\nInstances of `FnOnce` can be called, but might not be callable multiple\ntimes. Because of this, if the only thing known about a type is that it\nimplements `FnOnce`, it can only be called once.\n\n`FnOnce` is implemented automatically by closures that might consume captured\nvariables, as well as all types that implement [`FnMut`], e.g., (safe)\n[function pointers] (since `FnOnce` is a supertrait of [`FnMut`]).\n\nSince both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of\n[`Fn`] or [`FnMut`] can be used where a `FnOnce` is expected.\n\nUse `FnOnce` as a bound when you want to accept a parameter of function-like\ntype and only need to call it once. If you need to call the parameter\nrepeatedly, use [`FnMut`] as a bound; if you also need it to not mutate\nstate, use [`Fn`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Using a `FnOnce` parameter\n\n```rust\nfn consume_with_relish(func: F)\n where F: FnOnce() -> String\n{\n // `func` consumes its captured variables, so it cannot be run more\n // than once.\n println!(\"Consumed: {}\", func());\n\n println!(\"Delicious!\");\n\n // Attempting to invoke `func()` again will throw a `use of moved\n // value` error for `func`.\n}\n\nlet x = String::from(\"x\");\nlet consume_and_return_x = move || x;\nconsume_with_relish(consume_and_return_x);\n\n// `consume_and_return_x` can no longer be invoked at this point\n```"},"filterText":"FnOnce","kind":8,"label":"FnOnce","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"FnOnce","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do value-to-value conversions while consuming the input value. It is the reciprocal of\n[`Into`].\n\nOne should always prefer implementing `From` over [`Into`]\nbecause implementing `From` automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nOnly implement [`Into`] when targeting a version prior to Rust 1.41 and converting to a type\noutside the current crate.\n`From` was not able to do these types of conversions in earlier versions because of Rust's\norphaning rules.\nSee [`Into`] for more details.\n\nPrefer using [`Into`] over using `From` when specifying trait bounds on a generic function.\nThis way, types that directly implement [`Into`] can be used as arguments as well.\n\nThe `From` is also very useful when performing error handling. When constructing a function\nthat is capable of failing, the return type will generally be of the form `Result`.\nThe `From` trait simplifies error handling by allowing a function to return a single error type\nthat encapsulate multiple error types. See the \"Examples\" section and [the book][book] for more\ndetails.\n\n**Note: This trait must not fail**. The `From` trait is intended for perfect conversions.\nIf the conversion can fail or is not perfect, use [`TryFrom`].\n\n# Generic Implementations\n\n- `From for U` implies [`Into`]` for T`\n- `From` is reflexive, which means that `From for T` is implemented\n\n# When to implement `From`\n\nWhile there's no technical restrictions on which conversions can be done using\na `From` implementation, the general expectation is that the conversions\nshould typically be restricted as follows:\n\n* The conversion is *infallible*: if the conversion can fail, use [`TryFrom`]\n instead; don't provide a `From` impl that panics.\n\n* The conversion is *lossless*: semantically, it should not lose or discard\n information. For example, `i32: From` exists, where the original\n value can be recovered using `u16: TryFrom`. And `String: From<&str>`\n exists, where you can get something equivalent to the original value via\n `Deref`. But `From` cannot be used to convert from `u32` to `u16`, since\n that cannot succeed in a lossless way. (There's some wiggle room here for\n information not considered semantically relevant. For example,\n `Box<[T]>: From>` exists even though it might not preserve capacity,\n like how two vectors can be equal despite differing capacities.)\n\n* The conversion is *value-preserving*: the conceptual kind and meaning of\n the resulting value is the same, even though the Rust type and technical\n representation might be different. For example `-1_i8 as u8` is *lossless*,\n since `as` casting back can recover the original value, but that conversion\n is *not* available via `From` because `-1` and `255` are different conceptual\n values (despite being identical bit patterns technically). But\n `f32: From` *is* available because `1_i16` and `1.0_f32` are conceptually\n the same real number (despite having very different bit patterns technically).\n `String: From` is available because they're both *text*, but\n `String: From` is *not* available, since `1` (a number) and `\"1\"`\n (text) are too different. (Converting values to text is instead covered\n by the [`Display`](crate::fmt::Display) trait.)\n\n* The conversion is *obvious*: it's the only reasonable conversion between\n the two types. Otherwise it's better to have it be a named method or\n constructor, like how [`str::as_bytes`] is a method and how integers have\n methods like [`u32::from_ne_bytes`], [`u32::from_le_bytes`], and\n [`u32::from_be_bytes`], none of which are `From` implementations. Whereas\n there's only one reasonable way to wrap an [`Ipv6Addr`](crate::net::Ipv6Addr)\n into an [`IpAddr`](crate::net::IpAddr), thus `IpAddr: From` exists.\n\n# Examples\n\n[`String`] implements `From<&str>`:\n\nAn explicit conversion from a `&str` to a String is done as follows:\n\n```rust\nlet string = \"hello\".to_string();\nlet other_string = String::from(\"hello\");\n\nassert_eq!(string, other_string);\n```\n\nWhile performing error handling it is often useful to implement `From` for your own error type.\nBy converting underlying error types to our own custom error type that encapsulates the\nunderlying error type, we can return a single error type without losing information on the\nunderlying cause. The '?' operator automatically converts the underlying error type to our\ncustom error type with `From::from`.\n\n```rust\nuse std::fs;\nuse std::io;\nuse std::num;\n\nenum CliError {\n IoError(io::Error),\n ParseError(num::ParseIntError),\n}\n\nimpl From for CliError {\n fn from(error: io::Error) -> Self {\n CliError::IoError(error)\n }\n}\n\nimpl From for CliError {\n fn from(error: num::ParseIntError) -> Self {\n CliError::ParseError(error)\n }\n}\n\nfn open_and_parse_file(file_name: &str) -> Result {\n let mut contents = fs::read_to_string(&file_name)?;\n let num: i32 = contents.trim().parse()?;\n Ok(num)\n}\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`from`]: From::from\n[book]: ../../book/ch09-00-error-handling.html"},"filterText":"From","kind":8,"label":"From","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"From","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Conversion from an [`Iterator`].\n\nBy implementing `FromIterator` for a type, you define how it will be\ncreated from an iterator. This is common for types which describe a\ncollection of some kind.\n\nIf you want to create a collection from the contents of an iterator, the\n[`Iterator::collect()`] method is preferred. However, when you need to\nspecify the container type, [`FromIterator::from_iter()`] can be more\nreadable than using a turbofish (e.g. `::>()`). See the\n[`Iterator::collect()`] documentation for more examples of its use.\n\nSee also: [`IntoIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v = Vec::from_iter(five_fives);\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`Iterator::collect()`] to implicitly use `FromIterator`:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v: Vec = five_fives.collect();\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`FromIterator::from_iter()`] as a more readable alternative to\n[`Iterator::collect()`]:\n\n```rust\nuse std::collections::VecDeque;\nlet first = (0..10).collect::>();\nlet second = VecDeque::from_iter(0..10);\n\nassert_eq!(first, second);\n```\n\nImplementing `FromIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement FromIterator\nimpl FromIterator for MyCollection {\n fn from_iter>(iter: I) -> Self {\n let mut c = MyCollection::new();\n\n for i in iter {\n c.add(i);\n }\n\n c\n }\n}\n\n// Now we can make a new iterator...\nlet iter = (0..5).into_iter();\n\n// ... and make a MyCollection out of it\nlet c = MyCollection::from_iter(iter);\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n\n// collect works too!\n\nlet iter = (0..5).into_iter();\nlet c: MyCollection = iter.collect();\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n```"},"filterText":"FromIterator","kind":8,"label":"FromIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"FromIterator","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A value-to-value conversion that consumes the input value. The\nopposite of [`From`].\n\nOne should avoid implementing [`Into`] and implement [`From`] instead.\nImplementing [`From`] automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nPrefer using [`Into`] over [`From`] when specifying trait bounds on a generic function\nto ensure that types that only implement [`Into`] can be used as well.\n\n**Note: This trait must not fail**. If the conversion can fail, use [`TryInto`].\n\n# Generic Implementations\n\n- [`From`]` for U` implies `Into for T`\n- [`Into`] is reflexive, which means that `Into for T` is implemented\n\n# Implementing [`Into`] for conversions to external types in old versions of Rust\n\nPrior to Rust 1.41, if the destination type was not part of the current crate\nthen you couldn't implement [`From`] directly.\nFor example, take this code:\n\n```rust\nstruct Wrapper(Vec);\nimpl From> for Vec {\n fn from(w: Wrapper) -> Vec {\n w.0\n }\n}\n```\nThis will fail to compile in older versions of the language because Rust's orphaning rules\nused to be a little bit more strict. To bypass this, you could implement [`Into`] directly:\n\n```rust\nstruct Wrapper(Vec);\nimpl Into> for Wrapper {\n fn into(self) -> Vec {\n self.0\n }\n}\n```\n\nIt is important to understand that [`Into`] does not provide a [`From`] implementation\n(as [`From`] does with [`Into`]). Therefore, you should always try to implement [`From`]\nand then fall back to [`Into`] if [`From`] can't be implemented.\n\n# Examples\n\n[`String`] implements [`Into`]`<`[`Vec`]`<`[`u8`]`>>`:\n\nIn order to express that we want a generic function to take all arguments that can be\nconverted to a specified type `T`, we can use a trait bound of [`Into`]``.\nFor example: The function `is_hello` takes all arguments that can be converted into a\n[`Vec`]`<`[`u8`]`>`.\n\n```rust\nfn is_hello>>(s: T) {\n let bytes = b\"hello\".to_vec();\n assert_eq!(bytes, s.into());\n}\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`Vec`]: ../../std/vec/struct.Vec.html"},"filterText":"Into","kind":8,"label":"Into","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Into","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Conversion into an [`Iterator`].\n\nBy implementing `IntoIterator` for a type, you define how it will be\nconverted to an iterator. This is common for types which describe a\ncollection of some kind.\n\nOne benefit of implementing `IntoIterator` is that your type will [work\nwith Rust's `for` loop syntax](crate::iter#for-loops-and-intoiterator).\n\nSee also: [`FromIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = [1, 2, 3];\nlet mut iter = v.into_iter();\n\nassert_eq!(Some(1), iter.next());\nassert_eq!(Some(2), iter.next());\nassert_eq!(Some(3), iter.next());\nassert_eq!(None, iter.next());\n```\nImplementing `IntoIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement IntoIterator\nimpl IntoIterator for MyCollection {\n type Item = i32;\n type IntoIter = std::vec::IntoIter;\n\n fn into_iter(self) -> Self::IntoIter {\n self.0.into_iter()\n }\n}\n\n// Now we can make a new collection...\nlet mut c = MyCollection::new();\n\n// ... add some stuff to it ...\nc.add(0);\nc.add(1);\nc.add(2);\n\n// ... and then turn it into an Iterator:\nfor (i, n) in c.into_iter().enumerate() {\n assert_eq!(i as i32, n);\n}\n```\n\nIt is common to use `IntoIterator` as a trait bound. This allows\nthe input collection type to change, so long as it is still an\niterator. Additional bounds can be specified by restricting on\n`Item`:\n\n```rust\nfn collect_as_strings(collection: T) -> Vec\nwhere\n T: IntoIterator,\n T::Item: std::fmt::Debug,\n{\n collection\n .into_iter()\n .map(|item| format!(\"{item:?}\"))\n .collect()\n}\n```"},"filterText":"IntoIterator","kind":8,"label":"IntoIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"IntoIterator","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for dealing with iterators.\n\nThis is the main iterator trait. For more about the concept of iterators\ngenerally, please see the [module-level documentation]. In particular, you\nmay want to know how to [implement `Iterator`][impl].\n\n[module-level documentation]: crate::iter\n[impl]: crate::iter#implementing-iterator"},"filterText":"Iterator","kind":8,"label":"Iterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Iterator","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"None","documentation":{"kind":"markdown","value":"No value."},"filterText":"None","insertTextFormat":2,"kind":20,"label":"None","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"None$0","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Ok(T)","documentation":{"kind":"markdown","value":"Contains the success value"},"filterText":"Ok()","insertTextFormat":2,"kind":20,"label":"Ok(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Ok(${1:()})$0","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The `Option` type. See [the module level documentation](self) for more."},"filterText":"Option","kind":13,"label":"Option","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Option","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for types that form a [total order](https://en.wikipedia.org/wiki/Total_order).\n\nImplementations must be consistent with the [`PartialOrd`] implementation, and ensure\n`max`, `min`, and `clamp` are consistent with `cmp`:\n\n- `partial_cmp(a, b) == Some(cmp(a, b))`.\n- `max(a, b) == max_by(a, b, cmp)` (ensured by the default implementation).\n- `min(a, b) == min_by(a, b, cmp)` (ensured by the default implementation).\n- For `a.clamp(min, max)`, see the [method docs](#method.clamp)\n (ensured by the default implementation).\n\nIt's easy to accidentally make `cmp` and `partial_cmp` disagree by\nderiving some of the traits and manually implementing others.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nFrom the above and the requirements of `PartialOrd`, it follows that for\nall `a`, `b` and `c`:\n\n- exactly one of `a < b`, `a == b` or `a > b` is true; and\n- `<` is transitive: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n\nMathematically speaking, the `<` operator defines a strict [weak order]. In\ncases where `==` conforms to mathematical equality, it also defines a\nstrict [total order].\n\n[weak order]: https://en.wikipedia.org/wiki/Weak_ordering\n[total order]: https://en.wikipedia.org/wiki/Total_order\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## Lexicographical comparison\n\nLexicographical comparison is an operation with the following properties:\n - Two sequences are compared element by element.\n - The first mismatching element defines which sequence is lexicographically less or greater than the other.\n - If one sequence is a prefix of another, the shorter sequence is lexicographically less than the other.\n - If two sequences have equivalent elements and are of the same length, then the sequences are lexicographically equal.\n - An empty sequence is lexicographically less than any non-empty sequence.\n - Two empty sequences are lexicographically equal.\n\n## How can I implement `Ord`?\n\n`Ord` requires that the type also be [`PartialOrd`] and [`Eq`] (which requires [`PartialEq`]).\n\nThen you must define an implementation for [`cmp`]. You may find it useful to use\n[`cmp`] on your type's fields.\n\nHere's an example where you want to sort people by height only, disregarding `id`\nand `name`:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n[`cmp`]: Ord::cmp"},"filterText":"Ord","kind":8,"label":"Ord (alias <, >, <=, >=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Ord","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for comparisons using the equality operator.\n\nImplementing this trait for types provides the `==` and `!=` operators for\nthose types.\n\n`x.eq(y)` can also be written `x == y`, and `x.ne(y)` can be written `x != y`.\nWe use the easier-to-read infix notation in the remainder of this documentation.\n\nThis trait allows for comparisons using the equality operator, for types\nthat do not have a full equivalence relation. For example, in floating point\nnumbers `NaN != NaN`, so floating point types implement `PartialEq` but not\n[`trait@Eq`]. Formally speaking, when `Rhs == Self`, this trait corresponds\nto a [partial equivalence relation].\n\n[partial equivalence relation]: https://en.wikipedia.org/wiki/Partial_equivalence_relation\n\nImplementations must ensure that `eq` and `ne` are consistent with each other:\n\n- `a != b` if and only if `!(a == b)`.\n\nThe default implementation of `ne` provides this consistency and is almost\nalways sufficient. It should not be overridden without very good reason.\n\nIf [`PartialOrd`] or [`Ord`] are also implemented for `Self` and `Rhs`, their methods must also\nbe consistent with `PartialEq` (see the documentation of those traits for the exact\nrequirements). It's easy to accidentally make them disagree by deriving some of the traits and\nmanually implementing others.\n\nThe equality relation `==` must satisfy the following conditions\n(for all `a`, `b`, `c` of type `A`, `B`, `C`):\n\n- **Symmetric**: if `A: PartialEq` and `B: PartialEq`, then **`a == b`\n implies `b == a`**; and\n\n- **Transitive**: if `A: PartialEq` and `B: PartialEq` and `A:\n PartialEq`, then **`a == b` and `b == c` implies `a == c`**.\n\nNote that the `B: PartialEq` (symmetric) and `A: PartialEq`\n(transitive) impls are not forced to exist, but these requirements apply\nwhenever they do exist.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d on structs, two\ninstances are equal if all fields are equal, and not equal if any fields\nare not equal. When `derive`d on enums, two instances are equal if they\nare the same variant and all fields are equal.\n\n## How can I implement `PartialEq`?\n\nAn example implementation for a domain in which two books are considered\nthe same book if their ISBN matches, even if the formats differ:\n\n```rust\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\nlet b2 = Book { isbn: 3, format: BookFormat::Ebook };\nlet b3 = Book { isbn: 10, format: BookFormat::Paperback };\n\nassert!(b1 == b2);\nassert!(b1 != b3);\n```\n\n## How can I compare two different types?\n\nThe type you can compare with is controlled by `PartialEq`'s type parameter.\nFor example, let's tweak our previous code a bit:\n\n```rust\n// The derive implements == comparisons\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\n// Implement == comparisons\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\n// Implement == comparisons\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\n\nassert!(b1 == BookFormat::Paperback);\nassert!(BookFormat::Ebook != b1);\n```\n\nBy changing `impl PartialEq for Book` to `impl PartialEq for Book`,\nwe allow `BookFormat`s to be compared with `Book`s.\n\nA comparison like the one above, which ignores some fields of the struct,\ncan be dangerous. It can easily lead to an unintended violation of the\nrequirements for a partial equivalence relation. For example, if we kept\nthe above implementation of `PartialEq` for `BookFormat` and added an\nimplementation of `PartialEq` for `Book` (either via a `#[derive]` or\nvia the manual implementation from the first example) then the result would\nviolate transitivity:\n\n```rust\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\n#[derive(PartialEq)]\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nfn main() {\n let b1 = Book { isbn: 1, format: BookFormat::Paperback };\n let b2 = Book { isbn: 2, format: BookFormat::Paperback };\n\n assert!(b1 == BookFormat::Paperback);\n assert!(BookFormat::Paperback == b2);\n\n // The following should hold by transitivity but doesn't.\n assert!(b1 == b2); // <-- PANICS\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x == y, false);\nassert_eq!(x.eq(&y), false);\n```\n\n[`eq`]: PartialEq::eq\n[`ne`]: PartialEq::ne"},"filterText":"PartialEq","kind":8,"label":"PartialEq (alias ==, !=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"PartialEq","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for types that form a [partial order](https://en.wikipedia.org/wiki/Partial_order).\n\nThe `lt`, `le`, `gt`, and `ge` methods of this trait can be called using\nthe `<`, `<=`, `>`, and `>=` operators, respectively.\n\nThe methods of this trait must be consistent with each other and with those of [`PartialEq`].\nThe following conditions must hold:\n\n1. `a == b` if and only if `partial_cmp(a, b) == Some(Equal)`.\n2. `a < b` if and only if `partial_cmp(a, b) == Some(Less)`\n3. `a > b` if and only if `partial_cmp(a, b) == Some(Greater)`\n4. `a <= b` if and only if `a < b || a == b`\n5. `a >= b` if and only if `a > b || a == b`\n6. `a != b` if and only if `!(a == b)`.\n\nConditions 2–5 above are ensured by the default implementation.\nCondition 6 is already ensured by [`PartialEq`].\n\nIf [`Ord`] is also implemented for `Self` and `Rhs`, it must also be consistent with\n`partial_cmp` (see the documentation of that trait for the exact requirements). It's\neasy to accidentally make them disagree by deriving some of the traits and manually\nimplementing others.\n\nThe comparison must satisfy, for all `a`, `b` and `c`:\n\n- transitivity: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n- duality: `a < b` if and only if `b > a`.\n\nNote that these requirements mean that the trait itself must be implemented symmetrically and\ntransitively: if `T: PartialOrd` and `U: PartialOrd` then `U: PartialOrd` and `T:\nPartialOrd`.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nThe following corollaries follow from the above requirements:\n\n- irreflexivity of `<` and `>`: `!(a < a)`, `!(a > a)`\n- transitivity of `>`: if `a > b` and `b > c` then `a > c`\n- duality of `partial_cmp`: `partial_cmp(a, b) == partial_cmp(b, a).map(Ordering::reverse)`\n\n## Strict and non-strict partial orders\n\nThe `<` and `>` operators behave according to a *strict* partial order.\nHowever, `<=` and `>=` do **not** behave according to a *non-strict*\npartial order.\nThat is because mathematically, a non-strict partial order would require\nreflexivity, i.e. `a <= a` would need to be true for every `a`. This isn't\nalways the case for types that implement `PartialOrd`, for example:\n\n```rust\nlet a = f64::sqrt(-1.0);\nassert_eq!(a <= a, false);\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## How can I implement `PartialOrd`?\n\n`PartialOrd` only requires implementation of the [`partial_cmp`] method, with the others\ngenerated from default implementations.\n\nHowever it remains possible to implement the others separately for types which do not have a\ntotal order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==\nfalse` (cf. IEEE 754-2008 section 5.11).\n\n`PartialOrd` requires your type to be [`PartialEq`].\n\nIf your type is [`Ord`], you can implement [`partial_cmp`] by using [`cmp`]:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\nYou may also find it useful to use [`partial_cmp`] on your type's fields. Here\nis an example of `Person` types who have a floating-point `height` field that\nis the only field to be used for sorting:\n\n```rust\nuse std::cmp::Ordering;\n\nstruct Person {\n id: u32,\n name: String,\n height: f64,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n self.height.partial_cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x < y, true);\nassert_eq!(x.lt(&y), true);\n```\n\n[`partial_cmp`]: PartialOrd::partial_cmp\n[`cmp`]: Ord::cmp"},"filterText":"PartialOrd","kind":8,"label":"PartialOrd (alias >, <, <=, >=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"PartialOrd","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"`Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).\n\nSee the [module documentation](self) for details."},"filterText":"Result","kind":13,"label":"Result","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Result","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"RustcDecodable","kind":18,"label":"RustcDecodable","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"RustcDecodable","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"RustcEncodable","kind":18,"label":"RustcEncodable","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"RustcEncodable","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Some(T)","documentation":{"kind":"markdown","value":"Some value of type `T`."},"filterText":"Some()","insertTextFormat":2,"kind":20,"label":"Some(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Some(${1:()})$0","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A UTF-8–encoded, growable string.\n\nThe `String` type is the most common string type that has ownership over the\ncontents of the string. It has a close relationship with its borrowed\ncounterpart, the primitive [`str`].\n\n# Examples\n\nYou can create a `String` from [a literal string][`&str`] with [`String::from`]:\n\n[`String::from`]: From::from\n\n```rust\nlet hello = String::from(\"Hello, world!\");\n```\n\nYou can append a [`char`] to a `String` with the [`push`] method, and\nappend a [`&str`] with the [`push_str`] method:\n\n```rust\nlet mut hello = String::from(\"Hello, \");\n\nhello.push('w');\nhello.push_str(\"orld!\");\n```\n\n[`push`]: String::push\n[`push_str`]: String::push_str\n\nIf you have a vector of UTF-8 bytes, you can create a `String` from it with\nthe [`from_utf8`] method:\n\n```rust\n// some bytes, in a vector\nlet sparkle_heart = vec![240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `unwrap()`.\nlet sparkle_heart = String::from_utf8(sparkle_heart).unwrap();\n\nassert_eq!(\"💖\", sparkle_heart);\n```\n\n[`from_utf8`]: String::from_utf8\n\n# UTF-8\n\n`String`s are always valid UTF-8. If you need a non-UTF-8 string, consider\n[`OsString`]. It is similar, but without the UTF-8 constraint. Because UTF-8\nis a variable width encoding, `String`s are typically smaller than an array of\nthe same `chars`:\n\n```rust\nuse std::mem;\n\n// `s` is ASCII which represents each `char` as one byte\nlet s = \"hello\";\nassert_eq!(s.len(), 5);\n\n// A `char` array with the same contents would be longer because\n// every `char` is four bytes\nlet s = ['h', 'e', 'l', 'l', 'o'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n\n// However, for non-ASCII strings, the difference will be smaller\n// and sometimes they are the same\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.len(), 20);\n\nlet s = ['💖', '💖', '💖', '💖', '💖'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n```\n\nThis raises interesting questions as to how `s[i]` should work.\nWhat should `i` be here? Several options include byte indices and\n`char` indices but, because of UTF-8 encoding, only byte indices\nwould provide constant time indexing. Getting the `i`th `char`, for\nexample, is available using [`chars`]:\n\n```rust\nlet s = \"hello\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('l'));\n\nlet s = \"💖💖💖💖💖\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('💖'));\n```\n\nNext, what should `s[i]` return? Because indexing returns a reference\nto underlying data it could be `&u8`, `&[u8]`, or something else similar.\nSince we're only providing one index, `&u8` makes the most sense but that\nmight not be what the user expects and can be explicitly achieved with\n[`as_bytes()`]:\n\n```rust\n// The first byte is 104 - the byte value of `'h'`\nlet s = \"hello\";\nassert_eq!(s.as_bytes()[0], 104);\n// or\nassert_eq!(s.as_bytes()[0], b'h');\n\n// The first byte is 240 which isn't obviously useful\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.as_bytes()[0], 240);\n```\n\nDue to these ambiguities/restrictions, indexing with a `usize` is simply\nforbidden:\n\n```rust\nlet s = \"hello\";\n\n// The following will not compile!\nprintln!(\"The first letter of s is {}\", s[0]);\n```\n\nIt is more clear, however, how `&s[i..j]` should work (that is,\nindexing with a range). It should accept byte indices (to be constant-time)\nand return a `&str` which is UTF-8 encoded. This is also called \"string slicing\".\nNote this will panic if the byte indices provided are not character\nboundaries - see [`is_char_boundary`] for more details. See the implementations\nfor [`SliceIndex`] for more details on string slicing. For a non-panicking\nversion of string slicing, see [`get`].\n\n[`OsString`]: ../../std/ffi/struct.OsString.html \"ffi::OsString\"\n[`SliceIndex`]: core::slice::SliceIndex\n[`as_bytes()`]: str::as_bytes\n[`get`]: str::get\n[`is_char_boundary`]: str::is_char_boundary\n\nThe [`bytes`] and [`chars`] methods return iterators over the bytes and\ncodepoints of the string, respectively. To iterate over codepoints along\nwith byte indices, use [`char_indices`].\n\n[`bytes`]: str::bytes\n[`chars`]: str::chars\n[`char_indices`]: str::char_indices\n\n# Deref\n\n`String` implements [Deref], and so inherits all of [`str`]'s\nmethods. In addition, this means that you can pass a `String` to a\nfunction which takes a [`&str`] by using an ampersand (`&`):\n\n```rust\nfn takes_str(s: &str) { }\n\nlet s = String::from(\"Hello\");\n\ntakes_str(&s);\n```\n\nThis will create a [`&str`] from the `String` and pass it in. This\nconversion is very inexpensive, and so generally, functions will accept\n[`&str`]s as arguments unless they need a `String` for some specific\nreason.\n\nIn certain cases Rust doesn't have enough information to make this\nconversion, known as [`Deref`] coercion. In the following example a string\nslice [`&'a str`][`&str`] implements the trait `TraitExample`, and the function\n`example_func` takes anything that implements the trait. In this case Rust\nwould need to make two implicit conversions, which Rust doesn't have the\nmeans to do. For that reason, the following example will not compile.\n\n```rust\ntrait TraitExample {}\n\nimpl<'a> TraitExample for &'a str {}\n\nfn example_func(example_arg: A) {}\n\nlet example_string = String::from(\"example_string\");\nexample_func(&example_string);\n```\n\nThere are two options that would work instead. The first would be to\nchange the line `example_func(&example_string);` to\n`example_func(example_string.as_str());`, using the method [`as_str()`]\nto explicitly extract the string slice containing the string. The second\nway changes `example_func(&example_string);` to\n`example_func(&*example_string);`. In this case we are dereferencing a\n`String` to a [`str`], then referencing the [`str`] back to\n[`&str`]. The second way is more idiomatic, however both work to do the\nconversion explicitly rather than relying on the implicit conversion.\n\n# Representation\n\nA `String` is made up of three components: a pointer to some bytes, a\nlength, and a capacity. The pointer points to an internal buffer `String`\nuses to store its data. The length is the number of bytes currently stored\nin the buffer, and the capacity is the size of the buffer in bytes. As such,\nthe length will always be less than or equal to the capacity.\n\nThis buffer is always stored on the heap.\n\nYou can look at these with the [`as_ptr`], [`len`], and [`capacity`]\nmethods:\n\n```rust\nuse std::mem;\n\nlet story = String::from(\"Once upon a time...\");\n\n// Prevent automatically dropping the String's data\nlet mut story = mem::ManuallyDrop::new(story);\n\nlet ptr = story.as_mut_ptr();\nlet len = story.len();\nlet capacity = story.capacity();\n\n// story has nineteen bytes\nassert_eq!(19, len);\n\n// We can re-build a String out of ptr, len, and capacity. This is all\n// unsafe because we are responsible for making sure the components are\n// valid:\nlet s = unsafe { String::from_raw_parts(ptr, len, capacity) } ;\n\nassert_eq!(String::from(\"Once upon a time...\"), s);\n```\n\n[`as_ptr`]: str::as_ptr\n[`len`]: String::len\n[`capacity`]: String::capacity\n\nIf a `String` has enough capacity, adding elements to it will not\nre-allocate. For example, consider this program:\n\n```rust\nlet mut s = String::new();\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\nThis will output the following:\n\n```text\n0\n8\n16\n16\n32\n32\n```\n\nAt first, we have no memory allocated at all, but as we append to the\nstring, it increases its capacity appropriately. If we instead use the\n[`with_capacity`] method to allocate the correct capacity initially:\n\n```rust\nlet mut s = String::with_capacity(25);\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\n[`with_capacity`]: String::with_capacity\n\nWe end up with a different output:\n\n```text\n25\n25\n25\n25\n25\n25\n```\n\nHere, there's no need to allocate more memory inside the loop.\n\n[str]: prim@str \"str\"\n[`str`]: prim@str \"str\"\n[`&str`]: prim@str \"&str\"\n[Deref]: core::ops::Deref \"ops::Deref\"\n[`Deref`]: core::ops::Deref \"ops::Deref\"\n[`as_str()`]: String::as_str"},"filterText":"String","kind":22,"label":"String","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"String","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A generalization of `Clone` to borrowed data.\n\nSome types make it possible to go from borrowed to owned, usually by\nimplementing the `Clone` trait. But `Clone` works only for going from `&T`\nto `T`. The `ToOwned` trait generalizes `Clone` to construct owned data\nfrom any borrow of a given type."},"filterText":"ToOwned","kind":8,"label":"ToOwned","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"ToOwned","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for converting a value to a `String`.\n\nThis trait is automatically implemented for any type which implements the\n[`Display`] trait. As such, `ToString` shouldn't be implemented directly:\n[`Display`] should be implemented instead, and you get the `ToString`\nimplementation for free.\n\n[`Display`]: fmt::Display"},"filterText":"ToString","kind":8,"label":"ToString","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"ToString","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Simple and safe type conversions that may fail in a controlled\nway under some circumstances. It is the reciprocal of [`TryInto`].\n\nThis is useful when you are doing a type conversion that may\ntrivially succeed but may also need special handling.\nFor example, there is no way to convert an [`i64`] into an [`i32`]\nusing the [`From`] trait, because an [`i64`] may contain a value\nthat an [`i32`] cannot represent and so the conversion would lose data.\nThis might be handled by truncating the [`i64`] to an [`i32`] or by\nsimply returning [`i32::MAX`], or by some other method. The [`From`]\ntrait is intended for perfect conversions, so the `TryFrom` trait\ninforms the programmer when a type conversion could go bad and lets\nthem decide how to handle it.\n\n# Generic Implementations\n\n- `TryFrom for U` implies [`TryInto`]` for T`\n- [`try_from`] is reflexive, which means that `TryFrom for T`\nis implemented and cannot fail -- the associated `Error` type for\ncalling `T::try_from()` on a value of type `T` is [`Infallible`].\nWhen the [`!`] type is stabilized [`Infallible`] and [`!`] will be\nequivalent.\n\n`TryFrom` can be implemented as follows:\n\n```rust\nstruct GreaterThanZero(i32);\n\nimpl TryFrom for GreaterThanZero {\n type Error = &'static str;\n\n fn try_from(value: i32) -> Result {\n if value <= 0 {\n Err(\"GreaterThanZero only accepts values greater than zero!\")\n } else {\n Ok(GreaterThanZero(value))\n }\n }\n}\n```\n\n# Examples\n\nAs described, [`i32`] implements `TryFrom<`[`i64`]`>`:\n\n```rust\nlet big_number = 1_000_000_000_000i64;\n// Silently truncates `big_number`, requires detecting\n// and handling the truncation after the fact.\nlet smaller_number = big_number as i32;\nassert_eq!(smaller_number, -727379968);\n\n// Returns an error because `big_number` is too big to\n// fit in an `i32`.\nlet try_smaller_number = i32::try_from(big_number);\nassert!(try_smaller_number.is_err());\n\n// Returns `Ok(3)`.\nlet try_successful_smaller_number = i32::try_from(3);\nassert!(try_successful_smaller_number.is_ok());\n```\n\n[`try_from`]: TryFrom::try_from"},"filterText":"TryFrom","kind":8,"label":"TryFrom","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"TryFrom","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An attempted conversion that consumes `self`, which may or may not be\nexpensive.\n\nLibrary authors should usually not directly implement this trait,\nbut should prefer implementing the [`TryFrom`] trait, which offers\ngreater flexibility and provides an equivalent `TryInto`\nimplementation for free, thanks to a blanket implementation in the\nstandard library. For more information on this, see the\ndocumentation for [`Into`].\n\n# Implementing `TryInto`\n\nThis suffers the same restrictions and reasoning as implementing\n[`Into`], see there for details."},"filterText":"TryInto","kind":8,"label":"TryInto","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"TryInto","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A contiguous growable array type, written as `Vec`, short for 'vector'.\n\n# Examples\n\n```rust\nlet mut vec = Vec::new();\nvec.push(1);\nvec.push(2);\n\nassert_eq!(vec.len(), 2);\nassert_eq!(vec[0], 1);\n\nassert_eq!(vec.pop(), Some(2));\nassert_eq!(vec.len(), 1);\n\nvec[0] = 7;\nassert_eq!(vec[0], 7);\n\nvec.extend([1, 2, 3]);\n\nfor x in &vec {\n println!(\"{x}\");\n}\nassert_eq!(vec, [7, 1, 2, 3]);\n```\n\nThe [`vec!`] macro is provided for convenient initialization:\n\n```rust\nlet mut vec1 = vec![1, 2, 3];\nvec1.push(4);\nlet vec2 = Vec::from([1, 2, 3, 4]);\nassert_eq!(vec1, vec2);\n```\n\nIt can also initialize each element of a `Vec` with a given value.\nThis may be more efficient than performing allocation and initialization\nin separate steps, especially when initializing a vector of zeros:\n\n```rust\nlet vec = vec![0; 5];\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n\n// The following is equivalent, but potentially slower:\nlet mut vec = Vec::with_capacity(5);\nvec.resize(5, 0);\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n```\n\nFor more information, see\n[Capacity and Reallocation](#capacity-and-reallocation).\n\nUse a `Vec` as an efficient stack:\n\n```rust\nlet mut stack = Vec::new();\n\nstack.push(1);\nstack.push(2);\nstack.push(3);\n\nwhile let Some(top) = stack.pop() {\n // Prints 3, 2, 1\n println!(\"{top}\");\n}\n```\n\n# Indexing\n\nThe `Vec` type allows access to values by index, because it implements the\n[`Index`] trait. An example will be more explicit:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[1]); // it will display '2'\n```\n\nHowever be careful: if you try to access an index which isn't in the `Vec`,\nyour software will panic! You cannot do this:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[6]); // it will panic!\n```\n\nUse [`get`] and [`get_mut`] if you want to check whether the index is in\nthe `Vec`.\n\n# Slicing\n\nA `Vec` can be mutable. On the other hand, slices are read-only objects.\nTo get a [slice][prim@slice], use [`&`]. Example:\n\n```rust\nfn read_slice(slice: &[usize]) {\n // ...\n}\n\nlet v = vec![0, 1];\nread_slice(&v);\n\n// ... and that's all!\n// you can also do it like this:\nlet u: &[usize] = &v;\n// or like this:\nlet u: &[_] = &v;\n```\n\nIn Rust, it's more common to pass slices as arguments rather than vectors\nwhen you just want to provide read access. The same goes for [`String`] and\n[`&str`].\n\n# Capacity and reallocation\n\nThe capacity of a vector is the amount of space allocated for any future\nelements that will be added onto the vector. This is not to be confused with\nthe *length* of a vector, which specifies the number of actual elements\nwithin the vector. If a vector's length exceeds its capacity, its capacity\nwill automatically be increased, but its elements will have to be\nreallocated.\n\nFor example, a vector with capacity 10 and length 0 would be an empty vector\nwith space for 10 more elements. Pushing 10 or fewer elements onto the\nvector will not change its capacity or cause reallocation to occur. However,\nif the vector's length is increased to 11, it will have to reallocate, which\ncan be slow. For this reason, it is recommended to use [`Vec::with_capacity`]\nwhenever possible to specify how big the vector is expected to get.\n\n# Guarantees\n\nDue to its incredibly fundamental nature, `Vec` makes a lot of guarantees\nabout its design. This ensures that it's as low-overhead as possible in\nthe general case, and can be correctly manipulated in primitive ways\nby unsafe code. Note that these guarantees refer to an unqualified `Vec`.\nIf additional type parameters are added (e.g., to support custom allocators),\noverriding their defaults may change the behavior.\n\nMost fundamentally, `Vec` is and always will be a (pointer, capacity, length)\ntriplet. No more, no less. The order of these fields is completely\nunspecified, and you should use the appropriate methods to modify these.\nThe pointer will never be null, so this type is null-pointer-optimized.\n\nHowever, the pointer might not actually point to allocated memory. In particular,\nif you construct a `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],\n[`Vec::with_capacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]\non an empty Vec, it will not allocate memory. Similarly, if you store zero-sized\ntypes inside a `Vec`, it will not allocate space for them. *Note that in this case\nthe `Vec` might not report a [`capacity`] of 0*. `Vec` will allocate if and only\nif [mem::size_of::\\]\\() * [capacity]\\() > 0. In general, `Vec`'s allocation\ndetails are very subtle --- if you intend to allocate memory using a `Vec`\nand use it for something else (either to pass to unsafe code, or to build your\nown memory-backed collection), be sure to deallocate this memory by using\n`from_raw_parts` to recover the `Vec` and then dropping it.\n\nIf a `Vec` *has* allocated memory, then the memory it points to is on the heap\n(as defined by the allocator Rust is configured to use by default), and its\npointer points to [`len`] initialized, contiguous elements in order (what\nyou would see if you coerced it to a slice), followed by [capacity] - [len]\nlogically uninitialized, contiguous elements.\n\nA vector containing the elements `'a'` and `'b'` with capacity 4 can be\nvisualized as below. The top part is the `Vec` struct, it contains a\npointer to the head of the allocation in the heap, length and capacity.\nThe bottom part is the allocation on the heap, a contiguous memory block.\n\n```text\n ptr len capacity\n +--------+--------+--------+\n | 0x0123 | 2 | 4 |\n +--------+--------+--------+\n |\n v\nHeap +--------+--------+--------+--------+\n | 'a' | 'b' | uninit | uninit |\n +--------+--------+--------+--------+\n```\n\n- **uninit** represents memory that is not initialized, see [`MaybeUninit`].\n- Note: the ABI is not stable and `Vec` makes no guarantees about its memory\n layout (including the order of fields).\n\n`Vec` will never perform a \"small optimization\" where elements are actually\nstored on the stack for two reasons:\n\n* It would make it more difficult for unsafe code to correctly manipulate\n a `Vec`. The contents of a `Vec` wouldn't have a stable address if it were\n only moved, and it would be more difficult to determine if a `Vec` had\n actually allocated memory.\n\n* It would penalize the general case, incurring an additional branch\n on every access.\n\n`Vec` will never automatically shrink itself, even if completely empty. This\nensures no unnecessary allocations or deallocations occur. Emptying a `Vec`\nand then filling it back up to the same [`len`] should incur no calls to\nthe allocator. If you wish to free up unused memory, use\n[`shrink_to_fit`] or [`shrink_to`].\n\n[`push`] and [`insert`] will never (re)allocate if the reported capacity is\nsufficient. [`push`] and [`insert`] *will* (re)allocate if\n[len] == [capacity]. That is, the reported capacity is completely\naccurate, and can be relied on. It can even be used to manually free the memory\nallocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even\nwhen not necessary.\n\n`Vec` does not guarantee any particular growth strategy when reallocating\nwhen full, nor when [`reserve`] is called. The current strategy is basic\nand it may prove desirable to use a non-constant growth factor. Whatever\nstrategy is used will of course guarantee *O*(1) amortized [`push`].\n\n`vec![x; n]`, `vec![a, b, c, d]`, and\n[`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`\nwith exactly the requested capacity. If [len] == [capacity],\n(as is the case for the [`vec!`] macro), then a `Vec` can be converted to\nand from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.\n\n`Vec` will not specifically overwrite any data that is removed from it,\nbut also won't specifically preserve it. Its uninitialized memory is\nscratch space that it may use however it wants. It will generally just do\nwhatever is most efficient or otherwise easy to implement. Do not rely on\nremoved data to be erased for security purposes. Even if you drop a `Vec`, its\nbuffer may simply be reused by another allocation. Even if you zero a `Vec`'s memory\nfirst, that might not actually happen because the optimizer does not consider\nthis a side-effect that must be preserved. There is one case which we will\nnot break, however: using `unsafe` code to write to the excess capacity,\nand then increasing the length to match, is always valid.\n\nCurrently, `Vec` does not guarantee the order in which elements are dropped.\nThe order has changed in the past and may change again.\n\n[`get`]: slice::get\n[`get_mut`]: slice::get_mut\n[`String`]: crate::string::String\n[`&str`]: type@str\n[`shrink_to_fit`]: Vec::shrink_to_fit\n[`shrink_to`]: Vec::shrink_to\n[capacity]: Vec::capacity\n[`capacity`]: Vec::capacity\n[mem::size_of::\\]: core::mem::size_of\n[len]: Vec::len\n[`len`]: Vec::len\n[`push`]: Vec::push\n[`insert`]: Vec::insert\n[`reserve`]: Vec::reserve\n[`MaybeUninit`]: core::mem::MaybeUninit\n[owned slice]: Box"},"filterText":"Vec","kind":22,"label":"Vec","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"Vec","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"alloc_error_handler","kind":18,"label":"alloc_error_handler","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"alloc_error_handler","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"fn(T)","documentation":{"kind":"markdown","value":"Disposes of a value.\n\nThis does so by calling the argument's implementation of [`Drop`][drop].\n\nThis effectively does nothing for types which implement `Copy`, e.g.\nintegers. Such values are copied and _then_ moved into the function, so the\nvalue persists after this function call.\n\nThis function is not magic; it is literally defined as\n\n```rust\npub fn drop(_x: T) {}\n```\n\nBecause `_x` is moved into the function, it is automatically dropped before\nthe function returns.\n\n[drop]: Drop\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = vec![1, 2, 3];\n\ndrop(v); // explicitly drop the vector\n```\n\nSince [`RefCell`] enforces the borrow rules at runtime, `drop` can\nrelease a [`RefCell`] borrow:\n\n```rust\nuse std::cell::RefCell;\n\nlet x = RefCell::new(1);\n\nlet mut mutable_borrow = x.borrow_mut();\n*mutable_borrow = 1;\n\ndrop(mutable_borrow); // relinquish the mutable borrow on this slot\n\nlet borrow = x.borrow();\nprintln!(\"{}\", *borrow);\n```\n\nIntegers and other types implementing [`Copy`] are unaffected by `drop`.\n\n```rust\n#[derive(Copy, Clone)]\nstruct Foo(u8);\n\nlet x = 1;\nlet y = Foo(2);\ndrop(x); // a copy of `x` is moved and dropped\ndrop(y); // a copy of `y` is moved and dropped\n\nprintln!(\"x: {}, y: {}\", x, y.0); // still available\n```\n\n[`RefCell`]: crate::cell::RefCell"},"filterText":"drop","insertTextFormat":2,"kind":3,"label":"drop(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"drop(${1:x})$0","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"type_ascribe","kind":18,"label":"type_ascribe","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"type_ascribe","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"unsafe","insertTextFormat":2,"kind":14,"label":"unsafe","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"unsafe {\n $0\n};","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"match","insertTextFormat":2,"kind":14,"label":"match","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"match $1 {\n $0\n};","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"while","insertTextFormat":2,"kind":14,"label":"while","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"while $1 {\n $0\n};","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"while let","insertTextFormat":2,"kind":14,"label":"while let","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"while let $1 = $2 {\n $0\n};","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"loop","insertTextFormat":2,"kind":14,"label":"loop","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"loop {\n $0\n};","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"if","insertTextFormat":2,"kind":14,"label":"if","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"if $1 {\n $0\n};","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"if let","insertTextFormat":2,"kind":14,"label":"if let","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"if let $1 = $2 {\n $0\n};","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"for","insertTextFormat":2,"kind":14,"label":"for","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"for $1 in $2 {\n $0\n};","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"true","insertTextFormat":2,"kind":14,"label":"true","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"true","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"false","insertTextFormat":2,"kind":14,"label":"false","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"false","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"return","insertTextFormat":2,"kind":14,"label":"return","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}},"newText":"return","replace":{"end":{"character":14,"line":1},"start":{"character":12,"line":1}}}}]} 2023-12-27T20:29:07.988 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":14,"line":1},"start":{"character":14,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":2}}} 2023-12-27T20:29:07.989 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":15},"end":{"line":1,"character":15}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":2}} 2023-12-27T20:29:08.436 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":15,"line":1},"start":{"character":15,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":3}}} 2023-12-27T20:29:08.437 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":16},"end":{"line":1,"character":16}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":3}} 2023-12-27T20:29:08.538 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}},"id":3} 2023-12-27T20:29:08.563 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":3,"result":{"isIncomplete":true,"items":[{"label":"_MM_PERM_AAAA (use std::arch::x86_64::_MM_PERM_AAAA)","kind":21,"deprecated":false,"sortText":"fffffff0","filterText":"_MM_PERM_AAAA","textEdit":{"newText":"_MM_PERM_AAAA","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::arch::x86_64::_MM_PERM_AAAA","imported_name":"_MM_PERM_AAAA"}]}},{"label":"atomic_cxchgweak_acqrel_acquire(…) (use std::intrinsics::atomic_cxchgweak_acqrel_acquire)","kind":3,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::AcqRel`] and [`Ordering::Acquire`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"deprecated":false,"sortText":"ffffffed","filterText":"atomic_cxchgweak_acqrel_acquire","insertTextFormat":2,"textEdit":{"newText":"atomic_cxchgweak_acqrel_acquire(${1:dst}, ${2:old}, ${3:src})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"},"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_acqrel_acquire","imported_name":"atomic_cxchgweak_acqrel_acquire"}]}},{"label":"atomic_cxchgweak_acqrel_relaxed(…) (use std::intrinsics::atomic_cxchgweak_acqrel_relaxed)","kind":3,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::AcqRel`] and [`Ordering::Relaxed`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"deprecated":false,"sortText":"ffffffed","filterText":"atomic_cxchgweak_acqrel_relaxed","insertTextFormat":2,"textEdit":{"newText":"atomic_cxchgweak_acqrel_relaxed(${1:dst}, ${2:old}, ${3:src})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"},"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_acqrel_relaxed","imported_name":"atomic_cxchgweak_acqrel_relaxed"}]}},{"label":"atomic_cxchgweak_acquire_acquire(…) (use std::intrinsics::atomic_cxchgweak_acquire_acquire)","kind":3,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Acquire`] as both the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"deprecated":false,"sortText":"ffffffed","filterText":"atomic_cxchgweak_acquire_acquire","insertTextFormat":2,"textEdit":{"newText":"atomic_cxchgweak_acquire_acquire(${1:dst}, ${2:old}, ${3:src})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"},"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_acquire_acquire","imported_name":"atomic_cxchgweak_acquire_acquire"}]}},{"label":"atomic_cxchgweak_acquire_relaxed(…) (use std::intrinsics::atomic_cxchgweak_acquire_relaxed)","kind":3,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Acquire`] and [`Ordering::Relaxed`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"deprecated":false,"sortText":"ffffffed","filterText":"atomic_cxchgweak_acquire_relaxed","insertTextFormat":2,"textEdit":{"newText":"atomic_cxchgweak_acquire_relaxed(${1:dst}, ${2:old}, ${3:src})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"},"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_acquire_relaxed","imported_name":"atomic_cxchgweak_acquire_relaxed"}]}},{"label":"atomic_cxchgweak_relaxed_acquire(…) (use std::intrinsics::atomic_cxchgweak_relaxed_acquire)","kind":3,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Relaxed`] and [`Ordering::Acquire`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"deprecated":false,"sortText":"ffffffed","filterText":"atomic_cxchgweak_relaxed_acquire","insertTextFormat":2,"textEdit":{"newText":"atomic_cxchgweak_relaxed_acquire(${1:dst}, ${2:old}, ${3:src})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"},"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_relaxed_acquire","imported_name":"atomic_cxchgweak_relaxed_acquire"}]}},{"label":"atomic_cxchgweak_relaxed_relaxed(…) (use std::intrinsics::atomic_cxchgweak_relaxed_relaxed)","kind":3,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Relaxed`] as both the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"deprecated":false,"sortText":"ffffffed","filterText":"atomic_cxchgweak_relaxed_relaxed","insertTextFormat":2,"textEdit":{"newText":"atomic_cxchgweak_relaxed_relaxed(${1:dst}, ${2:old}, ${3:src})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"},"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_relaxed_relaxed","imported_name":"atomic_cxchgweak_relaxed_relaxed"}]}},{"label":"atomic_cxchgweak_release_acquire(…) (use std::intrinsics::atomic_cxchgweak_release_acquire)","kind":3,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Release`] and [`Ordering::Acquire`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"deprecated":false,"sortText":"ffffffed","filterText":"atomic_cxchgweak_release_acquire","insertTextFormat":2,"textEdit":{"newText":"atomic_cxchgweak_release_acquire(${1:dst}, ${2:old}, ${3:src})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"},"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_release_acquire","imported_name":"atomic_cxchgweak_release_acquire"}]}},{"label":"atomic_cxchgweak_release_relaxed(…) (use std::intrinsics::atomic_cxchgweak_release_relaxed)","kind":3,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Release`] and [`Ordering::Relaxed`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"deprecated":false,"sortText":"ffffffed","filterText":"atomic_cxchgweak_release_relaxed","insertTextFormat":2,"textEdit":{"newText":"atomic_cxchgweak_release_relaxed(${1:dst}, ${2:old}, ${3:src})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"},"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_release_relaxed","imported_name":"atomic_cxchgweak_release_relaxed"}]}},{"label":"AncillaryData (use std::os::unix::net::AncillaryData)","kind":13,"documentation":{"kind":"markdown","value":"This enum represent one control message of variable type."},"deprecated":false,"sortText":"fffffff0","filterText":"AncillaryData","textEdit":{"newText":"AncillaryData","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::os::unix::net::AncillaryData","imported_name":"AncillaryData"}]}},{"label":"CharArrayRefSearcher (use std::str::pattern::CharArrayRefSearcher)","kind":22,"documentation":{"kind":"markdown","value":"Associated type for `<&[char; N] as Pattern<'a>>::Searcher`."},"deprecated":false,"sortText":"fffffff0","filterText":"CharArrayRefSearcher","textEdit":{"newText":"CharArrayRefSearcher","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::str::pattern::CharArrayRefSearcher","imported_name":"CharArrayRefSearcher"}]}},{"label":"CharArraySearcher (use std::str::pattern::CharArraySearcher)","kind":22,"documentation":{"kind":"markdown","value":"Associated type for `<[char; N] as Pattern<'a>>::Searcher`."},"deprecated":false,"sortText":"fffffff0","filterText":"CharArraySearcher","textEdit":{"newText":"CharArraySearcher","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::str::pattern::CharArraySearcher","imported_name":"CharArraySearcher"}]}},{"label":"available_parallelism() (alias available_concurrency, hardware_concurrency, num_cpus) (use std::thread::available_parallelism)","kind":3,"detail":"fn() -> Result","documentation":{"kind":"markdown","value":"Returns an estimate of the default amount of parallelism a program should use.\n\nParallelism is a resource. A given machine provides a certain capacity for\nparallelism, i.e., a bound on the number of computations it can perform\nsimultaneously. This number often corresponds to the amount of CPUs a\ncomputer has, but it may diverge in various cases.\n\nHost environments such as VMs or container orchestrators may want to\nrestrict the amount of parallelism made available to programs in them. This\nis often done to limit the potential impact of (unintentionally)\nresource-intensive programs on other programs running on the same machine.\n\n# Limitations\n\nThe purpose of this API is to provide an easy and portable way to query\nthe default amount of parallelism the program should use. Among other things it\ndoes not expose information on NUMA regions, does not account for\ndifferences in (co)processor capabilities or current system load,\nand will not modify the program's global state in order to more accurately\nquery the amount of available parallelism.\n\nWhere both fixed steady-state and burst limits are available the steady-state\ncapacity will be used to ensure more predictable latencies.\n\nResource limits can be changed during the runtime of a program, therefore the value is\nnot cached and instead recomputed every time this function is called. It should not be\ncalled from hot code.\n\nThe value returned by this function should be considered a simplified\napproximation of the actual amount of parallelism available at any given\ntime. To get a more detailed or precise overview of the amount of\nparallelism available to the program, you may wish to use\nplatform-specific APIs as well. The following platform limitations currently\napply to `available_parallelism`:\n\nOn Windows:\n- It may undercount the amount of parallelism available on systems with more\n than 64 logical CPUs. However, programs typically need specific support to\n take advantage of more than 64 logical CPUs, and in the absence of such\n support, the number returned by this function accurately reflects the\n number of logical CPUs the program can use by default.\n- It may overcount the amount of parallelism available on systems limited by\n process-wide affinity masks, or job object limitations.\n\nOn Linux:\n- It may overcount the amount of parallelism available when limited by a\n process-wide affinity mask or cgroup quotas and `sched_getaffinity()` or cgroup fs can't be\n queried, e.g. due to sandboxing.\n- It may undercount the amount of parallelism if the current thread's affinity mask\n does not reflect the process' cpuset, e.g. due to pinned threads.\n- If the process is in a cgroup v1 cpu controller, this may need to\n scan mountpoints to find the corresponding cgroup v1 controller,\n which may take time on systems with large numbers of mountpoints.\n (This does not apply to cgroup v2, or to processes not in a\n cgroup.)\n\nOn all targets:\n- It may overcount the amount of parallelism available when running in a VM\nwith CPU usage limits (e.g. an overcommitted host).\n\n# Errors\n\nThis function will, but is not limited to, return errors in the following\ncases:\n\n- If the amount of parallelism is not known for the target platform.\n- If the program lacks permission to query the amount of parallelism made\n available to it.\n\n# Examples\n\n```rust\nuse std::{io, thread};\n\nfn main() -> io::Result<()> {\n let count = thread::available_parallelism()?.get();\n assert!(count >= 1_usize);\n Ok(())\n}\n```"},"deprecated":false,"sortText":"ffffffed","filterText":"available_parallelismavailable_concurrencyhardware_concurrencynum_cpus","insertTextFormat":2,"textEdit":{"newText":"available_parallelism()$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"data":{"position":{"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"},"position":{"line":1,"character":16}},"imports":[{"full_import_path":"std::thread::available_parallelism","imported_name":"available_parallelism"}]}},{"label":"self::","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"self::","textEdit":{"newText":"self::","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"crate::","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"crate::","textEdit":{"newText":"crate::","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"main()","kind":3,"detail":"fn()","deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"main","insertTextFormat":2,"textEdit":{"newText":"main()$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"panic!(…)","kind":3,"detail":"macro_rules! panic","deprecated":false,"sortText":"ffffffef","filterText":"panic!","insertTextFormat":2,"textEdit":{"newText":"panic!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"println!(…)","kind":3,"detail":"macro_rules! println","documentation":{"kind":"markdown","value":"Prints to the standard output, with a newline.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`)).\n\nThis macro uses the same syntax as [`format!`], but writes to the standard output instead.\nSee [`std::fmt`] for more information.\n\nThe `println!` macro will lock the standard output on each call. If you call\n`println!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwriteln!(lock, \"hello world\").unwrap();\n```\n\nUse `println!` only for the primary output of your program. Use\n[`eprintln!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`std::fmt`]: crate::fmt\n[`eprintln!`]: crate::eprintln\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to [`io::stdout`] fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n[`io::stdout`]: crate::io::stdout\n\n# Examples\n\n```rust\nprintln!(); // prints just a newline\nprintln!(\"hello there!\");\nprintln!(\"format {} arguments\", \"some\");\nlet local_variable = \"some\";\nprintln!(\"format {local_variable} arguments\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"println!","insertTextFormat":2,"textEdit":{"newText":"println!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"debug_assert_eq!(…)","kind":3,"detail":"macro_rules! debug_assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_eq!`], `debug_assert_eq!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_eq!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_eq!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_eq!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\ndebug_assert_eq!(a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert_eq!","insertTextFormat":2,"textEdit":{"newText":"debug_assert_eq!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"include_str!(…)","kind":3,"detail":"macro_rules! include_str","documentation":{"kind":"markdown","value":"Includes a UTF-8 encoded file as a string.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static str` which is the\ncontents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_str = include_str!(\"spanish.in\");\n assert_eq!(my_str, \"adiós\\n\");\n print!(\"{my_str}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include_str!","insertTextFormat":2,"textEdit":{"newText":"include_str!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"concat!(…)","kind":3,"detail":"macro_rules! concat","documentation":{"kind":"markdown","value":"Concatenates literals into a static string slice.\n\nThis macro takes any number of comma-separated literals, yielding an\nexpression of type `&'static str` which represents all of the literals\nconcatenated left-to-right.\n\nInteger and floating point literals are [stringified](core::stringify) in order to be\nconcatenated.\n\n# Examples\n\n```rust\nlet s = concat!(\"test\", 10, 'b', true);\nassert_eq!(s, \"test10btrue\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat!","insertTextFormat":2,"textEdit":{"newText":"concat!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"format!(…)","kind":3,"detail":"macro_rules! format","documentation":{"kind":"markdown","value":"Creates a `String` using interpolation of runtime expressions.\n\nThe first argument `format!` receives is a format string. This must be a string\nliteral. The power of the formatting string is in the `{}`s contained.\nAdditional parameters passed to `format!` replace the `{}`s within the\nformatting string in the order given unless named or positional parameters\nare used.\n\nSee [the formatting syntax documentation in `std::fmt`](../std/fmt/index.html)\nfor details.\n\nA common use for `format!` is concatenation and interpolation of strings.\nThe same convention is used with [`print!`] and [`write!`] macros,\ndepending on the intended destination of the string; all these macros internally use [`format_args!`].\n\nTo convert a single value to a string, use the [`to_string`] method. This\nwill use the [`Display`] formatting trait.\n\nTo concatenate literals into a `&'static str`, use the [`concat!`] macro.\n\n[`print!`]: ../std/macro.print.html\n[`write!`]: core::write\n[`format_args!`]: core::format_args\n[`to_string`]: crate::string::ToString\n[`Display`]: core::fmt::Display\n[`concat!`]: core::concat\n\n# Panics\n\n`format!` panics if a formatting trait implementation returns an error.\nThis indicates an incorrect implementation\nsince `fmt::Write for String` never returns an error itself.\n\n# Examples\n\n```rust\nformat!(\"test\"); // => \"test\"\nformat!(\"hello {}\", \"world!\"); // => \"hello world!\"\nformat!(\"x = {}, y = {val}\", 10, val = 30); // => \"x = 10, y = 30\"\nlet (x, y) = (1, 2);\nformat!(\"{x} + {y} = 3\"); // => \"1 + 2 = 3\"\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"format!","insertTextFormat":2,"textEdit":{"newText":"format!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"log_syntax!(…)","kind":3,"detail":"macro_rules! log_syntax","documentation":{"kind":"markdown","value":"Prints passed tokens into the standard output."},"deprecated":false,"sortText":"ffffffef","filterText":"log_syntax!","insertTextFormat":2,"textEdit":{"newText":"log_syntax!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"stringify!(…)","kind":3,"detail":"macro_rules! stringify","documentation":{"kind":"markdown","value":"Stringifies its arguments.\n\nThis macro will yield an expression of type `&'static str` which is the\nstringification of all the tokens passed to the macro. No restrictions\nare placed on the syntax of the macro invocation itself.\n\nNote that the expanded results of the input tokens may change in the\nfuture. You should be careful if you rely on the output.\n\n# Examples\n\n```rust\nlet one_plus_one = stringify!(1 + 1);\nassert_eq!(one_plus_one, \"1 + 1\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"stringify!","insertTextFormat":2,"textEdit":{"newText":"stringify!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"assert_ne!(…)","kind":3,"detail":"macro_rules! assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\nassert_ne!(a, b);\n\nassert_ne!(a, b, \"we are testing that the values are not equal\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert_ne!","insertTextFormat":2,"textEdit":{"newText":"assert_ne!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"dbg!(…)","kind":3,"detail":"macro_rules! dbg","documentation":{"kind":"markdown","value":"Prints and returns the value of a given expression for quick and dirty\ndebugging.\n\nAn example:\n\n```rust\nlet a = 2;\nlet b = dbg!(a * 2) + 1;\n// ^-- prints: [src/main.rs:2] a * 2 = 4\nassert_eq!(b, 5);\n```\n\nThe macro works by using the `Debug` implementation of the type of\nthe given expression to print the value to [stderr] along with the\nsource location of the macro invocation as well as the source code\nof the expression.\n\nInvoking the macro on an expression moves and takes ownership of it\nbefore returning the evaluated expression unchanged. If the type\nof the expression does not implement `Copy` and you don't want\nto give up ownership, you can instead borrow with `dbg!(&expr)`\nfor some expression `expr`.\n\nThe `dbg!` macro works exactly the same in release builds.\nThis is useful when debugging issues that only occur in release\nbuilds or when debugging in release mode is significantly faster.\n\nNote that the macro is intended as a debugging tool and therefore you\nshould avoid having uses of it in version control for long periods\n(other than in tests and similar).\nDebug output from production code is better done with other facilities\nsuch as the [`debug!`] macro from the [`log`] crate.\n\n# Stability\n\nThe exact output printed by this macro should not be relied upon\nand is subject to future changes.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\n# Further examples\n\nWith a method call:\n\n```rust\nfn foo(n: usize) {\n if let Some(_) = dbg!(n.checked_sub(4)) {\n // ...\n }\n}\n\nfoo(3)\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:4] n.checked_sub(4) = None\n```\n\nNaive factorial implementation:\n\n```rust\nfn factorial(n: u32) -> u32 {\n if dbg!(n <= 1) {\n dbg!(1)\n } else {\n dbg!(n * factorial(n - 1))\n }\n}\n\ndbg!(factorial(4));\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = true\n[src/main.rs:4] 1 = 1\n[src/main.rs:5] n * factorial(n - 1) = 2\n[src/main.rs:5] n * factorial(n - 1) = 6\n[src/main.rs:5] n * factorial(n - 1) = 24\n[src/main.rs:11] factorial(4) = 24\n```\n\nThe `dbg!(..)` macro moves the input:\n\n```rust\n/// A wrapper around `usize` which importantly is not Copyable.\n#[derive(Debug)]\nstruct NoCopy(usize);\n\nlet a = NoCopy(42);\nlet _ = dbg!(a); // <-- `a` is moved here.\nlet _ = dbg!(a); // <-- `a` is moved again; error!\n```\n\nYou can also use `dbg!()` without a value to just print the\nfile and line whenever it's reached.\n\nFinally, if you want to `dbg!(..)` multiple values, it will treat them as\na tuple (and return it, too):\n\n```rust\nassert_eq!(dbg!(1usize, 2u32), (1, 2));\n```\n\nHowever, a single argument with a trailing comma will still not be treated\nas a tuple, following the convention of ignoring trailing commas in macro\ninvocations. You can use a 1-tuple directly if you need one:\n\n```rust\nassert_eq!(1, dbg!(1u32,)); // trailing comma ignored\nassert_eq!((1,), dbg!((1u32,))); // 1-tuple\n```\n\n[stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)\n[`debug!`]: https://docs.rs/log/*/log/macro.debug.html\n[`log`]: https://crates.io/crates/log"},"deprecated":false,"sortText":"ffffffef","filterText":"dbg!","insertTextFormat":2,"textEdit":{"newText":"dbg!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"vec![…]","kind":3,"detail":"macro_rules! vec","documentation":{"kind":"markdown","value":"Creates a [`Vec`] containing the arguments.\n\n`vec!` allows `Vec`s to be defined with the same syntax as array expressions.\nThere are two forms of this macro:\n\n- Create a [`Vec`] containing a given list of elements:\n\n```rust\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```\n\n- Create a [`Vec`] from a given element and size:\n\n```rust\nlet v = vec![1; 3];\nassert_eq!(v, [1, 1, 1]);\n```\n\nNote that unlike array expressions this syntax supports all elements\nwhich implement [`Clone`] and the number of elements doesn't have to be\na constant.\n\nThis will use `clone` to duplicate an expression, so one should be careful\nusing this with types having a nonstandard `Clone` implementation. For\nexample, `vec![Rc::new(1); 5]` will create a vector of five references\nto the same boxed integer value, not five references pointing to independently\nboxed integers.\n\nAlso, note that `vec![expr; 0]` is allowed, and produces an empty vector.\nThis will still evaluate `expr`, however, and immediately drop the resulting value, so\nbe mindful of side effects.\n\n[`Vec`]: crate::vec::Vec"},"deprecated":false,"sortText":"ffffffef","filterText":"vec!","insertTextFormat":2,"textEdit":{"newText":"vec![$0]","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"include!(…)","kind":3,"detail":"macro_rules! include","documentation":{"kind":"markdown","value":"Parses a file as an expression or an item according to the context.\n\n**Warning**: For multi-file Rust projects, the `include!` macro is probably not what you\nare looking for. Usually, multi-file Rust projects use\n[modules](https://doc.rust-lang.org/reference/items/modules.html). Multi-file projects and\nmodules are explained in the Rust-by-Example book\n[here](https://doc.rust-lang.org/rust-by-example/mod/split.html) and the module system is\nexplained in the Rust Book\n[here](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html).\n\nThe included file is placed in the surrounding code\n[unhygienically](https://doc.rust-lang.org/reference/macros-by-example.html#hygiene). If\nthe included file is parsed as an expression and variables or functions share names across\nboth files, it could result in variables or functions being different from what the\nincluded file expected.\n\nThe included file is located relative to the current file (similarly to how modules are\nfound). The provided path is interpreted in a platform-specific way at compile time. So,\nfor instance, an invocation with a Windows path containing backslashes `\\` would not\ncompile correctly on Unix.\n\n# Uses\n\nThe `include!` macro is primarily used for two purposes. It is used to include\ndocumentation that is written in a separate file and it is used to include [build artifacts\nusually as a result from the `build.rs`\nscript](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script).\n\nWhen using the `include` macro to include stretches of documentation, remember that the\nincluded file still needs to be a valid rust syntax. It is also possible to\nuse the [`include_str`] macro as `#![doc = include_str!(\"...\")]` (at the module level) or\n`#[doc = include_str!(\"...\")]` (at the item level) to include documentation from a plain\ntext or markdown file.\n\n# Examples\n\nAssume there are two files in the same directory with the following contents:\n\nFile 'monkeys.in':\n\n```rust\n['🙈', '🙊', '🙉']\n .iter()\n .cycle()\n .take(6)\n .collect::()\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_string = include!(\"monkeys.in\");\n assert_eq!(\"🙈🙊🙉🙈🙊🙉\", my_string);\n println!(\"{my_string}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print\n\"🙈🙊🙉🙈🙊🙉\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include!","insertTextFormat":2,"textEdit":{"newText":"include!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"print!(…)","kind":3,"detail":"macro_rules! print","documentation":{"kind":"markdown","value":"Prints to the standard output.\n\nEquivalent to the [`println!`] macro except that a newline is not printed at\nthe end of the message.\n\nNote that stdout is frequently line-buffered by default so it may be\nnecessary to use [`io::stdout().flush()`][flush] to ensure the output is emitted\nimmediately.\n\nThe `print!` macro will lock the standard output on each call. If you call\n`print!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwrite!(lock, \"hello world\").unwrap();\n```\n\nUse `print!` only for the primary output of your program. Use\n[`eprint!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[flush]: crate::io::Write::flush\n[`println!`]: crate::println\n[`eprint!`]: crate::eprint\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to `io::stdout()` fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\nuse std::io::{self, Write};\n\nprint!(\"this \");\nprint!(\"will \");\nprint!(\"be \");\nprint!(\"on \");\nprint!(\"the \");\nprint!(\"same \");\nprint!(\"line \");\n\nio::stdout().flush().unwrap();\n\nprint!(\"this string has a newline, why not choose println! instead?\\n\");\n\nio::stdout().flush().unwrap();\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"print!","insertTextFormat":2,"textEdit":{"newText":"print!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"cfg_match! {…}","kind":3,"detail":"macro cfg_match","documentation":{"kind":"markdown","value":"A macro for defining `#[cfg]` match-like statements.\n\nIt is similar to the `if/elif` C preprocessor macro by allowing definition of a cascade of\n`#[cfg]` cases, emitting the implementation which matches first.\n\nThis allows you to conveniently provide a long list `#[cfg]`'d blocks of code\nwithout having to rewrite each clause multiple times.\n\nTrailing `_` wildcard match arms are **optional** and they indicate a fallback branch when\nall previous declarations do not evaluate to true.\n\n# Example\n\n```rust\n#![feature(cfg_match)]\n\ncfg_match! {\n cfg(unix) => {\n fn foo() { /* unix specific functionality */ }\n }\n cfg(target_pointer_width = \"32\") => {\n fn foo() { /* non-unix, 32-bit functionality */ }\n }\n _ => {\n fn foo() { /* fallback implementation */ }\n }\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"cfg_match!","insertTextFormat":2,"textEdit":{"newText":"cfg_match! {$0}","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"concat_idents!(…)","kind":3,"detail":"macro_rules! concat_idents","documentation":{"kind":"markdown","value":"Concatenates identifiers into one identifier.\n\nThis macro takes any number of comma-separated identifiers, and\nconcatenates them all into one, yielding an expression which is a new\nidentifier. Note that hygiene makes it such that this macro cannot\ncapture local variables. Also, as a general rule, macros are only\nallowed in item, statement or expression position. That means while\nyou may use this macro for referring to existing variables, functions or\nmodules etc, you cannot define a new one with it.\n\n# Examples\n\n```rust\n#![feature(concat_idents)]\n\nfn foobar() -> u32 { 23 }\n\nlet f = concat_idents!(foo, bar);\nprintln!(\"{}\", f());\n\n// fn concat_idents!(new, fun, name) { } // not usable in this way!\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat_idents!","insertTextFormat":2,"textEdit":{"newText":"concat_idents!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"write!(…)","kind":3,"detail":"macro_rules! write","documentation":{"kind":"markdown","value":"Writes formatted data into a buffer.\n\nThis macro accepts a 'writer', a format string, and a list of arguments. Arguments will be\nformatted according to the specified format string and the result will be passed to the writer.\nThe writer may be any value with a `write_fmt` method; generally this comes from an\nimplementation of either the [`fmt::Write`] or the [`io::Write`] trait. The macro\nreturns whatever the `write_fmt` method returns; commonly a [`fmt::Result`], or an\n[`io::Result`].\n\nSee [`std::fmt`] for more information on the format string syntax.\n\n[`std::fmt`]: ../std/fmt/index.html\n[`fmt::Write`]: crate::fmt::Write\n[`io::Write`]: ../std/io/trait.Write.html\n[`fmt::Result`]: crate::fmt::Result\n[`io::Result`]: ../std/io/type.Result.html\n\n# Examples\n\n```rust\nuse std::io::Write;\n\nfn main() -> std::io::Result<()> {\n let mut w = Vec::new();\n write!(&mut w, \"test\")?;\n write!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(w, b\"testformatted arguments\");\n Ok(())\n}\n```\n\nA module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects\nimplementing either, as objects do not typically implement both. However, the module must\navoid conflict between the trait names, such as by importing them as `_` or otherwise renaming\nthem:\n\n```rust\nuse std::fmt::Write as _;\nuse std::io::Write as _;\n\nfn main() -> Result<(), Box> {\n let mut s = String::new();\n let mut v = Vec::new();\n\n write!(&mut s, \"{} {}\", \"abc\", 123)?; // uses fmt::Write::write_fmt\n write!(&mut v, \"s = {:?}\", s)?; // uses io::Write::write_fmt\n assert_eq!(v, b\"s = \\\"abc 123\\\"\");\n Ok(())\n}\n```\n\nIf you also need the trait names themselves, such as to implement one or both on your types,\nimport the containing module and then name them with a prefix:\n\n```rust\nuse std::fmt::{self, Write as _};\nuse std::io::{self, Write as _};\n\nstruct Example;\n\nimpl fmt::Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n```\n\nNote: This macro can be used in `no_std` setups as well.\nIn a `no_std` setup you are responsible for the implementation details of the components.\n\n```rust\nuse core::fmt::Write;\n\nstruct Example;\n\nimpl Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n\nlet mut m = Example{};\nwrite!(&mut m, \"Hello World\").expect(\"Not written\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"write!","insertTextFormat":2,"textEdit":{"newText":"write!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"line!(…)","kind":3,"detail":"macro_rules! line","documentation":{"kind":"markdown","value":"Expands to the line number on which it was invoked.\n\nWith [`column!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first line\nin each file evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned line is *not necessarily* the line of the `line!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `line!` macro.\n\n# Examples\n\n```rust\nlet current_line = line!();\nprintln!(\"defined on line: {current_line}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"line!","insertTextFormat":2,"textEdit":{"newText":"line!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"debug_assert!(…)","kind":3,"detail":"macro_rules! debug_assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\nLike [`assert!`], this macro also has a second version, where a custom panic\nmessage can be provided.\n\n# Uses\n\nUnlike [`assert!`], `debug_assert!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert!` is always type checked.\n\nAn unchecked assertion allows a program in an inconsistent state to keep\nrunning, which might have unexpected consequences but does not introduce\nunsafety as long as this only happens in safe code. The performance cost\nof assertions, however, is not measurable in general. Replacing [`assert!`]\nwith `debug_assert!` is thus only encouraged after thorough profiling, and\nmore importantly, only in safe code!\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\ndebug_assert!(true);\n\nfn some_expensive_computation() -> bool { true } // a very simple function\ndebug_assert!(some_expensive_computation());\n\n// assert with a custom message\nlet x = true;\ndebug_assert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\ndebug_assert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert!","insertTextFormat":2,"textEdit":{"newText":"debug_assert!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"include_bytes!(…)","kind":3,"detail":"macro_rules! include_bytes","documentation":{"kind":"markdown","value":"Includes a file as a reference to a byte array.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static [u8; N]` which is\nthe contents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let bytes = include_bytes!(\"spanish.in\");\n assert_eq!(bytes, b\"adi\\xc3\\xb3s\\n\");\n print!(\"{}\", String::from_utf8_lossy(bytes));\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include_bytes!","insertTextFormat":2,"textEdit":{"newText":"include_bytes!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"const_format_args!(…)","kind":3,"detail":"macro_rules! const_format_args","documentation":{"kind":"markdown","value":"Same as [`format_args`], but can be used in some const contexts.\n\nThis macro is used by the panic macros for the `const_panic` feature.\n\nThis macro will be removed once `format_args` is allowed in const contexts."},"deprecated":false,"sortText":"ffffffef","filterText":"const_format_args!","insertTextFormat":2,"textEdit":{"newText":"const_format_args!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"env!(…)","kind":3,"detail":"macro_rules! env","documentation":{"kind":"markdown","value":"Inspects an environment variable at compile time.\n\nThis macro will expand to the value of the named environment variable at\ncompile time, yielding an expression of type `&'static str`. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nIf the environment variable is not defined, then a compilation error\nwill be emitted. To not emit a compile error, use the [`option_env!`]\nmacro instead.\n\n# Examples\n\n```rust\nlet path: &'static str = env!(\"PATH\");\nprintln!(\"the $PATH variable at the time of compiling was: {path}\");\n```\n\nYou can customize the error message by passing a string as the second\nparameter:\n\n```rust\nlet doc: &'static str = env!(\"documentation\", \"what's that?!\");\n```\n\nIf the `documentation` environment variable is not defined, you'll get\nthe following error:\n\n```text\nerror: what's that?!\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"env!","insertTextFormat":2,"textEdit":{"newText":"env!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"try!(…)","kind":3,"detail":"macro_rules! r#try","documentation":{"kind":"markdown","value":"Unwraps a result or propagates its error.\n\nThe [`?` operator][propagating-errors] was added to replace `try!`\nand should be used instead. Furthermore, `try` is a reserved word\nin Rust 2018, so if you must use it, you will need to use the\n[raw-identifier syntax][ris]: `r#try`.\n\n[propagating-errors]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator\n[ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html\n\n`try!` matches the given [`Result`]. In case of the `Ok` variant, the\nexpression has the value of the wrapped value.\n\nIn case of the `Err` variant, it retrieves the inner error. `try!` then\nperforms conversion using `From`. This provides automatic conversion\nbetween specialized errors and more general ones. The resulting\nerror is then immediately returned.\n\nBecause of the early return, `try!` can only be used in functions that\nreturn [`Result`].\n\n# Examples\n\n```rust\nuse std::io;\nuse std::fs::File;\nuse std::io::prelude::*;\n\nenum MyError {\n FileWriteError\n}\n\nimpl From for MyError {\n fn from(e: io::Error) -> MyError {\n MyError::FileWriteError\n }\n}\n\n// The preferred method of quick returning Errors\nfn write_to_file_question() -> Result<(), MyError> {\n let mut file = File::create(\"my_best_friends.txt\")?;\n file.write_all(b\"This is a list of my best friends.\")?;\n Ok(())\n}\n\n// The previous method of quick returning Errors\nfn write_to_file_using_try() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n r#try!(file.write_all(b\"This is a list of my best friends.\"));\n Ok(())\n}\n\n// This is equivalent to:\nfn write_to_file_using_match() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n match file.write_all(b\"This is a list of my best friends.\") {\n Ok(v) => v,\n Err(e) => return Err(From::from(e)),\n }\n Ok(())\n}\n```"},"deprecated":true,"sortText":"ffffffef","filterText":"try!","insertTextFormat":2,"textEdit":{"newText":"r#try!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"tags":[1]},{"label":"file!(…)","kind":3,"detail":"macro_rules! file","documentation":{"kind":"markdown","value":"Expands to the file name in which it was invoked.\n\nWith [`line!`] and [`column!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `&'static str`, and the returned file\nis not the invocation of the `file!` macro itself, but rather the\nfirst macro invocation leading up to the invocation of the `file!`\nmacro.\n\n# Examples\n\n```rust\nlet this_file = file!();\nprintln!(\"defined in file: {this_file}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"file!","insertTextFormat":2,"textEdit":{"newText":"file!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"thread_local! {…}","kind":3,"detail":"macro_rules! thread_local","documentation":{"kind":"markdown","value":"Declare a new thread local storage key of type [`std::thread::LocalKey`].\n\n# Syntax\n\nThe macro wraps any number of static declarations and makes them thread local.\nPublicity and attributes for each static are allowed. Example:\n\n```rust\nuse std::cell::RefCell;\nthread_local! {\n pub static FOO: RefCell = RefCell::new(1);\n\n static BAR: RefCell = RefCell::new(1.0);\n}\n\nFOO.with(|foo| assert_eq!(*foo.borrow(), 1));\nBAR.with(|bar| assert_eq!(*bar.borrow(), 1.0));\n```\n\nThis macro supports a special `const {}` syntax that can be used\nwhen the initialization expression can be evaluated as a constant.\nThis can enable a more efficient thread local implementation that\ncan avoid lazy initialization. For types that do not\n[need to be dropped][crate::mem::needs_drop], this can enable an\neven more efficient implementation that does not need to\ntrack any additional state.\n\n```rust\nuse std::cell::Cell;\nthread_local! {\n pub static FOO: Cell = const { Cell::new(1) };\n}\n\nFOO.with(|foo| assert_eq!(foo.get(), 1));\n```\n\nSee [`LocalKey` documentation][`std::thread::LocalKey`] for more\ninformation.\n\n[`std::thread::LocalKey`]: crate::thread::LocalKey"},"deprecated":false,"sortText":"ffffffef","filterText":"thread_local!","insertTextFormat":2,"textEdit":{"newText":"thread_local! {$0}","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"assert!(…)","kind":3,"detail":"macro_rules! assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\n# Uses\n\nAssertions are always checked in both debug and release builds, and cannot\nbe disabled. See [`debug_assert!`] for assertions that are not enabled in\nrelease builds by default.\n\nUnsafe code may rely on `assert!` to enforce run-time invariants that, if\nviolated could lead to unsafety.\n\nOther use-cases of `assert!` include testing and enforcing run-time\ninvariants in safe code (whose violation cannot result in unsafety).\n\n# Custom Messages\n\nThis macro has a second form, where a custom panic message can\nbe provided with or without arguments for formatting. See [`std::fmt`]\nfor syntax for this form. Expressions used as format arguments will only\nbe evaluated if the assertion fails.\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\nassert!(true);\n\nfn some_computation() -> bool { true } // a very simple function\n\nassert!(some_computation());\n\n// assert with a custom message\nlet x = true;\nassert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\nassert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert!","insertTextFormat":2,"textEdit":{"newText":"assert!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"column!(…)","kind":3,"detail":"macro_rules! column","documentation":{"kind":"markdown","value":"Expands to the column number at which it was invoked.\n\nWith [`line!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first column\nin each line evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned column is *not necessarily* the line of the `column!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `column!` macro.\n\n# Examples\n\n```rust\nlet current_col = column!();\nprintln!(\"defined on column: {current_col}\");\n```\n\n`column!` counts Unicode code points, not bytes or graphemes. As a result, the first two\ninvocations return the same value, but the third does not.\n\n```rust\nlet a = (\"foobar\", column!()).1;\nlet b = (\"人之初性本善\", column!()).1;\nlet c = (\"f̅o̅o̅b̅a̅r̅\", column!()).1; // Uses combining overline (U+0305)\n\nassert_eq!(a, b);\nassert_ne!(b, c);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"column!","insertTextFormat":2,"textEdit":{"newText":"column!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"format_args_nl!(…)","kind":3,"detail":"macro_rules! format_args_nl","documentation":{"kind":"markdown","value":"Same as [`format_args`], but adds a newline in the end."},"deprecated":false,"sortText":"ffffffef","filterText":"format_args_nl!","insertTextFormat":2,"textEdit":{"newText":"format_args_nl!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"unreachable!(…)","kind":3,"detail":"macro_rules! unreachable","documentation":{"kind":"markdown","value":"Indicates unreachable code.\n\nThis is useful any time that the compiler can't determine that some code is unreachable. For\nexample:\n\n* Match arms with guard conditions.\n* Loops that dynamically terminate.\n* Iterators that dynamically terminate.\n\nIf the determination that the code is unreachable proves incorrect, the\nprogram immediately terminates with a [`panic!`].\n\nThe unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which\nwill cause undefined behavior if the code is reached.\n\n[`unreachable_unchecked`]: crate::hint::unreachable_unchecked\n\n# Panics\n\nThis will always [`panic!`] because `unreachable!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nMatch arms:\n\n```rust\nfn foo(x: Option) {\n match x {\n Some(n) if n >= 0 => println!(\"Some(Non-negative)\"),\n Some(n) if n < 0 => println!(\"Some(Negative)\"),\n Some(_) => unreachable!(), // compile error if commented out\n None => println!(\"None\")\n }\n}\n```\n\nIterators:\n\n```rust\nfn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3\n for i in 0.. {\n if 3*i < i { panic!(\"u32 overflow\"); }\n if x < 3*i { return i-1; }\n }\n unreachable!(\"The loop should always return\");\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"unreachable!","insertTextFormat":2,"textEdit":{"newText":"unreachable!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"eprintln!(…)","kind":3,"detail":"macro_rules! eprintln","documentation":{"kind":"markdown","value":"Prints to the standard error, with a newline.\n\nEquivalent to the [`println!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`println!`] for\nexample usage.\n\nUse `eprintln!` only for error and progress messages. Use `println!`\ninstead for the primary output of your program.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n[`println!`]: crate::println\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprintln!(\"Error: Could not complete task\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"eprintln!","insertTextFormat":2,"textEdit":{"newText":"eprintln!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"unimplemented!(…)","kind":3,"detail":"macro_rules! unimplemented","documentation":{"kind":"markdown","value":"Indicates unimplemented code by panicking with a message of \"not implemented\".\n\nThis allows your code to type-check, which is useful if you are prototyping or\nimplementing a trait that requires multiple methods which you don't plan to use all of.\n\nThe difference between `unimplemented!` and [`todo!`] is that while `todo!`\nconveys an intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `unimplemented!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n[`todo!`]: crate::todo\n\n# Examples\n\nSay we have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` for 'MyStruct', but for some reason it only makes sense\nto implement the `bar()` function. `baz()` and `qux()` will still need to be defined\nin our implementation of `Foo`, but we can use `unimplemented!` in their definitions\nto allow our code to compile.\n\nWe still want to have our program stop running if the unimplemented methods are\nreached.\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // It makes no sense to `baz` a `MyStruct`, so we have no logic here\n // at all.\n // This will display \"thread 'main' panicked at 'not implemented'\".\n unimplemented!();\n }\n\n fn qux(&self) -> Result {\n // We have some logic here,\n // We can add a message to unimplemented! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not implemented: MyStruct isn't quxable'\".\n unimplemented!(\"MyStruct isn't quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"unimplemented!","insertTextFormat":2,"textEdit":{"newText":"unimplemented!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"cfg!(…)","kind":3,"detail":"macro_rules! cfg","documentation":{"kind":"markdown","value":"Evaluates boolean combinations of configuration flags at compile-time.\n\nIn addition to the `#[cfg]` attribute, this macro is provided to allow\nboolean expression evaluation of configuration flags. This frequently\nleads to less duplicated code.\n\nThe syntax given to this macro is the same syntax as the [`cfg`]\nattribute.\n\n`cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For\nexample, all blocks in an if/else expression need to be valid when `cfg!` is used for\nthe condition, regardless of what `cfg!` is evaluating.\n\n[`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute\n\n# Examples\n\n```rust\nlet my_directory = if cfg!(windows) {\n \"windows-specific-directory\"\n} else {\n \"unix-directory\"\n};\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"cfg!","insertTextFormat":2,"textEdit":{"newText":"cfg!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"todo!(…)","kind":3,"detail":"macro_rules! todo","documentation":{"kind":"markdown","value":"Indicates unfinished code.\n\nThis can be useful if you are prototyping and just\nwant a placeholder to let your code pass type analysis.\n\nThe difference between [`unimplemented!`] and `todo!` is that while `todo!` conveys\nan intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `todo!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nHere's an example of some in-progress code. We have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` on one of our types, but we also want to work on\njust `bar()` first. In order for our code to compile, we need to implement\n`baz()` and `qux()`, so we can use `todo!`:\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // Let's not worry about implementing baz() for now\n todo!();\n }\n\n fn qux(&self) -> Result {\n // We can add a message to todo! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not yet implemented: MyStruct is not yet quxable'\".\n todo!(\"MyStruct is not yet quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n\n // We aren't even using baz() or qux(), so this is fine.\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"todo!","insertTextFormat":2,"textEdit":{"newText":"todo!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"trace_macros!(…)","kind":3,"detail":"macro_rules! trace_macros","documentation":{"kind":"markdown","value":"Enables or disables tracing functionality used for debugging other macros."},"deprecated":false,"sortText":"ffffffef","filterText":"trace_macros!","insertTextFormat":2,"textEdit":{"newText":"trace_macros!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"module_path!(…)","kind":3,"detail":"macro_rules! module_path","documentation":{"kind":"markdown","value":"Expands to a string that represents the current module path.\n\nThe current module path can be thought of as the hierarchy of modules\nleading back up to the crate root. The first component of the path\nreturned is the name of the crate currently being compiled.\n\n# Examples\n\n```rust\nmod test {\n pub fn foo() {\n assert!(module_path!().ends_with(\"test\"));\n }\n}\n\ntest::foo();\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"module_path!","insertTextFormat":2,"textEdit":{"newText":"module_path!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"option_env!(…)","kind":3,"detail":"macro_rules! option_env","documentation":{"kind":"markdown","value":"Optionally inspects an environment variable at compile time.\n\nIf the named environment variable is present at compile time, this will\nexpand into an expression of type `Option<&'static str>` whose value is\n`Some` of the value of the environment variable. If the environment\nvariable is not present, then this will expand to `None`. See\n[`Option`][Option] for more information on this type. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nA compile time error is never emitted when using this macro regardless\nof whether the environment variable is present or not.\nTo emit a compile error if the environment variable is not present,\nuse the [`env!`] macro instead.\n\n# Examples\n\n```rust\nlet key: Option<&'static str> = option_env!(\"SECRET_KEY\");\nprintln!(\"the secret key might be: {key:?}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"option_env!","insertTextFormat":2,"textEdit":{"newText":"option_env!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"writeln!(…)","kind":3,"detail":"macro_rules! writeln","documentation":{"kind":"markdown","value":"Write formatted data into a buffer, with a newline appended.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`).\n\nFor more information, see [`write!`]. For information on the format string syntax, see\n[`std::fmt`].\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\nuse std::io::{Write, Result};\n\nfn main() -> Result<()> {\n let mut w = Vec::new();\n writeln!(&mut w)?;\n writeln!(&mut w, \"test\")?;\n writeln!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(&w[..], \"\\ntest\\nformatted arguments\\n\".as_bytes());\n Ok(())\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"writeln!","insertTextFormat":2,"textEdit":{"newText":"writeln!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"assert_eq!(…)","kind":3,"detail":"macro_rules! assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\nassert_eq!(a, b);\n\nassert_eq!(a, b, \"we are testing addition with {} and {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert_eq!","insertTextFormat":2,"textEdit":{"newText":"assert_eq!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"compile_error!(…)","kind":3,"detail":"macro_rules! compile_error","documentation":{"kind":"markdown","value":"Causes compilation to fail with the given error message when encountered.\n\nThis macro should be used when a crate uses a conditional compilation strategy to provide\nbetter error messages for erroneous conditions. It's the compiler-level form of [`panic!`],\nbut emits an error during *compilation* rather than at *runtime*.\n\n# Examples\n\nTwo such examples are macros and `#[cfg]` environments.\n\nEmit a better compiler error if a macro is passed invalid values. Without the final branch,\nthe compiler would still emit an error, but the error's message would not mention the two\nvalid values.\n\n```rust\nmacro_rules! give_me_foo_or_bar {\n (foo) => {};\n (bar) => {};\n ($x:ident) => {\n compile_error!(\"This macro only accepts `foo` or `bar`\");\n }\n}\n\ngive_me_foo_or_bar!(neither);\n// ^ will fail at compile time with message \"This macro only accepts `foo` or `bar`\"\n```\n\nEmit a compiler error if one of a number of features isn't available.\n\n```rust\n#[cfg(not(any(feature = \"foo\", feature = \"bar\")))]\ncompile_error!(\"Either feature \\\"foo\\\" or \\\"bar\\\" must be enabled for this crate.\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"compile_error!","insertTextFormat":2,"textEdit":{"newText":"compile_error!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"matches!(…)","kind":3,"detail":"macro_rules! matches","documentation":{"kind":"markdown","value":"Returns whether the given expression matches any of the given patterns.\n\nLike in a `match` expression, the pattern can be optionally followed by `if`\nand a guard expression that has access to names bound by the pattern.\n\n# Examples\n\n```rust\nlet foo = 'f';\nassert!(matches!(foo, 'A'..='Z' | 'a'..='z'));\n\nlet bar = Some(4);\nassert!(matches!(bar, Some(x) if x > 2));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"matches!","insertTextFormat":2,"textEdit":{"newText":"matches!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"format_args!(…)","kind":3,"detail":"macro_rules! format_args","documentation":{"kind":"markdown","value":"Constructs parameters for the other string-formatting macros.\n\nThis macro functions by taking a formatting string literal containing\n`{}` for each additional argument passed. `format_args!` prepares the\nadditional parameters to ensure the output can be interpreted as a string\nand canonicalizes the arguments into a single type. Any value that implements\nthe [`Display`] trait can be passed to `format_args!`, as can any\n[`Debug`] implementation be passed to a `{:?}` within the formatting string.\n\nThis macro produces a value of type [`fmt::Arguments`]. This value can be\npassed to the macros within [`std::fmt`] for performing useful redirection.\nAll other formatting macros ([`format!`], [`write!`], [`println!`], etc) are\nproxied through this one. `format_args!`, unlike its derived macros, avoids\nheap allocations.\n\nYou can use the [`fmt::Arguments`] value that `format_args!` returns\nin `Debug` and `Display` contexts as seen below. The example also shows\nthat `Debug` and `Display` format to the same thing: the interpolated\nformat string in `format_args!`.\n\n```rust\nlet debug = format!(\"{:?}\", format_args!(\"{} foo {:?}\", 1, 2));\nlet display = format!(\"{}\", format_args!(\"{} foo {:?}\", 1, 2));\nassert_eq!(\"1 foo 2\", display);\nassert_eq!(display, debug);\n```\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax, and further information.\n\n[`Display`]: crate::fmt::Display\n[`Debug`]: crate::fmt::Debug\n[`fmt::Arguments`]: crate::fmt::Arguments\n[`std::fmt`]: ../std/fmt/index.html\n[`format!`]: ../std/macro.format.html\n[`println!`]: ../std/macro.println.html\n\n# Examples\n\n```rust\nuse std::fmt;\n\nlet s = fmt::format(format_args!(\"hello {}\", \"world\"));\nassert_eq!(s, format!(\"hello {}\", \"world\"));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"format_args!","insertTextFormat":2,"textEdit":{"newText":"format_args!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"is_x86_feature_detected!(…)","kind":3,"detail":"macro_rules! is_x86_feature_detected","documentation":{"kind":"markdown","value":"A macro to test at *runtime* whether a CPU feature is available on\nx86/x86-64 platforms.\n\nThis macro is provided in the standard library and will detect at runtime\nwhether the specified CPU feature is detected. This does **not** resolve at\ncompile time unless the specified feature is already enabled for the entire\ncrate. Runtime detection currently relies mostly on the `cpuid` instruction.\n\nThis macro only takes one argument which is a string literal of the feature\nbeing tested for. The feature names supported are the lowercase versions of\nthe ones defined by Intel in [their documentation][docs].\n\n## Supported arguments\n\nThis macro supports the same names that `#[target_feature]` supports. Unlike\n`#[target_feature]`, however, this macro does not support names separated\nwith a comma. Instead testing for multiple features must be done through\nseparate macro invocations for now.\n\nSupported arguments are:\n\n* `\"aes\"`\n* `\"pclmulqdq\"`\n* `\"rdrand\"`\n* `\"rdseed\"`\n* `\"tsc\"`\n* `\"mmx\"`\n* `\"sse\"`\n* `\"sse2\"`\n* `\"sse3\"`\n* `\"ssse3\"`\n* `\"sse4.1\"`\n* `\"sse4.2\"`\n* `\"sse4a\"`\n* `\"sha\"`\n* `\"avx\"`\n* `\"avx2\"`\n* `\"avx512f\"`\n* `\"avx512cd\"`\n* `\"avx512er\"`\n* `\"avx512pf\"`\n* `\"avx512bw\"`\n* `\"avx512dq\"`\n* `\"avx512vl\"`\n* `\"avx512ifma\"`\n* `\"avx512vbmi\"`\n* `\"avx512vpopcntdq\"`\n* `\"avx512vbmi2\"`\n* `\"gfni\"`\n* `\"vaes\"`\n* `\"vpclmulqdq\"`\n* `\"avx512vnni\"`\n* `\"avx512bitalg\"`\n* `\"avx512bf16\"`\n* `\"avx512vp2intersect\"`\n* `\"f16c\"`\n* `\"fma\"`\n* `\"bmi1\"`\n* `\"bmi2\"`\n* `\"abm\"`\n* `\"lzcnt\"`\n* `\"tbm\"`\n* `\"popcnt\"`\n* `\"fxsr\"`\n* `\"xsave\"`\n* `\"xsaveopt\"`\n* `\"xsaves\"`\n* `\"xsavec\"`\n* `\"cmpxchg16b\"`\n* `\"adx\"`\n* `\"rtm\"`\n* `\"movbe\"`\n* `\"ermsb\"`\n\n[docs]: https://software.intel.com/sites/landingpage/IntrinsicsGuide"},"deprecated":false,"sortText":"ffffffef","filterText":"is_x86_feature_detected!","insertTextFormat":2,"textEdit":{"newText":"is_x86_feature_detected!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"concat_bytes!(…)","kind":3,"detail":"macro_rules! concat_bytes","documentation":{"kind":"markdown","value":"Concatenates literals into a byte slice.\n\nThis macro takes any number of comma-separated literals, and concatenates them all into\none, yielding an expression of type `&[u8; _]`, which represents all of the literals\nconcatenated left-to-right. The literals passed can be any combination of:\n\n- byte literals (`b'r'`)\n- byte strings (`b\"Rust\"`)\n- arrays of bytes/numbers (`[b'A', 66, b'C']`)\n\n# Examples\n\n```rust\n#![feature(concat_bytes)]\n\nlet s: &[u8; 6] = concat_bytes!(b'A', b\"BC\", [68, b'E', 70]);\nassert_eq!(s, b\"ABCDEF\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat_bytes!","insertTextFormat":2,"textEdit":{"newText":"concat_bytes!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"eprint!(…)","kind":3,"detail":"macro_rules! eprint","documentation":{"kind":"markdown","value":"Prints to the standard error.\n\nEquivalent to the [`print!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`print!`] for\nexample usage.\n\nUse `eprint!` only for error and progress messages. Use `print!`\ninstead for the primary output of your program.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprint!(\"Error: Could not complete task\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"eprint!","insertTextFormat":2,"textEdit":{"newText":"eprint!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"debug_assert_ne!(…)","kind":3,"detail":"macro_rules! debug_assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_ne!`], `debug_assert_ne!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_ne!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_ne!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_ne!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\ndebug_assert_ne!(a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert_ne!","insertTextFormat":2,"textEdit":{"newText":"debug_assert_ne!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"std","kind":9,"documentation":{"kind":"markdown","value":"# The Rust Standard Library\n\nThe Rust Standard Library is the foundation of portable Rust software, a\nset of minimal and battle-tested shared abstractions for the [broader Rust\necosystem][crates.io]. It offers core types, like [`Vec`] and\n[`Option`], library-defined [operations on language\nprimitives](#primitives), [standard macros](#macros), [I/O] and\n[multithreading], among [many other things][other].\n\n`std` is available to all Rust crates by default. Therefore, the\nstandard library can be accessed in [`use`] statements through the path\n`std`, as in [`use std::env`].\n\n# How to read this documentation\n\nIf you already know the name of what you are looking for, the fastest way to\nfind it is to use the search\nbar at the top of the page.\n\nOtherwise, you may want to jump to one of these useful sections:\n\n* [`std::*` modules](#modules)\n* [Primitive types](#primitives)\n* [Standard macros](#macros)\n* [The Rust Prelude]\n\nIf this is your first time, the documentation for the standard library is\nwritten to be casually perused. Clicking on interesting things should\ngenerally lead you to interesting places. Still, there are important bits\nyou don't want to miss, so read on for a tour of the standard library and\nits documentation!\n\nOnce you are familiar with the contents of the standard library you may\nbegin to find the verbosity of the prose distracting. At this stage in your\ndevelopment you may want to press the `[-]` button near the top of the\npage to collapse it into a more skimmable view.\n\nWhile you are looking at that `[-]` button also notice the `source`\nlink. Rust's API documentation comes with the source code and you are\nencouraged to read it. The standard library source is generally high\nquality and a peek behind the curtains is often enlightening.\n\n# What is in the standard library documentation?\n\nFirst of all, The Rust Standard Library is divided into a number of focused\nmodules, [all listed further down this page](#modules). These modules are\nthe bedrock upon which all of Rust is forged, and they have mighty names\nlike [`std::slice`] and [`std::cmp`]. Modules' documentation typically\nincludes an overview of the module along with examples, and are a smart\nplace to start familiarizing yourself with the library.\n\nSecond, implicit methods on [primitive types] are documented here. This can\nbe a source of confusion for two reasons:\n\n1. While primitives are implemented by the compiler, the standard library\n implements methods directly on the primitive types (and it is the only\n library that does so), which are [documented in the section on\n primitives](#primitives).\n2. The standard library exports many modules *with the same name as\n primitive types*. These define additional items related to the primitive\n type, but not the all-important methods.\n\nSo for example there is a [page for the primitive type\n`i32`](primitive::i32) that lists all the methods that can be called on\n32-bit integers (very useful), and there is a [page for the module\n`std::i32`] that documents the constant values [`MIN`] and [`MAX`] (rarely\nuseful).\n\nNote the documentation for the primitives [`str`] and [`[T]`][prim@slice] (also\ncalled 'slice'). Many method calls on [`String`] and [`Vec`] are actually\ncalls to methods on [`str`] and [`[T]`][prim@slice] respectively, via [deref\ncoercions][deref-coercions].\n\nThird, the standard library defines [The Rust Prelude], a small collection\nof items - mostly traits - that are imported into every module of every\ncrate. The traits in the prelude are pervasive, making the prelude\ndocumentation a good entry point to learning about the library.\n\nAnd finally, the standard library exports a number of standard macros, and\n[lists them on this page](#macros) (technically, not all of the standard\nmacros are defined by the standard library - some are defined by the\ncompiler - but they are documented here the same). Like the prelude, the\nstandard macros are imported by default into all crates.\n\n# Contributing changes to the documentation\n\nCheck out the rust contribution guidelines [here](\nhttps://rustc-dev-guide.rust-lang.org/contributing.html#writing-documentation).\nThe source for this documentation can be found on\n[GitHub](https://github.com/rust-lang/rust).\nTo contribute changes, make sure you read the guidelines first, then submit\npull-requests for your suggested changes.\n\nContributions are appreciated! If you see a part of the docs that can be\nimproved, submit a PR, or chat with us first on [Discord][rust-discord]\n#docs.\n\n# A Tour of The Rust Standard Library\n\nThe rest of this crate documentation is dedicated to pointing out notable\nfeatures of The Rust Standard Library.\n\n## Containers and collections\n\nThe [`option`] and [`result`] modules define optional and error-handling\ntypes, [`Option`] and [`Result`]. The [`iter`] module defines\nRust's iterator trait, [`Iterator`], which works with the [`for`] loop to\naccess collections.\n\nThe standard library exposes three common ways to deal with contiguous\nregions of memory:\n\n* [`Vec`] - A heap-allocated *vector* that is resizable at runtime.\n* [`[T; N]`][prim@array] - An inline *array* with a fixed size at compile time.\n* [`[T]`][prim@slice] - A dynamically sized *slice* into any other kind of contiguous\n storage, whether heap-allocated or not.\n\nSlices can only be handled through some kind of *pointer*, and as such come\nin many flavors such as:\n\n* `&[T]` - *shared slice*\n* `&mut [T]` - *mutable slice*\n* [`Box<[T]>`][owned slice] - *owned slice*\n\n[`str`], a UTF-8 string slice, is a primitive type, and the standard library\ndefines many methods for it. Rust [`str`]s are typically accessed as\nimmutable references: `&str`. Use the owned [`String`] for building and\nmutating strings.\n\nFor converting to strings use the [`format!`] macro, and for converting from\nstrings use the [`FromStr`] trait.\n\nData may be shared by placing it in a reference-counted box or the [`Rc`]\ntype, and if further contained in a [`Cell`] or [`RefCell`], may be mutated\nas well as shared. Likewise, in a concurrent setting it is common to pair an\natomically-reference-counted box, [`Arc`], with a [`Mutex`] to get the same\neffect.\n\nThe [`collections`] module defines maps, sets, linked lists and other\ntypical collection types, including the common [`HashMap`].\n\n## Platform abstractions and I/O\n\nBesides basic data types, the standard library is largely concerned with\nabstracting over differences in common platforms, most notably Windows and\nUnix derivatives.\n\nCommon types of I/O, including [files], [TCP], and [UDP], are defined in\nthe [`io`], [`fs`], and [`net`] modules.\n\nThe [`thread`] module contains Rust's threading abstractions. [`sync`]\ncontains further primitive shared memory types, including [`atomic`] and\n[`mpsc`], which contains the channel types for message passing.\n\n# Use before and after `main()`\n\nMany parts of the standard library are expected to work before and after `main()`;\nbut this is not guaranteed or ensured by tests. It is recommended that you write your own tests\nand run them on each platform you wish to support.\nThis means that use of `std` before/after main, especially of features that interact with the\nOS or global state, is exempted from stability and portability guarantees and instead only\nprovided on a best-effort basis. Nevertheless bug reports are appreciated.\n\nOn the other hand `core` and `alloc` are most likely to work in such environments with\nthe caveat that any hookable behavior such as panics, oom handling or allocators will also\ndepend on the compatibility of the hooks.\n\nSome features may also behave differently outside main, e.g. stdio could become unbuffered,\nsome panics might turn into aborts, backtraces might not get symbolicated or similar.\n\nNon-exhaustive list of known limitations:\n\n- after-main use of thread-locals, which also affects additional features:\n - [`thread::current()`]\n - [`thread::scope()`]\n - [`sync::mpsc`]\n- before-main stdio file descriptors are not guaranteed to be open on unix platforms\n\n\n[I/O]: io\n[`MIN`]: i32::MIN\n[`MAX`]: i32::MAX\n[page for the module `std::i32`]: crate::i32\n[TCP]: net::TcpStream\n[The Rust Prelude]: prelude\n[UDP]: net::UdpSocket\n[`Arc`]: sync::Arc\n[owned slice]: boxed\n[`Cell`]: cell::Cell\n[`FromStr`]: str::FromStr\n[`HashMap`]: collections::HashMap\n[`Mutex`]: sync::Mutex\n[`Option`]: option::Option\n[`Rc`]: rc::Rc\n[`RefCell`]: cell::RefCell\n[`Result`]: result::Result\n[`Vec`]: vec::Vec\n[`atomic`]: sync::atomic\n[`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for\n[`str`]: prim@str\n[`mpsc`]: sync::mpsc\n[`std::cmp`]: cmp\n[`std::slice`]: mod@slice\n[`use std::env`]: env/index.html\n[`use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html\n[crates.io]: https://crates.io\n[deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods\n[files]: fs::File\n[multithreading]: thread\n[other]: #what-is-in-the-standard-library-documentation\n[primitive types]: ../book/ch03-02-data-types.html\n[rust-discord]: https://discord.gg/rust-lang\n[array]: prim@array\n[slice]: prim@slice"},"deprecated":false,"sortText":"ffffffef","filterText":"std","textEdit":{"newText":"std","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"alloc","kind":9,"documentation":{"kind":"markdown","value":"# The Rust core allocation and collections library\n\nThis library provides smart pointers and collections for managing\nheap-allocated values.\n\nThis library, like core, normally doesn’t need to be used directly\nsince its contents are re-exported in the [`std` crate](../std/index.html).\nCrates that use the `#![no_std]` attribute however will typically\nnot depend on `std`, so they’d use this crate instead.\n\n## Boxed values\n\nThe [`Box`] type is a smart pointer type. There can only be one owner of a\n[`Box`], and the owner can decide to mutate the contents, which live on the\nheap.\n\nThis type can be sent among threads efficiently as the size of a `Box` value\nis the same as that of a pointer. Tree-like data structures are often built\nwith boxes because each node often has only one owner, the parent.\n\n## Reference counted pointers\n\nThe [`Rc`] type is a non-threadsafe reference-counted pointer type intended\nfor sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and\nonly allows access to `&T`, a shared reference.\n\nThis type is useful when inherited mutability (such as using [`Box`]) is too\nconstraining for an application, and is often paired with the [`Cell`] or\n[`RefCell`] types in order to allow mutation.\n\n## Atomically reference counted pointers\n\nThe [`Arc`] type is the threadsafe equivalent of the [`Rc`] type. It\nprovides all the same functionality of [`Rc`], except it requires that the\ncontained type `T` is shareable. Additionally, [`Arc`][`Arc`] is itself\nsendable while [`Rc`][`Rc`] is not.\n\nThis type allows for shared access to the contained data, and is often\npaired with synchronization primitives such as mutexes to allow mutation of\nshared resources.\n\n## Collections\n\nImplementations of the most common general purpose data structures are\ndefined in this library. They are re-exported through the\n[standard collections library](../std/collections/index.html).\n\n## Heap interfaces\n\nThe [`alloc`](alloc/index.html) module defines the low-level interface to the\ndefault global allocator. It is not compatible with the libc allocator API.\n\n[`Arc`]: sync\n[`Box`]: boxed\n[`Cell`]: core::cell\n[`Rc`]: rc\n[`RefCell`]: core::cell"},"deprecated":false,"sortText":"ffffffef","filterText":"alloc","textEdit":{"newText":"alloc","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"core","kind":9,"documentation":{"kind":"markdown","value":"# The Rust Core Library\n\nThe Rust Core Library is the dependency-free[^free] foundation of [The\nRust Standard Library](../std/index.html). It is the portable glue\nbetween the language and its libraries, defining the intrinsic and\nprimitive building blocks of all Rust code. It links to no\nupstream libraries, no system libraries, and no libc.\n\n[^free]: Strictly speaking, there are some symbols which are needed but\n they aren't always necessary.\n\nThe core library is *minimal*: it isn't even aware of heap allocation,\nnor does it provide concurrency or I/O. These things require\nplatform integration, and this library is platform-agnostic.\n\n# How to use the core library\n\nPlease note that all of these details are currently not considered stable.\n\nThis library is built on the assumption of a few existing symbols:\n\n* `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines\n which are generated by Rust codegen backends. Additionally, this library can make explicit\n calls to `strlen`. Their signatures are the same as found in C, but there are extra\n assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if\n the `n` parameter is 0, the function is assumed to not be UB, even if the pointers are NULL or\n dangling. (Note that making extra assumptions about these functions is common among compilers:\n [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)\n These functions are often provided by the system libc, but can also be provided by the\n [compiler-builtins crate](https://crates.io/crates/compiler_builtins).\n Note that the library does not guarantee that it will always make these assumptions, so Rust\n user code directly calling the C functions should follow the C specification! The advice for\n Rust user code is to call the functions provided by this library instead (such as\n `ptr::copy`).\n\n* `rust_begin_panic` - This function takes four arguments, a\n `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments\n dictate the panic message, the file at which panic was invoked, and the\n line and column inside the file. It is up to consumers of this core\n library to define this panic function; it is only required to never\n return. This requires a `lang` attribute named `panic_impl`.\n\n* `rust_eh_personality` - is used by the failure mechanisms of the\n compiler. This is often mapped to GCC's personality function, but crates\n which do not trigger a panic can be assured that this function is never\n called. The `lang` attribute is called `eh_personality`."},"deprecated":false,"sortText":"ffffffef","filterText":"core","textEdit":{"newText":"core","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"u32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u32","textEdit":{"newText":"u32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"bool","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"bool","textEdit":{"newText":"bool","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"u8","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u8","textEdit":{"newText":"u8","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"isize","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"isize","textEdit":{"newText":"isize","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"u16","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u16","textEdit":{"newText":"u16","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"u64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u64","textEdit":{"newText":"u64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"u128","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u128","textEdit":{"newText":"u128","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"f32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"f32","textEdit":{"newText":"f32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"i128","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i128","textEdit":{"newText":"i128","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"i16","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i16","textEdit":{"newText":"i16","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"str","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"str","textEdit":{"newText":"str","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"i64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i64","textEdit":{"newText":"i64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"char","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"char","textEdit":{"newText":"char","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"f64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"f64","textEdit":{"newText":"f64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"i32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i32","textEdit":{"newText":"i32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"i8","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i8","textEdit":{"newText":"i8","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"usize","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"usize","textEdit":{"newText":"usize","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"AsMut","kind":8,"documentation":{"kind":"markdown","value":"Used to do a cheap mutable-to-mutable reference conversion.\n\nThis trait is similar to [`AsRef`] but used for converting between mutable\nreferences. If you need to do a costly conversion it is better to\nimplement [`From`] with type `&mut T` or write a custom function.\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsMut` auto-dereferences if the inner type is a mutable reference\n(e.g.: `foo.as_mut()` will work the same if `foo` has type `&mut Foo` or `&mut &mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[mutably dereferenceable types], e.g. `foo.as_mut()` will *not* work the same as\n`Box::new(foo).as_mut()`. Instead, many smart pointers provide an `as_mut` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsMut::as_mut`] should not be\nused for the sole purpose of mutable dereferencing; instead ['`Deref` coercion'] can be used:\n\n[mutably dereferenceable types]: core::ops::DerefMut\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::DerefMut#mutable-deref-coercion\n\n```rust\nlet mut x = Box::new(5i32);\n// Avoid this:\n// let y: &mut i32 = x.as_mut();\n// Better just write:\nlet y: &mut i32 = &mut x;\n```\n\nTypes which implement [`DerefMut`] should consider to add an implementation of `AsMut` as\nfollows:\n\n[`DerefMut`]: core::ops::DerefMut\n\n```rust\nimpl AsMut for SomeType\nwhere\n ::Target: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.deref_mut().as_mut()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsMut` would be reflexive, i.e. there would be an `impl AsMut for T`\nwith [`as_mut`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&mut T where T: AsMut` which allows `AsMut` to auto-dereference, see \"Generic\nImplementations\" above).\n\n[`as_mut`]: AsMut::as_mut\n\nA trivial implementation of `AsMut for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nUsing `AsMut` as trait bound for a generic function, we can accept all mutable references that\ncan be converted to type `&mut T`. Unlike [dereference], which has a single [target type],\nthere can be multiple implementations of `AsMut` for a type. In particular, `Vec` implements\nboth `AsMut>` and `AsMut<[T]>`.\n\nIn the following, the example functions `caesar` and `null_terminate` provide a generic\ninterface which work with any type that can be converted by cheap mutable-to-mutable conversion\ninto a byte slice (`[u8]`) or byte vector (`Vec`), respectively.\n\n[dereference]: core::ops::DerefMut\n[target type]: core::ops::Deref::Target\n\n```rust\nstruct Document {\n info: String,\n content: Vec,\n}\n\nimpl AsMut for Document\nwhere\n Vec: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.content.as_mut()\n }\n}\n\nfn caesar>(data: &mut T, key: u8) {\n for byte in data.as_mut() {\n *byte = byte.wrapping_add(key);\n }\n}\n\nfn null_terminate>>(data: &mut T) {\n // Using a non-generic inner function, which contains most of the\n // functionality, helps to minimize monomorphization overhead.\n fn doit(data: &mut Vec) {\n let len = data.len();\n if len == 0 || data[len-1] != 0 {\n data.push(0);\n }\n }\n doit(data.as_mut());\n}\n\nfn main() {\n let mut v: Vec = vec![1, 2, 3];\n caesar(&mut v, 5);\n assert_eq!(v, [6, 7, 8]);\n null_terminate(&mut v);\n assert_eq!(v, [6, 7, 8, 0]);\n let mut doc = Document {\n info: String::from(\"Example\"),\n content: vec![17, 19, 8],\n };\n caesar(&mut doc, 1);\n assert_eq!(doc.content, [18, 20, 9]);\n null_terminate(&mut doc);\n assert_eq!(doc.content, [18, 20, 9, 0]);\n}\n```\n\nNote, however, that APIs don't need to be generic. In many cases taking a `&mut [u8]` or\n`&mut Vec`, for example, is the better choice (callers need to pass the correct type then)."},"deprecated":false,"sortText":"ffffffef","filterText":"AsMut","textEdit":{"newText":"AsMut","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"AsRef","kind":8,"documentation":{"kind":"markdown","value":"Used to do a cheap reference-to-reference conversion.\n\nThis trait is similar to [`AsMut`] which is used for converting between mutable references.\nIf you need to do a costly conversion it is better to implement [`From`] with type\n`&T` or write a custom function.\n\n# Relation to `Borrow`\n\n`AsRef` has the same signature as [`Borrow`], but [`Borrow`] is different in a few aspects:\n\n- Unlike `AsRef`, [`Borrow`] has a blanket impl for any `T`, and can be used to accept either\n a reference or a value. (See also note on `AsRef`'s reflexibility below.)\n- [`Borrow`] also requires that [`Hash`], [`Eq`] and [`Ord`] for a borrowed value are\n equivalent to those of the owned value. For this reason, if you want to\n borrow only a single field of a struct you can implement `AsRef`, but not [`Borrow`].\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsRef` auto-dereferences if the inner type is a reference or a mutable reference\n(e.g.: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[dereferenceable types], e.g. `foo.as_ref()` will *not* work the same as\n`Box::new(foo).as_ref()`. Instead, many smart pointers provide an `as_ref` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsRef::as_ref`] should not be\nused for the sole purpose of dereferencing; instead ['`Deref` coercion'] can be used:\n\n[dereferenceable types]: core::ops::Deref\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::Deref#deref-coercion\n\n```rust\nlet x = Box::new(5i32);\n// Avoid this:\n// let y: &i32 = x.as_ref();\n// Better just write:\nlet y: &i32 = &x;\n```\n\nTypes which implement [`Deref`] should consider implementing `AsRef` as follows:\n\n[`Deref`]: core::ops::Deref\n\n```rust\nimpl AsRef for SomeType\nwhere\n T: ?Sized,\n ::Target: AsRef,\n{\n fn as_ref(&self) -> &T {\n self.deref().as_ref()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsRef` would be reflexive, i.e. there would be an `impl AsRef for T`\nwith [`as_ref`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&T where T: AsRef` which allows `AsRef` to auto-dereference, see \"Generic Implementations\"\nabove).\n\n[`as_ref`]: AsRef::as_ref\n\nA trivial implementation of `AsRef for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nBy using trait bounds we can accept arguments of different types as long as they can be\nconverted to the specified type `T`.\n\nFor example: By creating a generic function that takes an `AsRef` we express that we\nwant to accept all references that can be converted to [`&str`] as an argument.\nSince both [`String`] and [`&str`] implement `AsRef` we can accept both as input argument.\n\n[`&str`]: primitive@str\n[`Borrow`]: crate::borrow::Borrow\n[`Eq`]: crate::cmp::Eq\n[`Ord`]: crate::cmp::Ord\n[`String`]: ../../std/string/struct.String.html\n\n```rust\nfn is_hello>(s: T) {\n assert_eq!(\"hello\", s.as_ref());\n}\n\nlet s = \"hello\";\nis_hello(s);\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"AsRef","textEdit":{"newText":"AsRef","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Box","kind":22,"documentation":{"kind":"markdown","value":"A pointer type that uniquely owns a heap allocation of type `T`.\n\nSee the [module-level documentation](../../std/boxed/index.html) for more."},"deprecated":false,"sortText":"ffffffef","filterText":"Box","textEdit":{"newText":"Box","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Clone","kind":8,"documentation":{"kind":"markdown","value":"A common trait for the ability to explicitly duplicate an object.\n\nDiffers from [`Copy`] in that [`Copy`] is implicit and an inexpensive bit-wise copy, while\n`Clone` is always explicit and may or may not be expensive. In order to enforce\nthese characteristics, Rust does not allow you to reimplement [`Copy`], but you\nmay reimplement `Clone` and run arbitrary code.\n\nSince `Clone` is more general than [`Copy`], you can automatically make anything\n[`Copy`] be `Clone` as well.\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d\nimplementation of [`Clone`] calls [`clone`] on each field.\n\n[`clone`]: Clone::clone\n\nFor a generic struct, `#[derive]` implements `Clone` conditionally by adding bound `Clone` on\ngeneric parameters.\n\n```rust\n// `derive` implements Clone for Reading when T is Clone.\n#[derive(Clone)]\nstruct Reading {\n frequency: T,\n}\n```\n\n## How can I implement `Clone`?\n\nTypes that are [`Copy`] should have a trivial implementation of `Clone`. More formally:\nif `T: Copy`, `x: T`, and `y: &T`, then `let x = y.clone();` is equivalent to `let x = *y;`.\nManual implementations should be careful to uphold this invariant; however, unsafe code\nmust not rely on it to ensure memory safety.\n\nAn example is a generic struct holding a function pointer. In this case, the\nimplementation of `Clone` cannot be `derive`d, but can be implemented as:\n\n```rust\nstruct Generate(fn() -> T);\n\nimpl Copy for Generate {}\n\nimpl Clone for Generate {\n fn clone(&self) -> Self {\n *self\n }\n}\n```\n\nIf we `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n```\n\nthe auto-derived implementations will have unnecessary `T: Copy` and `T: Clone` bounds:\n\n```rust\n\n// Automatically derived\nimpl Copy for Generate { }\n\n// Automatically derived\nimpl Clone for Generate {\n fn clone(&self) -> Generate {\n Generate(Clone::clone(&self.0))\n }\n}\n```\n\nThe bounds are unnecessary because clearly the function itself should be\ncopy- and cloneable even if its return type is not:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n\nstruct NotCloneable;\n\nfn generate_not_cloneable() -> NotCloneable {\n NotCloneable\n}\n\nGenerate(generate_not_cloneable).clone(); // error: trait bounds were not satisfied\n// Note: With the manual implementations the above line will compile.\n```\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Clone`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Clone` themselves.\n Note that variables captured by shared reference always implement `Clone`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Clone`.\n\n[impls]: #implementors"},"deprecated":false,"sortText":"ffffffef","filterText":"Clone","textEdit":{"newText":"Clone","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Copy","kind":8,"documentation":{"kind":"markdown","value":"Types whose values can be duplicated simply by copying bits.\n\nBy default, variable bindings have 'move semantics.' In other\nwords:\n\n```rust\n#[derive(Debug)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `x` has moved into `y`, and so cannot be used\n\n// println!(\"{x:?}\"); // error: use of moved value\n```\n\nHowever, if a type implements `Copy`, it instead has 'copy semantics':\n\n```rust\n// We can derive a `Copy` implementation. `Clone` is also required, as it's\n// a supertrait of `Copy`.\n#[derive(Debug, Copy, Clone)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `y` is a copy of `x`\n\nprintln!(\"{x:?}\"); // A-OK!\n```\n\nIt's important to note that in these two examples, the only difference is whether you\nare allowed to access `x` after the assignment. Under the hood, both a copy and a move\ncan result in bits being copied in memory, although this is sometimes optimized away.\n\n## How can I implement `Copy`?\n\nThere are two ways to implement `Copy` on your type. The simplest is to use `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct MyStruct;\n```\n\nYou can also implement `Copy` and `Clone` manually:\n\n```rust\nstruct MyStruct;\n\nimpl Copy for MyStruct { }\n\nimpl Clone for MyStruct {\n fn clone(&self) -> MyStruct {\n *self\n }\n}\n```\n\nThere is a small difference between the two: the `derive` strategy will also place a `Copy`\nbound on type parameters, which isn't always desired.\n\n## What's the difference between `Copy` and `Clone`?\n\nCopies happen implicitly, for example as part of an assignment `y = x`. The behavior of\n`Copy` is not overloadable; it is always a simple bit-wise copy.\n\nCloning is an explicit action, `x.clone()`. The implementation of [`Clone`] can\nprovide any type-specific behavior necessary to duplicate values safely. For example,\nthe implementation of [`Clone`] for [`String`] needs to copy the pointed-to string\nbuffer in the heap. A simple bitwise copy of [`String`] values would merely copy the\npointer, leading to a double free down the line. For this reason, [`String`] is [`Clone`]\nbut not `Copy`.\n\n[`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement\n[`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`\n(see the example above).\n\n## When can my type be `Copy`?\n\nA type can implement `Copy` if all of its components implement `Copy`. For example, this\nstruct can be `Copy`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Point {\n x: i32,\n y: i32,\n}\n```\n\nA struct can be `Copy`, and [`i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.\nBy contrast, consider\n\n```rust\nstruct PointList {\n points: Vec,\n}\n```\n\nThe struct `PointList` cannot implement `Copy`, because [`Vec`] is not `Copy`. If we\nattempt to derive a `Copy` implementation, we'll get an error:\n\n```text\nthe trait `Copy` cannot be implemented for this type; field `points` does not implement `Copy`\n```\n\nShared references (`&T`) are also `Copy`, so a type can be `Copy`, even when it holds\nshared references of types `T` that are *not* `Copy`. Consider the following struct,\nwhich can implement `Copy`, because it only holds a *shared reference* to our non-`Copy`\ntype `PointList` from above:\n\n```rust\n#[derive(Copy, Clone)]\nstruct PointListWrapper<'a> {\n point_list_ref: &'a PointList,\n}\n```\n\n## When *can't* my type be `Copy`?\n\nSome types can't be copied safely. For example, copying `&mut T` would create an aliased\nmutable reference. Copying [`String`] would duplicate responsibility for managing the\n[`String`]'s buffer, leading to a double free.\n\nGeneralizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's\nmanaging some resource besides its own [`size_of::`] bytes.\n\nIf you try to implement `Copy` on a struct or enum containing non-`Copy` data, you will get\nthe error [E0204].\n\n[E0204]: ../../error_codes/E0204.html\n\n## When *should* my type be `Copy`?\n\nGenerally speaking, if your type _can_ implement `Copy`, it should. Keep in mind, though,\nthat implementing `Copy` is part of the public API of your type. If the type might become\nnon-`Copy` in the future, it could be prudent to omit the `Copy` implementation now, to\navoid a breaking API change.\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Copy`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Copy` themselves.\n Note that variables captured by shared reference always implement `Copy`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Copy`.\n\n[`Vec`]: ../../std/vec/struct.Vec.html\n[`String`]: ../../std/string/struct.String.html\n[`size_of::`]: crate::mem::size_of\n[impls]: #implementors"},"deprecated":false,"sortText":"ffffffef","filterText":"Copy","textEdit":{"newText":"Copy","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Default","kind":8,"documentation":{"kind":"markdown","value":"A trait for giving a type a useful default value.\n\nSometimes, you want to fall back to some kind of default value, and\ndon't particularly care what it is. This comes up often with `struct`s\nthat define a set of options:\n\n```rust\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```\n\nHow can we define some default values? You can use `Default`:\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n\nfn main() {\n let options: SomeOptions = Default::default();\n}\n```\n\nNow, you get all of the default values. Rust implements `Default` for various primitives types.\n\nIf you want to override a particular option, but still retain the other defaults:\n\n```rust\nfn main() {\n let options = SomeOptions { foo: 42, ..Default::default() };\n}\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all of the type's fields implement\n`Default`. When `derive`d, it will use the default value for each field's type.\n\n### `enum`s\n\nWhen using `#[derive(Default)]` on an `enum`, you need to choose which unit variant will be\ndefault. You do this by placing the `#[default]` attribute on the variant.\n\n```rust\n#[derive(Default)]\nenum Kind {\n #[default]\n A,\n B,\n C,\n}\n```\n\nYou cannot use the `#[default]` attribute on non-unit or non-exhaustive variants.\n\n## How can I implement `Default`?\n\nProvide an implementation for the `default()` method that returns the value of\nyour type that should be the default:\n\n```rust\nenum Kind {\n A,\n B,\n C,\n}\n\nimpl Default for Kind {\n fn default() -> Self { Kind::A }\n}\n```\n\n# Examples\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Default","textEdit":{"newText":"Default","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"DoubleEndedIterator","kind":8,"documentation":{"kind":"markdown","value":"An iterator able to yield elements from both ends.\n\nSomething that implements `DoubleEndedIterator` has one extra capability\nover something that implements [`Iterator`]: the ability to also take\n`Item`s from the back, as well as the front.\n\nIt is important to note that both back and forth work on the same range,\nand do not cross: iteration is over when they meet in the middle.\n\nIn a similar fashion to the [`Iterator`] protocol, once a\n`DoubleEndedIterator` returns [`None`] from a [`next_back()`], calling it\nagain may or may not ever return [`Some`] again. [`next()`] and\n[`next_back()`] are interchangeable for this purpose.\n\n[`next_back()`]: DoubleEndedIterator::next_back\n[`next()`]: Iterator::next\n\n# Examples\n\nBasic usage:\n\n```rust\nlet numbers = vec![1, 2, 3, 4, 5, 6];\n\nlet mut iter = numbers.iter();\n\nassert_eq!(Some(&1), iter.next());\nassert_eq!(Some(&6), iter.next_back());\nassert_eq!(Some(&5), iter.next_back());\nassert_eq!(Some(&2), iter.next());\nassert_eq!(Some(&3), iter.next());\nassert_eq!(Some(&4), iter.next());\nassert_eq!(None, iter.next());\nassert_eq!(None, iter.next_back());\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"DoubleEndedIterator","textEdit":{"newText":"DoubleEndedIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Drop","kind":8,"documentation":{"kind":"markdown","value":"Custom code within the destructor.\n\nWhen a value is no longer needed, Rust will run a \"destructor\" on that value.\nThe most common way that a value is no longer needed is when it goes out of\nscope. Destructors may still run in other circumstances, but we're going to\nfocus on scope for the examples here. To learn about some of those other cases,\nplease see [the reference] section on destructors.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\nThis destructor consists of two components:\n- A call to `Drop::drop` for that value, if this special `Drop` trait is implemented for its type.\n- The automatically generated \"drop glue\" which recursively calls the destructors\n of all the fields of this value.\n\nAs Rust automatically calls the destructors of all contained fields,\nyou don't have to implement `Drop` in most cases. But there are some cases where\nit is useful, for example for types which directly manage a resource.\nThat resource may be memory, it may be a file descriptor, it may be a network socket.\nOnce a value of that type is no longer going to be used, it should \"clean up\" its\nresource by freeing the memory or closing the file or socket. This is\nthe job of a destructor, and therefore the job of `Drop::drop`.\n\n## Examples\n\nTo see destructors in action, let's take a look at the following program:\n\n```rust\nstruct HasDrop;\n\nimpl Drop for HasDrop {\n fn drop(&mut self) {\n println!(\"Dropping HasDrop!\");\n }\n}\n\nstruct HasTwoDrops {\n one: HasDrop,\n two: HasDrop,\n}\n\nimpl Drop for HasTwoDrops {\n fn drop(&mut self) {\n println!(\"Dropping HasTwoDrops!\");\n }\n}\n\nfn main() {\n let _x = HasTwoDrops { one: HasDrop, two: HasDrop };\n println!(\"Running!\");\n}\n```\n\nRust will first call `Drop::drop` for `_x` and then for both `_x.one` and `_x.two`,\nmeaning that running this will print\n\n```text\nRunning!\nDropping HasTwoDrops!\nDropping HasDrop!\nDropping HasDrop!\n```\n\nEven if we remove the implementation of `Drop` for `HasTwoDrop`, the destructors of its fields are still called.\nThis would result in\n\n```test\nRunning!\nDropping HasDrop!\nDropping HasDrop!\n```\n\n## You cannot call `Drop::drop` yourself\n\nBecause `Drop::drop` is used to clean up a value, it may be dangerous to use this value after\nthe method has been called. As `Drop::drop` does not take ownership of its input,\nRust prevents misuse by not allowing you to call `Drop::drop` directly.\n\nIn other words, if you tried to explicitly call `Drop::drop` in the above example, you'd get a compiler error.\n\nIf you'd like to explicitly call the destructor of a value, [`mem::drop`] can be used instead.\n\n[`mem::drop`]: drop\n\n## Drop order\n\nWhich of our two `HasDrop` drops first, though? For structs, it's the same\norder that they're declared: first `one`, then `two`. If you'd like to try\nthis yourself, you can modify `HasDrop` above to contain some data, like an\ninteger, and then use it in the `println!` inside of `Drop`. This behavior is\nguaranteed by the language.\n\nUnlike for structs, local variables are dropped in reverse order:\n\n```rust\nstruct Foo;\n\nimpl Drop for Foo {\n fn drop(&mut self) {\n println!(\"Dropping Foo!\")\n }\n}\n\nstruct Bar;\n\nimpl Drop for Bar {\n fn drop(&mut self) {\n println!(\"Dropping Bar!\")\n }\n}\n\nfn main() {\n let _foo = Foo;\n let _bar = Bar;\n}\n```\n\nThis will print\n\n```text\nDropping Bar!\nDropping Foo!\n```\n\nPlease see [the reference] for the full rules.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\n## `Copy` and `Drop` are exclusive\n\nYou cannot implement both [`Copy`] and `Drop` on the same type. Types that\nare `Copy` get implicitly duplicated by the compiler, making it very\nhard to predict when, and how often destructors will be executed. As such,\nthese types cannot have destructors.\n\n## Drop check\n\nDropping interacts with the borrow checker in subtle ways: when a type `T` is being implicitly\ndropped as some variable of this type goes out of scope, the borrow checker needs to ensure that\ncalling `T`'s destructor at this moment is safe. In particular, it also needs to be safe to\nrecursively drop all the fields of `T`. For example, it is crucial that code like the following\nis being rejected:\n\n```rust\nuse std::cell::Cell;\n\nstruct S<'a>(Cell>>, Box);\nimpl Drop for S<'_> {\n fn drop(&mut self) {\n if let Some(r) = self.0.get() {\n // Print the contents of the `Box` in `r`.\n println!(\"{}\", r.1);\n }\n }\n}\n\nfn main() {\n // Set up two `S` that point to each other.\n let s1 = S(Cell::new(None), Box::new(42));\n let s2 = S(Cell::new(Some(&s1)), Box::new(42));\n s1.0.set(Some(&s2));\n // Now they both get dropped. But whichever is the 2nd one\n // to be dropped will access the `Box` in the first one,\n // which is a use-after-free!\n}\n```\n\nThe Nomicon discusses the need for [drop check in more detail][drop check].\n\nTo reject such code, the \"drop check\" analysis determines which types and lifetimes need to\nstill be live when `T` gets dropped. The exact details of this analysis are not yet\nstably guaranteed and **subject to change**. Currently, the analysis works as follows:\n- If `T` has no drop glue, then trivially nothing is required to be live. This is the case if\n neither `T` nor any of its (recursive) fields have a destructor (`impl Drop`). [`PhantomData`]\n and [`ManuallyDrop`] are considered to never have a destructor, no matter their field type.\n- If `T` has drop glue, then, for all types `U` that are *owned* by any field of `T`,\n recursively add the types and lifetimes that need to be live when `U` gets dropped. The set of\n owned types is determined by recursively traversing `T`:\n - Recursively descend through `PhantomData`, `Box`, tuples, and arrays (including arrays of\n length 0).\n - Stop at reference and raw pointer types as well as function pointers and function items;\n they do not own anything.\n - Stop at non-composite types (type parameters that remain generic in the current context and\n base types such as integers and `bool`); these types are owned.\n - When hitting an ADT with `impl Drop`, stop there; this type is owned.\n - When hitting an ADT without `impl Drop`, recursively descend to its fields. (For an `enum`,\n consider all fields of all variants.)\n- Furthermore, if `T` implements `Drop`, then all generic (lifetime and type) parameters of `T`\n must be live.\n\nIn the above example, the last clause implies that `'a` must be live when `S<'a>` is dropped,\nand hence the example is rejected. If we remove the `impl Drop`, the liveness requirement\ndisappears and the example is accepted.\n\nThere exists an unstable way for a type to opt-out of the last clause; this is called \"drop\ncheck eyepatch\" or `may_dangle`. For more details on this nightly-only feature, see the\n[discussion in the Nomicon][nomicon].\n\n[`ManuallyDrop`]: crate::mem::ManuallyDrop\n[`PhantomData`]: crate::marker::PhantomData\n[drop check]: ../../nomicon/dropck.html\n[nomicon]: ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standard-library-and-its-unstable-may_dangle"},"deprecated":false,"sortText":"ffffffef","filterText":"Drop","textEdit":{"newText":"Drop","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Eq (alias ==, !=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for comparisons corresponding to [equivalence relations](\nhttps://en.wikipedia.org/wiki/Equivalence_relation).\n\nThis means, that in addition to `a == b` and `a != b` being strict inverses,\nthe relation must be (for all `a`, `b` and `c`):\n\n- reflexive: `a == a`;\n- symmetric: `a == b` implies `b == a` (required by `PartialEq` as well); and\n- transitive: `a == b` and `b == c` implies `a == c` (required by `PartialEq` as well).\n\nThis property cannot be checked by the compiler, and therefore `Eq` implies\n[`PartialEq`], and has no extra methods.\n\nViolating this property is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\nImplement `Eq` in addition to `PartialEq` if it's guaranteed that\n`PartialEq::eq(a, a)` always returns `true` (reflexivity), in addition to\nthe symmetric and transitive properties already required by `PartialEq`.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d, because `Eq` has\nno extra methods, it is only informing the compiler that this is an\nequivalence relation rather than a partial equivalence relation. Note that\nthe `derive` strategy requires all fields are `Eq`, which isn't\nalways desired.\n\n## How can I implement `Eq`?\n\nIf you cannot use the `derive` strategy, specify that your type implements\n`Eq`, which has no methods:\n\n```rust\nenum BookFormat { Paperback, Hardback, Ebook }\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\nimpl Eq for Book {}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Eq","textEdit":{"newText":"Eq","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Err(…)","kind":20,"detail":"Err(E)","documentation":{"kind":"markdown","value":"Contains the error value"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Err()","insertTextFormat":2,"textEdit":{"newText":"Err(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"ExactSizeIterator","kind":8,"documentation":{"kind":"markdown","value":"An iterator that knows its exact length.\n\nMany [`Iterator`]s don't know how many times they will iterate, but some do.\nIf an iterator knows how many times it can iterate, providing access to\nthat information can be useful. For example, if you want to iterate\nbackwards, a good start is to know where the end is.\n\nWhen implementing an `ExactSizeIterator`, you must also implement\n[`Iterator`]. When doing so, the implementation of [`Iterator::size_hint`]\n*must* return the exact size of the iterator.\n\nThe [`len`] method has a default implementation, so you usually shouldn't\nimplement it. However, you may be able to provide a more performant\nimplementation than the default, so overriding it in this case makes sense.\n\nNote that this trait is a safe trait and as such does *not* and *cannot*\nguarantee that the returned length is correct. This means that `unsafe`\ncode **must not** rely on the correctness of [`Iterator::size_hint`]. The\nunstable and unsafe [`TrustedLen`](super::marker::TrustedLen) trait gives\nthis additional guarantee.\n\n[`len`]: ExactSizeIterator::len\n\n# When *shouldn't* an adapter be `ExactSizeIterator`?\n\nIf an adapter makes an iterator *longer*, then it's usually incorrect for\nthat adapter to implement `ExactSizeIterator`. The inner exact-sized\niterator might already be `usize::MAX`-long, and thus the length of the\nlonger adapted iterator would no longer be exactly representable in `usize`.\n\nThis is why [`Chain`](crate::iter::Chain) isn't `ExactSizeIterator`,\neven when `A` and `B` are both `ExactSizeIterator`.\n\n# Examples\n\nBasic usage:\n\n```rust\n// a finite range knows exactly how many times it will iterate\nlet five = 0..5;\n\nassert_eq!(5, five.len());\n```\n\nIn the [module-level docs], we implemented an [`Iterator`], `Counter`.\nLet's implement `ExactSizeIterator` for it as well:\n\n[module-level docs]: crate::iter\n\n```rust\nimpl ExactSizeIterator for Counter {\n // We can easily calculate the remaining number of iterations.\n fn len(&self) -> usize {\n 5 - self.count\n }\n}\n\n// And now we can use it!\n\nlet mut counter = Counter::new();\n\nassert_eq!(5, counter.len());\nlet _ = counter.next();\nassert_eq!(4, counter.len());\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"ExactSizeIterator","textEdit":{"newText":"ExactSizeIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Extend","kind":8,"documentation":{"kind":"markdown","value":"Extend a collection with the contents of an iterator.\n\nIterators produce a series of values, and collections can also be thought\nof as a series of values. The `Extend` trait bridges this gap, allowing you\nto extend a collection by including the contents of that iterator. When\nextending a collection with an already existing key, that entry is updated\nor, in the case of collections that permit multiple entries with equal\nkeys, that entry is inserted.\n\n# Examples\n\nBasic usage:\n\n```rust\n// You can extend a String with some chars:\nlet mut message = String::from(\"The first three letters are: \");\n\nmessage.extend(&['a', 'b', 'c']);\n\nassert_eq!(\"abc\", &message[29..32]);\n```\n\nImplementing `Extend`:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// since MyCollection has a list of i32s, we implement Extend for i32\nimpl Extend for MyCollection {\n\n // This is a bit simpler with the concrete type signature: we can call\n // extend on anything which can be turned into an Iterator which gives\n // us i32s. Because we need i32s to put into MyCollection.\n fn extend>(&mut self, iter: T) {\n\n // The implementation is very straightforward: loop through the\n // iterator, and add() each element to ourselves.\n for elem in iter {\n self.add(elem);\n }\n }\n}\n\nlet mut c = MyCollection::new();\n\nc.add(5);\nc.add(6);\nc.add(7);\n\n// let's extend our collection with three more numbers\nc.extend(vec![1, 2, 3]);\n\n// we've added these elements onto the end\nassert_eq!(\"MyCollection([5, 6, 7, 1, 2, 3])\", format!(\"{c:?}\"));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Extend","textEdit":{"newText":"Extend","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Fn","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes an immutable receiver.\n\nInstances of `Fn` can be called repeatedly without mutating state.\n\n*This trait (`Fn`) is not to be confused with [function pointers]\n(`fn`).*\n\n`Fn` is implemented automatically by closures which only take immutable\nreferences to captured variables or don't capture anything at all, as well\nas (safe) [function pointers] (with some caveats, see their documentation\nfor more details). Additionally, for any type `F` that implements `Fn`, `&F`\nimplements `Fn`, too.\n\nSince both [`FnMut`] and [`FnOnce`] are supertraits of `Fn`, any\ninstance of `Fn` can be used as a parameter where a [`FnMut`] or [`FnOnce`]\nis expected.\n\nUse `Fn` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly and without mutating state (e.g., when\ncalling it concurrently). If you do not need such strict requirements, use\n[`FnMut`] or [`FnOnce`] as bounds.\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a closure\n\n```rust\nlet square = |x| x * x;\nassert_eq!(square(5), 25);\n```\n\n## Using a `Fn` parameter\n\n```rust\nfn call_with_one(func: F) -> usize\n where F: Fn(usize) -> usize {\n func(1)\n}\n\nlet double = |x| x * 2;\nassert_eq!(call_with_one(double), 2);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Fn","textEdit":{"newText":"Fn","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"FnMut","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a mutable receiver.\n\nInstances of `FnMut` can be called repeatedly and may mutate state.\n\n`FnMut` is implemented automatically by closures which take mutable\nreferences to captured variables, as well as all types that implement\n[`Fn`], e.g., (safe) [function pointers] (since `FnMut` is a supertrait of\n[`Fn`]). Additionally, for any type `F` that implements `FnMut`, `&mut F`\nimplements `FnMut`, too.\n\nSince [`FnOnce`] is a supertrait of `FnMut`, any instance of `FnMut` can be\nused where a [`FnOnce`] is expected, and since [`Fn`] is a subtrait of\n`FnMut`, any instance of [`Fn`] can be used where `FnMut` is expected.\n\nUse `FnMut` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly, while allowing it to mutate state.\nIf you don't want the parameter to mutate state, use [`Fn`] as a\nbound; if you don't need to call it repeatedly, use [`FnOnce`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a mutably capturing closure\n\n```rust\nlet mut x = 5;\n{\n let mut square_x = || x *= x;\n square_x();\n}\nassert_eq!(x, 25);\n```\n\n## Using a `FnMut` parameter\n\n```rust\nfn do_twice(mut func: F)\n where F: FnMut()\n{\n func();\n func();\n}\n\nlet mut x: usize = 1;\n{\n let add_two_to_x = || x += 2;\n do_twice(add_two_to_x);\n}\n\nassert_eq!(x, 5);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FnMut","textEdit":{"newText":"FnMut","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"FnOnce","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a by-value receiver.\n\nInstances of `FnOnce` can be called, but might not be callable multiple\ntimes. Because of this, if the only thing known about a type is that it\nimplements `FnOnce`, it can only be called once.\n\n`FnOnce` is implemented automatically by closures that might consume captured\nvariables, as well as all types that implement [`FnMut`], e.g., (safe)\n[function pointers] (since `FnOnce` is a supertrait of [`FnMut`]).\n\nSince both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of\n[`Fn`] or [`FnMut`] can be used where a `FnOnce` is expected.\n\nUse `FnOnce` as a bound when you want to accept a parameter of function-like\ntype and only need to call it once. If you need to call the parameter\nrepeatedly, use [`FnMut`] as a bound; if you also need it to not mutate\nstate, use [`Fn`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Using a `FnOnce` parameter\n\n```rust\nfn consume_with_relish(func: F)\n where F: FnOnce() -> String\n{\n // `func` consumes its captured variables, so it cannot be run more\n // than once.\n println!(\"Consumed: {}\", func());\n\n println!(\"Delicious!\");\n\n // Attempting to invoke `func()` again will throw a `use of moved\n // value` error for `func`.\n}\n\nlet x = String::from(\"x\");\nlet consume_and_return_x = move || x;\nconsume_with_relish(consume_and_return_x);\n\n// `consume_and_return_x` can no longer be invoked at this point\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FnOnce","textEdit":{"newText":"FnOnce","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"From","kind":8,"documentation":{"kind":"markdown","value":"Used to do value-to-value conversions while consuming the input value. It is the reciprocal of\n[`Into`].\n\nOne should always prefer implementing `From` over [`Into`]\nbecause implementing `From` automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nOnly implement [`Into`] when targeting a version prior to Rust 1.41 and converting to a type\noutside the current crate.\n`From` was not able to do these types of conversions in earlier versions because of Rust's\norphaning rules.\nSee [`Into`] for more details.\n\nPrefer using [`Into`] over using `From` when specifying trait bounds on a generic function.\nThis way, types that directly implement [`Into`] can be used as arguments as well.\n\nThe `From` is also very useful when performing error handling. When constructing a function\nthat is capable of failing, the return type will generally be of the form `Result`.\nThe `From` trait simplifies error handling by allowing a function to return a single error type\nthat encapsulate multiple error types. See the \"Examples\" section and [the book][book] for more\ndetails.\n\n**Note: This trait must not fail**. The `From` trait is intended for perfect conversions.\nIf the conversion can fail or is not perfect, use [`TryFrom`].\n\n# Generic Implementations\n\n- `From for U` implies [`Into`]` for T`\n- `From` is reflexive, which means that `From for T` is implemented\n\n# When to implement `From`\n\nWhile there's no technical restrictions on which conversions can be done using\na `From` implementation, the general expectation is that the conversions\nshould typically be restricted as follows:\n\n* The conversion is *infallible*: if the conversion can fail, use [`TryFrom`]\n instead; don't provide a `From` impl that panics.\n\n* The conversion is *lossless*: semantically, it should not lose or discard\n information. For example, `i32: From` exists, where the original\n value can be recovered using `u16: TryFrom`. And `String: From<&str>`\n exists, where you can get something equivalent to the original value via\n `Deref`. But `From` cannot be used to convert from `u32` to `u16`, since\n that cannot succeed in a lossless way. (There's some wiggle room here for\n information not considered semantically relevant. For example,\n `Box<[T]>: From>` exists even though it might not preserve capacity,\n like how two vectors can be equal despite differing capacities.)\n\n* The conversion is *value-preserving*: the conceptual kind and meaning of\n the resulting value is the same, even though the Rust type and technical\n representation might be different. For example `-1_i8 as u8` is *lossless*,\n since `as` casting back can recover the original value, but that conversion\n is *not* available via `From` because `-1` and `255` are different conceptual\n values (despite being identical bit patterns technically). But\n `f32: From` *is* available because `1_i16` and `1.0_f32` are conceptually\n the same real number (despite having very different bit patterns technically).\n `String: From` is available because they're both *text*, but\n `String: From` is *not* available, since `1` (a number) and `\"1\"`\n (text) are too different. (Converting values to text is instead covered\n by the [`Display`](crate::fmt::Display) trait.)\n\n* The conversion is *obvious*: it's the only reasonable conversion between\n the two types. Otherwise it's better to have it be a named method or\n constructor, like how [`str::as_bytes`] is a method and how integers have\n methods like [`u32::from_ne_bytes`], [`u32::from_le_bytes`], and\n [`u32::from_be_bytes`], none of which are `From` implementations. Whereas\n there's only one reasonable way to wrap an [`Ipv6Addr`](crate::net::Ipv6Addr)\n into an [`IpAddr`](crate::net::IpAddr), thus `IpAddr: From` exists.\n\n# Examples\n\n[`String`] implements `From<&str>`:\n\nAn explicit conversion from a `&str` to a String is done as follows:\n\n```rust\nlet string = \"hello\".to_string();\nlet other_string = String::from(\"hello\");\n\nassert_eq!(string, other_string);\n```\n\nWhile performing error handling it is often useful to implement `From` for your own error type.\nBy converting underlying error types to our own custom error type that encapsulates the\nunderlying error type, we can return a single error type without losing information on the\nunderlying cause. The '?' operator automatically converts the underlying error type to our\ncustom error type with `From::from`.\n\n```rust\nuse std::fs;\nuse std::io;\nuse std::num;\n\nenum CliError {\n IoError(io::Error),\n ParseError(num::ParseIntError),\n}\n\nimpl From for CliError {\n fn from(error: io::Error) -> Self {\n CliError::IoError(error)\n }\n}\n\nimpl From for CliError {\n fn from(error: num::ParseIntError) -> Self {\n CliError::ParseError(error)\n }\n}\n\nfn open_and_parse_file(file_name: &str) -> Result {\n let mut contents = fs::read_to_string(&file_name)?;\n let num: i32 = contents.trim().parse()?;\n Ok(num)\n}\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`from`]: From::from\n[book]: ../../book/ch09-00-error-handling.html"},"deprecated":false,"sortText":"ffffffef","filterText":"From","textEdit":{"newText":"From","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"FromIterator","kind":8,"documentation":{"kind":"markdown","value":"Conversion from an [`Iterator`].\n\nBy implementing `FromIterator` for a type, you define how it will be\ncreated from an iterator. This is common for types which describe a\ncollection of some kind.\n\nIf you want to create a collection from the contents of an iterator, the\n[`Iterator::collect()`] method is preferred. However, when you need to\nspecify the container type, [`FromIterator::from_iter()`] can be more\nreadable than using a turbofish (e.g. `::>()`). See the\n[`Iterator::collect()`] documentation for more examples of its use.\n\nSee also: [`IntoIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v = Vec::from_iter(five_fives);\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`Iterator::collect()`] to implicitly use `FromIterator`:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v: Vec = five_fives.collect();\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`FromIterator::from_iter()`] as a more readable alternative to\n[`Iterator::collect()`]:\n\n```rust\nuse std::collections::VecDeque;\nlet first = (0..10).collect::>();\nlet second = VecDeque::from_iter(0..10);\n\nassert_eq!(first, second);\n```\n\nImplementing `FromIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement FromIterator\nimpl FromIterator for MyCollection {\n fn from_iter>(iter: I) -> Self {\n let mut c = MyCollection::new();\n\n for i in iter {\n c.add(i);\n }\n\n c\n }\n}\n\n// Now we can make a new iterator...\nlet iter = (0..5).into_iter();\n\n// ... and make a MyCollection out of it\nlet c = MyCollection::from_iter(iter);\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n\n// collect works too!\n\nlet iter = (0..5).into_iter();\nlet c: MyCollection = iter.collect();\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FromIterator","textEdit":{"newText":"FromIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Into","kind":8,"documentation":{"kind":"markdown","value":"A value-to-value conversion that consumes the input value. The\nopposite of [`From`].\n\nOne should avoid implementing [`Into`] and implement [`From`] instead.\nImplementing [`From`] automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nPrefer using [`Into`] over [`From`] when specifying trait bounds on a generic function\nto ensure that types that only implement [`Into`] can be used as well.\n\n**Note: This trait must not fail**. If the conversion can fail, use [`TryInto`].\n\n# Generic Implementations\n\n- [`From`]` for U` implies `Into for T`\n- [`Into`] is reflexive, which means that `Into for T` is implemented\n\n# Implementing [`Into`] for conversions to external types in old versions of Rust\n\nPrior to Rust 1.41, if the destination type was not part of the current crate\nthen you couldn't implement [`From`] directly.\nFor example, take this code:\n\n```rust\nstruct Wrapper(Vec);\nimpl From> for Vec {\n fn from(w: Wrapper) -> Vec {\n w.0\n }\n}\n```\nThis will fail to compile in older versions of the language because Rust's orphaning rules\nused to be a little bit more strict. To bypass this, you could implement [`Into`] directly:\n\n```rust\nstruct Wrapper(Vec);\nimpl Into> for Wrapper {\n fn into(self) -> Vec {\n self.0\n }\n}\n```\n\nIt is important to understand that [`Into`] does not provide a [`From`] implementation\n(as [`From`] does with [`Into`]). Therefore, you should always try to implement [`From`]\nand then fall back to [`Into`] if [`From`] can't be implemented.\n\n# Examples\n\n[`String`] implements [`Into`]`<`[`Vec`]`<`[`u8`]`>>`:\n\nIn order to express that we want a generic function to take all arguments that can be\nconverted to a specified type `T`, we can use a trait bound of [`Into`]``.\nFor example: The function `is_hello` takes all arguments that can be converted into a\n[`Vec`]`<`[`u8`]`>`.\n\n```rust\nfn is_hello>>(s: T) {\n let bytes = b\"hello\".to_vec();\n assert_eq!(bytes, s.into());\n}\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`Vec`]: ../../std/vec/struct.Vec.html"},"deprecated":false,"sortText":"ffffffef","filterText":"Into","textEdit":{"newText":"Into","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"IntoIterator","kind":8,"documentation":{"kind":"markdown","value":"Conversion into an [`Iterator`].\n\nBy implementing `IntoIterator` for a type, you define how it will be\nconverted to an iterator. This is common for types which describe a\ncollection of some kind.\n\nOne benefit of implementing `IntoIterator` is that your type will [work\nwith Rust's `for` loop syntax](crate::iter#for-loops-and-intoiterator).\n\nSee also: [`FromIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = [1, 2, 3];\nlet mut iter = v.into_iter();\n\nassert_eq!(Some(1), iter.next());\nassert_eq!(Some(2), iter.next());\nassert_eq!(Some(3), iter.next());\nassert_eq!(None, iter.next());\n```\nImplementing `IntoIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement IntoIterator\nimpl IntoIterator for MyCollection {\n type Item = i32;\n type IntoIter = std::vec::IntoIter;\n\n fn into_iter(self) -> Self::IntoIter {\n self.0.into_iter()\n }\n}\n\n// Now we can make a new collection...\nlet mut c = MyCollection::new();\n\n// ... add some stuff to it ...\nc.add(0);\nc.add(1);\nc.add(2);\n\n// ... and then turn it into an Iterator:\nfor (i, n) in c.into_iter().enumerate() {\n assert_eq!(i as i32, n);\n}\n```\n\nIt is common to use `IntoIterator` as a trait bound. This allows\nthe input collection type to change, so long as it is still an\niterator. Additional bounds can be specified by restricting on\n`Item`:\n\n```rust\nfn collect_as_strings(collection: T) -> Vec\nwhere\n T: IntoIterator,\n T::Item: std::fmt::Debug,\n{\n collection\n .into_iter()\n .map(|item| format!(\"{item:?}\"))\n .collect()\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"IntoIterator","textEdit":{"newText":"IntoIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Iterator","kind":8,"documentation":{"kind":"markdown","value":"A trait for dealing with iterators.\n\nThis is the main iterator trait. For more about the concept of iterators\ngenerally, please see the [module-level documentation]. In particular, you\nmay want to know how to [implement `Iterator`][impl].\n\n[module-level documentation]: crate::iter\n[impl]: crate::iter#implementing-iterator"},"deprecated":false,"sortText":"ffffffef","filterText":"Iterator","textEdit":{"newText":"Iterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"None","kind":20,"detail":"None","documentation":{"kind":"markdown","value":"No value."},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"None","insertTextFormat":2,"textEdit":{"newText":"None$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"Ok(…)","kind":20,"detail":"Ok(T)","documentation":{"kind":"markdown","value":"Contains the success value"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Ok()","insertTextFormat":2,"textEdit":{"newText":"Ok(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"Option","kind":13,"documentation":{"kind":"markdown","value":"The `Option` type. See [the module level documentation](self) for more."},"deprecated":false,"sortText":"ffffffef","filterText":"Option","textEdit":{"newText":"Option","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Ord (alias <, >, <=, >=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for types that form a [total order](https://en.wikipedia.org/wiki/Total_order).\n\nImplementations must be consistent with the [`PartialOrd`] implementation, and ensure\n`max`, `min`, and `clamp` are consistent with `cmp`:\n\n- `partial_cmp(a, b) == Some(cmp(a, b))`.\n- `max(a, b) == max_by(a, b, cmp)` (ensured by the default implementation).\n- `min(a, b) == min_by(a, b, cmp)` (ensured by the default implementation).\n- For `a.clamp(min, max)`, see the [method docs](#method.clamp)\n (ensured by the default implementation).\n\nIt's easy to accidentally make `cmp` and `partial_cmp` disagree by\nderiving some of the traits and manually implementing others.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nFrom the above and the requirements of `PartialOrd`, it follows that for\nall `a`, `b` and `c`:\n\n- exactly one of `a < b`, `a == b` or `a > b` is true; and\n- `<` is transitive: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n\nMathematically speaking, the `<` operator defines a strict [weak order]. In\ncases where `==` conforms to mathematical equality, it also defines a\nstrict [total order].\n\n[weak order]: https://en.wikipedia.org/wiki/Weak_ordering\n[total order]: https://en.wikipedia.org/wiki/Total_order\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## Lexicographical comparison\n\nLexicographical comparison is an operation with the following properties:\n - Two sequences are compared element by element.\n - The first mismatching element defines which sequence is lexicographically less or greater than the other.\n - If one sequence is a prefix of another, the shorter sequence is lexicographically less than the other.\n - If two sequences have equivalent elements and are of the same length, then the sequences are lexicographically equal.\n - An empty sequence is lexicographically less than any non-empty sequence.\n - Two empty sequences are lexicographically equal.\n\n## How can I implement `Ord`?\n\n`Ord` requires that the type also be [`PartialOrd`] and [`Eq`] (which requires [`PartialEq`]).\n\nThen you must define an implementation for [`cmp`]. You may find it useful to use\n[`cmp`] on your type's fields.\n\nHere's an example where you want to sort people by height only, disregarding `id`\nand `name`:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n[`cmp`]: Ord::cmp"},"deprecated":false,"sortText":"ffffffef","filterText":"Ord","textEdit":{"newText":"Ord","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"PartialEq (alias ==, !=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for comparisons using the equality operator.\n\nImplementing this trait for types provides the `==` and `!=` operators for\nthose types.\n\n`x.eq(y)` can also be written `x == y`, and `x.ne(y)` can be written `x != y`.\nWe use the easier-to-read infix notation in the remainder of this documentation.\n\nThis trait allows for comparisons using the equality operator, for types\nthat do not have a full equivalence relation. For example, in floating point\nnumbers `NaN != NaN`, so floating point types implement `PartialEq` but not\n[`trait@Eq`]. Formally speaking, when `Rhs == Self`, this trait corresponds\nto a [partial equivalence relation].\n\n[partial equivalence relation]: https://en.wikipedia.org/wiki/Partial_equivalence_relation\n\nImplementations must ensure that `eq` and `ne` are consistent with each other:\n\n- `a != b` if and only if `!(a == b)`.\n\nThe default implementation of `ne` provides this consistency and is almost\nalways sufficient. It should not be overridden without very good reason.\n\nIf [`PartialOrd`] or [`Ord`] are also implemented for `Self` and `Rhs`, their methods must also\nbe consistent with `PartialEq` (see the documentation of those traits for the exact\nrequirements). It's easy to accidentally make them disagree by deriving some of the traits and\nmanually implementing others.\n\nThe equality relation `==` must satisfy the following conditions\n(for all `a`, `b`, `c` of type `A`, `B`, `C`):\n\n- **Symmetric**: if `A: PartialEq` and `B: PartialEq`, then **`a == b`\n implies `b == a`**; and\n\n- **Transitive**: if `A: PartialEq` and `B: PartialEq` and `A:\n PartialEq`, then **`a == b` and `b == c` implies `a == c`**.\n\nNote that the `B: PartialEq` (symmetric) and `A: PartialEq`\n(transitive) impls are not forced to exist, but these requirements apply\nwhenever they do exist.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d on structs, two\ninstances are equal if all fields are equal, and not equal if any fields\nare not equal. When `derive`d on enums, two instances are equal if they\nare the same variant and all fields are equal.\n\n## How can I implement `PartialEq`?\n\nAn example implementation for a domain in which two books are considered\nthe same book if their ISBN matches, even if the formats differ:\n\n```rust\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\nlet b2 = Book { isbn: 3, format: BookFormat::Ebook };\nlet b3 = Book { isbn: 10, format: BookFormat::Paperback };\n\nassert!(b1 == b2);\nassert!(b1 != b3);\n```\n\n## How can I compare two different types?\n\nThe type you can compare with is controlled by `PartialEq`'s type parameter.\nFor example, let's tweak our previous code a bit:\n\n```rust\n// The derive implements == comparisons\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\n// Implement == comparisons\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\n// Implement == comparisons\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\n\nassert!(b1 == BookFormat::Paperback);\nassert!(BookFormat::Ebook != b1);\n```\n\nBy changing `impl PartialEq for Book` to `impl PartialEq for Book`,\nwe allow `BookFormat`s to be compared with `Book`s.\n\nA comparison like the one above, which ignores some fields of the struct,\ncan be dangerous. It can easily lead to an unintended violation of the\nrequirements for a partial equivalence relation. For example, if we kept\nthe above implementation of `PartialEq` for `BookFormat` and added an\nimplementation of `PartialEq` for `Book` (either via a `#[derive]` or\nvia the manual implementation from the first example) then the result would\nviolate transitivity:\n\n```rust\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\n#[derive(PartialEq)]\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nfn main() {\n let b1 = Book { isbn: 1, format: BookFormat::Paperback };\n let b2 = Book { isbn: 2, format: BookFormat::Paperback };\n\n assert!(b1 == BookFormat::Paperback);\n assert!(BookFormat::Paperback == b2);\n\n // The following should hold by transitivity but doesn't.\n assert!(b1 == b2); // <-- PANICS\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x == y, false);\nassert_eq!(x.eq(&y), false);\n```\n\n[`eq`]: PartialEq::eq\n[`ne`]: PartialEq::ne"},"deprecated":false,"sortText":"ffffffef","filterText":"PartialEq","textEdit":{"newText":"PartialEq","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"PartialOrd (alias >, <, <=, >=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for types that form a [partial order](https://en.wikipedia.org/wiki/Partial_order).\n\nThe `lt`, `le`, `gt`, and `ge` methods of this trait can be called using\nthe `<`, `<=`, `>`, and `>=` operators, respectively.\n\nThe methods of this trait must be consistent with each other and with those of [`PartialEq`].\nThe following conditions must hold:\n\n1. `a == b` if and only if `partial_cmp(a, b) == Some(Equal)`.\n2. `a < b` if and only if `partial_cmp(a, b) == Some(Less)`\n3. `a > b` if and only if `partial_cmp(a, b) == Some(Greater)`\n4. `a <= b` if and only if `a < b || a == b`\n5. `a >= b` if and only if `a > b || a == b`\n6. `a != b` if and only if `!(a == b)`.\n\nConditions 2–5 above are ensured by the default implementation.\nCondition 6 is already ensured by [`PartialEq`].\n\nIf [`Ord`] is also implemented for `Self` and `Rhs`, it must also be consistent with\n`partial_cmp` (see the documentation of that trait for the exact requirements). It's\neasy to accidentally make them disagree by deriving some of the traits and manually\nimplementing others.\n\nThe comparison must satisfy, for all `a`, `b` and `c`:\n\n- transitivity: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n- duality: `a < b` if and only if `b > a`.\n\nNote that these requirements mean that the trait itself must be implemented symmetrically and\ntransitively: if `T: PartialOrd` and `U: PartialOrd` then `U: PartialOrd` and `T:\nPartialOrd`.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nThe following corollaries follow from the above requirements:\n\n- irreflexivity of `<` and `>`: `!(a < a)`, `!(a > a)`\n- transitivity of `>`: if `a > b` and `b > c` then `a > c`\n- duality of `partial_cmp`: `partial_cmp(a, b) == partial_cmp(b, a).map(Ordering::reverse)`\n\n## Strict and non-strict partial orders\n\nThe `<` and `>` operators behave according to a *strict* partial order.\nHowever, `<=` and `>=` do **not** behave according to a *non-strict*\npartial order.\nThat is because mathematically, a non-strict partial order would require\nreflexivity, i.e. `a <= a` would need to be true for every `a`. This isn't\nalways the case for types that implement `PartialOrd`, for example:\n\n```rust\nlet a = f64::sqrt(-1.0);\nassert_eq!(a <= a, false);\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## How can I implement `PartialOrd`?\n\n`PartialOrd` only requires implementation of the [`partial_cmp`] method, with the others\ngenerated from default implementations.\n\nHowever it remains possible to implement the others separately for types which do not have a\ntotal order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==\nfalse` (cf. IEEE 754-2008 section 5.11).\n\n`PartialOrd` requires your type to be [`PartialEq`].\n\nIf your type is [`Ord`], you can implement [`partial_cmp`] by using [`cmp`]:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\nYou may also find it useful to use [`partial_cmp`] on your type's fields. Here\nis an example of `Person` types who have a floating-point `height` field that\nis the only field to be used for sorting:\n\n```rust\nuse std::cmp::Ordering;\n\nstruct Person {\n id: u32,\n name: String,\n height: f64,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n self.height.partial_cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x < y, true);\nassert_eq!(x.lt(&y), true);\n```\n\n[`partial_cmp`]: PartialOrd::partial_cmp\n[`cmp`]: Ord::cmp"},"deprecated":false,"sortText":"ffffffef","filterText":"PartialOrd","textEdit":{"newText":"PartialOrd","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Result","kind":13,"documentation":{"kind":"markdown","value":"`Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).\n\nSee the [module documentation](self) for details."},"deprecated":false,"sortText":"ffffffef","filterText":"Result","textEdit":{"newText":"Result","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"RustcDecodable","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"RustcDecodable","textEdit":{"newText":"RustcDecodable","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"RustcEncodable","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"RustcEncodable","textEdit":{"newText":"RustcEncodable","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Some(…)","kind":20,"detail":"Some(T)","documentation":{"kind":"markdown","value":"Some value of type `T`."},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Some()","insertTextFormat":2,"textEdit":{"newText":"Some(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"String","kind":22,"documentation":{"kind":"markdown","value":"A UTF-8–encoded, growable string.\n\nThe `String` type is the most common string type that has ownership over the\ncontents of the string. It has a close relationship with its borrowed\ncounterpart, the primitive [`str`].\n\n# Examples\n\nYou can create a `String` from [a literal string][`&str`] with [`String::from`]:\n\n[`String::from`]: From::from\n\n```rust\nlet hello = String::from(\"Hello, world!\");\n```\n\nYou can append a [`char`] to a `String` with the [`push`] method, and\nappend a [`&str`] with the [`push_str`] method:\n\n```rust\nlet mut hello = String::from(\"Hello, \");\n\nhello.push('w');\nhello.push_str(\"orld!\");\n```\n\n[`push`]: String::push\n[`push_str`]: String::push_str\n\nIf you have a vector of UTF-8 bytes, you can create a `String` from it with\nthe [`from_utf8`] method:\n\n```rust\n// some bytes, in a vector\nlet sparkle_heart = vec![240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `unwrap()`.\nlet sparkle_heart = String::from_utf8(sparkle_heart).unwrap();\n\nassert_eq!(\"💖\", sparkle_heart);\n```\n\n[`from_utf8`]: String::from_utf8\n\n# UTF-8\n\n`String`s are always valid UTF-8. If you need a non-UTF-8 string, consider\n[`OsString`]. It is similar, but without the UTF-8 constraint. Because UTF-8\nis a variable width encoding, `String`s are typically smaller than an array of\nthe same `chars`:\n\n```rust\nuse std::mem;\n\n// `s` is ASCII which represents each `char` as one byte\nlet s = \"hello\";\nassert_eq!(s.len(), 5);\n\n// A `char` array with the same contents would be longer because\n// every `char` is four bytes\nlet s = ['h', 'e', 'l', 'l', 'o'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n\n// However, for non-ASCII strings, the difference will be smaller\n// and sometimes they are the same\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.len(), 20);\n\nlet s = ['💖', '💖', '💖', '💖', '💖'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n```\n\nThis raises interesting questions as to how `s[i]` should work.\nWhat should `i` be here? Several options include byte indices and\n`char` indices but, because of UTF-8 encoding, only byte indices\nwould provide constant time indexing. Getting the `i`th `char`, for\nexample, is available using [`chars`]:\n\n```rust\nlet s = \"hello\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('l'));\n\nlet s = \"💖💖💖💖💖\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('💖'));\n```\n\nNext, what should `s[i]` return? Because indexing returns a reference\nto underlying data it could be `&u8`, `&[u8]`, or something else similar.\nSince we're only providing one index, `&u8` makes the most sense but that\nmight not be what the user expects and can be explicitly achieved with\n[`as_bytes()`]:\n\n```rust\n// The first byte is 104 - the byte value of `'h'`\nlet s = \"hello\";\nassert_eq!(s.as_bytes()[0], 104);\n// or\nassert_eq!(s.as_bytes()[0], b'h');\n\n// The first byte is 240 which isn't obviously useful\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.as_bytes()[0], 240);\n```\n\nDue to these ambiguities/restrictions, indexing with a `usize` is simply\nforbidden:\n\n```rust\nlet s = \"hello\";\n\n// The following will not compile!\nprintln!(\"The first letter of s is {}\", s[0]);\n```\n\nIt is more clear, however, how `&s[i..j]` should work (that is,\nindexing with a range). It should accept byte indices (to be constant-time)\nand return a `&str` which is UTF-8 encoded. This is also called \"string slicing\".\nNote this will panic if the byte indices provided are not character\nboundaries - see [`is_char_boundary`] for more details. See the implementations\nfor [`SliceIndex`] for more details on string slicing. For a non-panicking\nversion of string slicing, see [`get`].\n\n[`OsString`]: ../../std/ffi/struct.OsString.html \"ffi::OsString\"\n[`SliceIndex`]: core::slice::SliceIndex\n[`as_bytes()`]: str::as_bytes\n[`get`]: str::get\n[`is_char_boundary`]: str::is_char_boundary\n\nThe [`bytes`] and [`chars`] methods return iterators over the bytes and\ncodepoints of the string, respectively. To iterate over codepoints along\nwith byte indices, use [`char_indices`].\n\n[`bytes`]: str::bytes\n[`chars`]: str::chars\n[`char_indices`]: str::char_indices\n\n# Deref\n\n`String` implements [Deref], and so inherits all of [`str`]'s\nmethods. In addition, this means that you can pass a `String` to a\nfunction which takes a [`&str`] by using an ampersand (`&`):\n\n```rust\nfn takes_str(s: &str) { }\n\nlet s = String::from(\"Hello\");\n\ntakes_str(&s);\n```\n\nThis will create a [`&str`] from the `String` and pass it in. This\nconversion is very inexpensive, and so generally, functions will accept\n[`&str`]s as arguments unless they need a `String` for some specific\nreason.\n\nIn certain cases Rust doesn't have enough information to make this\nconversion, known as [`Deref`] coercion. In the following example a string\nslice [`&'a str`][`&str`] implements the trait `TraitExample`, and the function\n`example_func` takes anything that implements the trait. In this case Rust\nwould need to make two implicit conversions, which Rust doesn't have the\nmeans to do. For that reason, the following example will not compile.\n\n```rust\ntrait TraitExample {}\n\nimpl<'a> TraitExample for &'a str {}\n\nfn example_func(example_arg: A) {}\n\nlet example_string = String::from(\"example_string\");\nexample_func(&example_string);\n```\n\nThere are two options that would work instead. The first would be to\nchange the line `example_func(&example_string);` to\n`example_func(example_string.as_str());`, using the method [`as_str()`]\nto explicitly extract the string slice containing the string. The second\nway changes `example_func(&example_string);` to\n`example_func(&*example_string);`. In this case we are dereferencing a\n`String` to a [`str`], then referencing the [`str`] back to\n[`&str`]. The second way is more idiomatic, however both work to do the\nconversion explicitly rather than relying on the implicit conversion.\n\n# Representation\n\nA `String` is made up of three components: a pointer to some bytes, a\nlength, and a capacity. The pointer points to an internal buffer `String`\nuses to store its data. The length is the number of bytes currently stored\nin the buffer, and the capacity is the size of the buffer in bytes. As such,\nthe length will always be less than or equal to the capacity.\n\nThis buffer is always stored on the heap.\n\nYou can look at these with the [`as_ptr`], [`len`], and [`capacity`]\nmethods:\n\n```rust\nuse std::mem;\n\nlet story = String::from(\"Once upon a time...\");\n\n// Prevent automatically dropping the String's data\nlet mut story = mem::ManuallyDrop::new(story);\n\nlet ptr = story.as_mut_ptr();\nlet len = story.len();\nlet capacity = story.capacity();\n\n// story has nineteen bytes\nassert_eq!(19, len);\n\n// We can re-build a String out of ptr, len, and capacity. This is all\n// unsafe because we are responsible for making sure the components are\n// valid:\nlet s = unsafe { String::from_raw_parts(ptr, len, capacity) } ;\n\nassert_eq!(String::from(\"Once upon a time...\"), s);\n```\n\n[`as_ptr`]: str::as_ptr\n[`len`]: String::len\n[`capacity`]: String::capacity\n\nIf a `String` has enough capacity, adding elements to it will not\nre-allocate. For example, consider this program:\n\n```rust\nlet mut s = String::new();\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\nThis will output the following:\n\n```text\n0\n8\n16\n16\n32\n32\n```\n\nAt first, we have no memory allocated at all, but as we append to the\nstring, it increases its capacity appropriately. If we instead use the\n[`with_capacity`] method to allocate the correct capacity initially:\n\n```rust\nlet mut s = String::with_capacity(25);\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\n[`with_capacity`]: String::with_capacity\n\nWe end up with a different output:\n\n```text\n25\n25\n25\n25\n25\n25\n```\n\nHere, there's no need to allocate more memory inside the loop.\n\n[str]: prim@str \"str\"\n[`str`]: prim@str \"str\"\n[`&str`]: prim@str \"&str\"\n[Deref]: core::ops::Deref \"ops::Deref\"\n[`Deref`]: core::ops::Deref \"ops::Deref\"\n[`as_str()`]: String::as_str"},"deprecated":false,"sortText":"ffffffef","filterText":"String","textEdit":{"newText":"String","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"ToOwned","kind":8,"documentation":{"kind":"markdown","value":"A generalization of `Clone` to borrowed data.\n\nSome types make it possible to go from borrowed to owned, usually by\nimplementing the `Clone` trait. But `Clone` works only for going from `&T`\nto `T`. The `ToOwned` trait generalizes `Clone` to construct owned data\nfrom any borrow of a given type."},"deprecated":false,"sortText":"ffffffef","filterText":"ToOwned","textEdit":{"newText":"ToOwned","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"ToString","kind":8,"documentation":{"kind":"markdown","value":"A trait for converting a value to a `String`.\n\nThis trait is automatically implemented for any type which implements the\n[`Display`] trait. As such, `ToString` shouldn't be implemented directly:\n[`Display`] should be implemented instead, and you get the `ToString`\nimplementation for free.\n\n[`Display`]: fmt::Display"},"deprecated":false,"sortText":"ffffffef","filterText":"ToString","textEdit":{"newText":"ToString","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"TryFrom","kind":8,"documentation":{"kind":"markdown","value":"Simple and safe type conversions that may fail in a controlled\nway under some circumstances. It is the reciprocal of [`TryInto`].\n\nThis is useful when you are doing a type conversion that may\ntrivially succeed but may also need special handling.\nFor example, there is no way to convert an [`i64`] into an [`i32`]\nusing the [`From`] trait, because an [`i64`] may contain a value\nthat an [`i32`] cannot represent and so the conversion would lose data.\nThis might be handled by truncating the [`i64`] to an [`i32`] or by\nsimply returning [`i32::MAX`], or by some other method. The [`From`]\ntrait is intended for perfect conversions, so the `TryFrom` trait\ninforms the programmer when a type conversion could go bad and lets\nthem decide how to handle it.\n\n# Generic Implementations\n\n- `TryFrom for U` implies [`TryInto`]` for T`\n- [`try_from`] is reflexive, which means that `TryFrom for T`\nis implemented and cannot fail -- the associated `Error` type for\ncalling `T::try_from()` on a value of type `T` is [`Infallible`].\nWhen the [`!`] type is stabilized [`Infallible`] and [`!`] will be\nequivalent.\n\n`TryFrom` can be implemented as follows:\n\n```rust\nstruct GreaterThanZero(i32);\n\nimpl TryFrom for GreaterThanZero {\n type Error = &'static str;\n\n fn try_from(value: i32) -> Result {\n if value <= 0 {\n Err(\"GreaterThanZero only accepts values greater than zero!\")\n } else {\n Ok(GreaterThanZero(value))\n }\n }\n}\n```\n\n# Examples\n\nAs described, [`i32`] implements `TryFrom<`[`i64`]`>`:\n\n```rust\nlet big_number = 1_000_000_000_000i64;\n// Silently truncates `big_number`, requires detecting\n// and handling the truncation after the fact.\nlet smaller_number = big_number as i32;\nassert_eq!(smaller_number, -727379968);\n\n// Returns an error because `big_number` is too big to\n// fit in an `i32`.\nlet try_smaller_number = i32::try_from(big_number);\nassert!(try_smaller_number.is_err());\n\n// Returns `Ok(3)`.\nlet try_successful_smaller_number = i32::try_from(3);\nassert!(try_successful_smaller_number.is_ok());\n```\n\n[`try_from`]: TryFrom::try_from"},"deprecated":false,"sortText":"ffffffef","filterText":"TryFrom","textEdit":{"newText":"TryFrom","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"TryInto","kind":8,"documentation":{"kind":"markdown","value":"An attempted conversion that consumes `self`, which may or may not be\nexpensive.\n\nLibrary authors should usually not directly implement this trait,\nbut should prefer implementing the [`TryFrom`] trait, which offers\ngreater flexibility and provides an equivalent `TryInto`\nimplementation for free, thanks to a blanket implementation in the\nstandard library. For more information on this, see the\ndocumentation for [`Into`].\n\n# Implementing `TryInto`\n\nThis suffers the same restrictions and reasoning as implementing\n[`Into`], see there for details."},"deprecated":false,"sortText":"ffffffef","filterText":"TryInto","textEdit":{"newText":"TryInto","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"Vec","kind":22,"documentation":{"kind":"markdown","value":"A contiguous growable array type, written as `Vec`, short for 'vector'.\n\n# Examples\n\n```rust\nlet mut vec = Vec::new();\nvec.push(1);\nvec.push(2);\n\nassert_eq!(vec.len(), 2);\nassert_eq!(vec[0], 1);\n\nassert_eq!(vec.pop(), Some(2));\nassert_eq!(vec.len(), 1);\n\nvec[0] = 7;\nassert_eq!(vec[0], 7);\n\nvec.extend([1, 2, 3]);\n\nfor x in &vec {\n println!(\"{x}\");\n}\nassert_eq!(vec, [7, 1, 2, 3]);\n```\n\nThe [`vec!`] macro is provided for convenient initialization:\n\n```rust\nlet mut vec1 = vec![1, 2, 3];\nvec1.push(4);\nlet vec2 = Vec::from([1, 2, 3, 4]);\nassert_eq!(vec1, vec2);\n```\n\nIt can also initialize each element of a `Vec` with a given value.\nThis may be more efficient than performing allocation and initialization\nin separate steps, especially when initializing a vector of zeros:\n\n```rust\nlet vec = vec![0; 5];\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n\n// The following is equivalent, but potentially slower:\nlet mut vec = Vec::with_capacity(5);\nvec.resize(5, 0);\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n```\n\nFor more information, see\n[Capacity and Reallocation](#capacity-and-reallocation).\n\nUse a `Vec` as an efficient stack:\n\n```rust\nlet mut stack = Vec::new();\n\nstack.push(1);\nstack.push(2);\nstack.push(3);\n\nwhile let Some(top) = stack.pop() {\n // Prints 3, 2, 1\n println!(\"{top}\");\n}\n```\n\n# Indexing\n\nThe `Vec` type allows access to values by index, because it implements the\n[`Index`] trait. An example will be more explicit:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[1]); // it will display '2'\n```\n\nHowever be careful: if you try to access an index which isn't in the `Vec`,\nyour software will panic! You cannot do this:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[6]); // it will panic!\n```\n\nUse [`get`] and [`get_mut`] if you want to check whether the index is in\nthe `Vec`.\n\n# Slicing\n\nA `Vec` can be mutable. On the other hand, slices are read-only objects.\nTo get a [slice][prim@slice], use [`&`]. Example:\n\n```rust\nfn read_slice(slice: &[usize]) {\n // ...\n}\n\nlet v = vec![0, 1];\nread_slice(&v);\n\n// ... and that's all!\n// you can also do it like this:\nlet u: &[usize] = &v;\n// or like this:\nlet u: &[_] = &v;\n```\n\nIn Rust, it's more common to pass slices as arguments rather than vectors\nwhen you just want to provide read access. The same goes for [`String`] and\n[`&str`].\n\n# Capacity and reallocation\n\nThe capacity of a vector is the amount of space allocated for any future\nelements that will be added onto the vector. This is not to be confused with\nthe *length* of a vector, which specifies the number of actual elements\nwithin the vector. If a vector's length exceeds its capacity, its capacity\nwill automatically be increased, but its elements will have to be\nreallocated.\n\nFor example, a vector with capacity 10 and length 0 would be an empty vector\nwith space for 10 more elements. Pushing 10 or fewer elements onto the\nvector will not change its capacity or cause reallocation to occur. However,\nif the vector's length is increased to 11, it will have to reallocate, which\ncan be slow. For this reason, it is recommended to use [`Vec::with_capacity`]\nwhenever possible to specify how big the vector is expected to get.\n\n# Guarantees\n\nDue to its incredibly fundamental nature, `Vec` makes a lot of guarantees\nabout its design. This ensures that it's as low-overhead as possible in\nthe general case, and can be correctly manipulated in primitive ways\nby unsafe code. Note that these guarantees refer to an unqualified `Vec`.\nIf additional type parameters are added (e.g., to support custom allocators),\noverriding their defaults may change the behavior.\n\nMost fundamentally, `Vec` is and always will be a (pointer, capacity, length)\ntriplet. No more, no less. The order of these fields is completely\nunspecified, and you should use the appropriate methods to modify these.\nThe pointer will never be null, so this type is null-pointer-optimized.\n\nHowever, the pointer might not actually point to allocated memory. In particular,\nif you construct a `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],\n[`Vec::with_capacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]\non an empty Vec, it will not allocate memory. Similarly, if you store zero-sized\ntypes inside a `Vec`, it will not allocate space for them. *Note that in this case\nthe `Vec` might not report a [`capacity`] of 0*. `Vec` will allocate if and only\nif [mem::size_of::\\]\\() * [capacity]\\() > 0. In general, `Vec`'s allocation\ndetails are very subtle --- if you intend to allocate memory using a `Vec`\nand use it for something else (either to pass to unsafe code, or to build your\nown memory-backed collection), be sure to deallocate this memory by using\n`from_raw_parts` to recover the `Vec` and then dropping it.\n\nIf a `Vec` *has* allocated memory, then the memory it points to is on the heap\n(as defined by the allocator Rust is configured to use by default), and its\npointer points to [`len`] initialized, contiguous elements in order (what\nyou would see if you coerced it to a slice), followed by [capacity] - [len]\nlogically uninitialized, contiguous elements.\n\nA vector containing the elements `'a'` and `'b'` with capacity 4 can be\nvisualized as below. The top part is the `Vec` struct, it contains a\npointer to the head of the allocation in the heap, length and capacity.\nThe bottom part is the allocation on the heap, a contiguous memory block.\n\n```text\n ptr len capacity\n +--------+--------+--------+\n | 0x0123 | 2 | 4 |\n +--------+--------+--------+\n |\n v\nHeap +--------+--------+--------+--------+\n | 'a' | 'b' | uninit | uninit |\n +--------+--------+--------+--------+\n```\n\n- **uninit** represents memory that is not initialized, see [`MaybeUninit`].\n- Note: the ABI is not stable and `Vec` makes no guarantees about its memory\n layout (including the order of fields).\n\n`Vec` will never perform a \"small optimization\" where elements are actually\nstored on the stack for two reasons:\n\n* It would make it more difficult for unsafe code to correctly manipulate\n a `Vec`. The contents of a `Vec` wouldn't have a stable address if it were\n only moved, and it would be more difficult to determine if a `Vec` had\n actually allocated memory.\n\n* It would penalize the general case, incurring an additional branch\n on every access.\n\n`Vec` will never automatically shrink itself, even if completely empty. This\nensures no unnecessary allocations or deallocations occur. Emptying a `Vec`\nand then filling it back up to the same [`len`] should incur no calls to\nthe allocator. If you wish to free up unused memory, use\n[`shrink_to_fit`] or [`shrink_to`].\n\n[`push`] and [`insert`] will never (re)allocate if the reported capacity is\nsufficient. [`push`] and [`insert`] *will* (re)allocate if\n[len] == [capacity]. That is, the reported capacity is completely\naccurate, and can be relied on. It can even be used to manually free the memory\nallocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even\nwhen not necessary.\n\n`Vec` does not guarantee any particular growth strategy when reallocating\nwhen full, nor when [`reserve`] is called. The current strategy is basic\nand it may prove desirable to use a non-constant growth factor. Whatever\nstrategy is used will of course guarantee *O*(1) amortized [`push`].\n\n`vec![x; n]`, `vec![a, b, c, d]`, and\n[`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`\nwith exactly the requested capacity. If [len] == [capacity],\n(as is the case for the [`vec!`] macro), then a `Vec` can be converted to\nand from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.\n\n`Vec` will not specifically overwrite any data that is removed from it,\nbut also won't specifically preserve it. Its uninitialized memory is\nscratch space that it may use however it wants. It will generally just do\nwhatever is most efficient or otherwise easy to implement. Do not rely on\nremoved data to be erased for security purposes. Even if you drop a `Vec`, its\nbuffer may simply be reused by another allocation. Even if you zero a `Vec`'s memory\nfirst, that might not actually happen because the optimizer does not consider\nthis a side-effect that must be preserved. There is one case which we will\nnot break, however: using `unsafe` code to write to the excess capacity,\nand then increasing the length to match, is always valid.\n\nCurrently, `Vec` does not guarantee the order in which elements are dropped.\nThe order has changed in the past and may change again.\n\n[`get`]: slice::get\n[`get_mut`]: slice::get_mut\n[`String`]: crate::string::String\n[`&str`]: type@str\n[`shrink_to_fit`]: Vec::shrink_to_fit\n[`shrink_to`]: Vec::shrink_to\n[capacity]: Vec::capacity\n[`capacity`]: Vec::capacity\n[mem::size_of::\\]: core::mem::size_of\n[len]: Vec::len\n[`len`]: Vec::len\n[`push`]: Vec::push\n[`insert`]: Vec::insert\n[`reserve`]: Vec::reserve\n[`MaybeUninit`]: core::mem::MaybeUninit\n[owned slice]: Box"},"deprecated":false,"sortText":"ffffffef","filterText":"Vec","textEdit":{"newText":"Vec","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"alloc_error_handler","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"alloc_error_handler","textEdit":{"newText":"alloc_error_handler","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"drop(…)","kind":3,"detail":"fn(T)","documentation":{"kind":"markdown","value":"Disposes of a value.\n\nThis does so by calling the argument's implementation of [`Drop`][drop].\n\nThis effectively does nothing for types which implement `Copy`, e.g.\nintegers. Such values are copied and _then_ moved into the function, so the\nvalue persists after this function call.\n\nThis function is not magic; it is literally defined as\n\n```rust\npub fn drop(_x: T) {}\n```\n\nBecause `_x` is moved into the function, it is automatically dropped before\nthe function returns.\n\n[drop]: Drop\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = vec![1, 2, 3];\n\ndrop(v); // explicitly drop the vector\n```\n\nSince [`RefCell`] enforces the borrow rules at runtime, `drop` can\nrelease a [`RefCell`] borrow:\n\n```rust\nuse std::cell::RefCell;\n\nlet x = RefCell::new(1);\n\nlet mut mutable_borrow = x.borrow_mut();\n*mutable_borrow = 1;\n\ndrop(mutable_borrow); // relinquish the mutable borrow on this slot\n\nlet borrow = x.borrow();\nprintln!(\"{}\", *borrow);\n```\n\nIntegers and other types implementing [`Copy`] are unaffected by `drop`.\n\n```rust\n#[derive(Copy, Clone)]\nstruct Foo(u8);\n\nlet x = 1;\nlet y = Foo(2);\ndrop(x); // a copy of `x` is moved and dropped\ndrop(y); // a copy of `y` is moved and dropped\n\nprintln!(\"x: {}, y: {}\", x, y.0); // still available\n```\n\n[`RefCell`]: crate::cell::RefCell"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"drop","insertTextFormat":2,"textEdit":{"newText":"drop(${1:x})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"type_ascribe","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"type_ascribe","textEdit":{"newText":"type_ascribe","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"unsafe","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"unsafe","insertTextFormat":2,"textEdit":{"newText":"unsafe {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"match","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"match","insertTextFormat":2,"textEdit":{"newText":"match $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"while","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"while","insertTextFormat":2,"textEdit":{"newText":"while $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"while let","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"while let","insertTextFormat":2,"textEdit":{"newText":"while let $1 = $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"loop","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"loop","insertTextFormat":2,"textEdit":{"newText":"loop {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"if","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"if","insertTextFormat":2,"textEdit":{"newText":"if $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"if let","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"if let","insertTextFormat":2,"textEdit":{"newText":"if let $1 = $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"for","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"for","insertTextFormat":2,"textEdit":{"newText":"for $1 in $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"true","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"true","insertTextFormat":2,"textEdit":{"newText":"true","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"false","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"false","insertTextFormat":2,"textEdit":{"newText":"false","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]},{"label":"return","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"return","insertTextFormat":2,"textEdit":{"newText":"return","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":16}}},"additionalTextEdits":[]}]}} 2023-12-27T20:29:08.565 helix_lsp::transport [INFO] rust-analyzer <- {"isIncomplete":true,"items":[{"additionalTextEdits":[],"data":{"imports":[{"full_import_path":"std::arch::x86_64::_MM_PERM_AAAA","imported_name":"_MM_PERM_AAAA"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"filterText":"_MM_PERM_AAAA","kind":21,"label":"_MM_PERM_AAAA (use std::arch::x86_64::_MM_PERM_AAAA)","sortText":"fffffff0","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"_MM_PERM_AAAA","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"data":{"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_acqrel_acquire","imported_name":"atomic_cxchgweak_acqrel_acquire"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::AcqRel`] and [`Ordering::Acquire`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"filterText":"atomic_cxchgweak_acqrel_acquire","insertTextFormat":2,"kind":3,"label":"atomic_cxchgweak_acqrel_acquire(…) (use std::intrinsics::atomic_cxchgweak_acqrel_acquire)","sortText":"ffffffed","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"atomic_cxchgweak_acqrel_acquire(${1:dst}, ${2:old}, ${3:src})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"data":{"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_acqrel_relaxed","imported_name":"atomic_cxchgweak_acqrel_relaxed"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::AcqRel`] and [`Ordering::Relaxed`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"filterText":"atomic_cxchgweak_acqrel_relaxed","insertTextFormat":2,"kind":3,"label":"atomic_cxchgweak_acqrel_relaxed(…) (use std::intrinsics::atomic_cxchgweak_acqrel_relaxed)","sortText":"ffffffed","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"atomic_cxchgweak_acqrel_relaxed(${1:dst}, ${2:old}, ${3:src})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"data":{"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_acquire_acquire","imported_name":"atomic_cxchgweak_acquire_acquire"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Acquire`] as both the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"filterText":"atomic_cxchgweak_acquire_acquire","insertTextFormat":2,"kind":3,"label":"atomic_cxchgweak_acquire_acquire(…) (use std::intrinsics::atomic_cxchgweak_acquire_acquire)","sortText":"ffffffed","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"atomic_cxchgweak_acquire_acquire(${1:dst}, ${2:old}, ${3:src})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"data":{"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_acquire_relaxed","imported_name":"atomic_cxchgweak_acquire_relaxed"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Acquire`] and [`Ordering::Relaxed`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"filterText":"atomic_cxchgweak_acquire_relaxed","insertTextFormat":2,"kind":3,"label":"atomic_cxchgweak_acquire_relaxed(…) (use std::intrinsics::atomic_cxchgweak_acquire_relaxed)","sortText":"ffffffed","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"atomic_cxchgweak_acquire_relaxed(${1:dst}, ${2:old}, ${3:src})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"data":{"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_relaxed_acquire","imported_name":"atomic_cxchgweak_relaxed_acquire"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Relaxed`] and [`Ordering::Acquire`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"filterText":"atomic_cxchgweak_relaxed_acquire","insertTextFormat":2,"kind":3,"label":"atomic_cxchgweak_relaxed_acquire(…) (use std::intrinsics::atomic_cxchgweak_relaxed_acquire)","sortText":"ffffffed","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"atomic_cxchgweak_relaxed_acquire(${1:dst}, ${2:old}, ${3:src})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"data":{"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_relaxed_relaxed","imported_name":"atomic_cxchgweak_relaxed_relaxed"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Relaxed`] as both the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"filterText":"atomic_cxchgweak_relaxed_relaxed","insertTextFormat":2,"kind":3,"label":"atomic_cxchgweak_relaxed_relaxed(…) (use std::intrinsics::atomic_cxchgweak_relaxed_relaxed)","sortText":"ffffffed","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"atomic_cxchgweak_relaxed_relaxed(${1:dst}, ${2:old}, ${3:src})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"data":{"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_release_acquire","imported_name":"atomic_cxchgweak_release_acquire"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Release`] and [`Ordering::Acquire`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"filterText":"atomic_cxchgweak_release_acquire","insertTextFormat":2,"kind":3,"label":"atomic_cxchgweak_release_acquire(…) (use std::intrinsics::atomic_cxchgweak_release_acquire)","sortText":"ffffffed","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"atomic_cxchgweak_release_acquire(${1:dst}, ${2:old}, ${3:src})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"data":{"imports":[{"full_import_path":"std::intrinsics::atomic_cxchgweak_release_relaxed","imported_name":"atomic_cxchgweak_release_relaxed"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"detail":"unsafe fn(*mut T, T, T) -> (T, bool)","documentation":{"kind":"markdown","value":"Stores a value if the current value is the same as the `old` value.\n\nThe stabilized version of this intrinsic is available on the\n[`atomic`] types via the `compare_exchange_weak` method by passing\n[`Ordering::Release`] and [`Ordering::Relaxed`] as the success and failure parameters.\nFor example, [`AtomicBool::compare_exchange_weak`]."},"filterText":"atomic_cxchgweak_release_relaxed","insertTextFormat":2,"kind":3,"label":"atomic_cxchgweak_release_relaxed(…) (use std::intrinsics::atomic_cxchgweak_release_relaxed)","sortText":"ffffffed","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"atomic_cxchgweak_release_relaxed(${1:dst}, ${2:old}, ${3:src})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"data":{"imports":[{"full_import_path":"std::os::unix::net::AncillaryData","imported_name":"AncillaryData"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"documentation":{"kind":"markdown","value":"This enum represent one control message of variable type."},"filterText":"AncillaryData","kind":13,"label":"AncillaryData (use std::os::unix::net::AncillaryData)","sortText":"fffffff0","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"AncillaryData","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"data":{"imports":[{"full_import_path":"std::str::pattern::CharArrayRefSearcher","imported_name":"CharArrayRefSearcher"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"documentation":{"kind":"markdown","value":"Associated type for `<&[char; N] as Pattern<'a>>::Searcher`."},"filterText":"CharArrayRefSearcher","kind":22,"label":"CharArrayRefSearcher (use std::str::pattern::CharArrayRefSearcher)","sortText":"fffffff0","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"CharArrayRefSearcher","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"data":{"imports":[{"full_import_path":"std::str::pattern::CharArraySearcher","imported_name":"CharArraySearcher"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"documentation":{"kind":"markdown","value":"Associated type for `<[char; N] as Pattern<'a>>::Searcher`."},"filterText":"CharArraySearcher","kind":22,"label":"CharArraySearcher (use std::str::pattern::CharArraySearcher)","sortText":"fffffff0","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"CharArraySearcher","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"data":{"imports":[{"full_import_path":"std::thread::available_parallelism","imported_name":"available_parallelism"}],"position":{"position":{"character":16,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}}},"deprecated":false,"detail":"fn() -> Result","documentation":{"kind":"markdown","value":"Returns an estimate of the default amount of parallelism a program should use.\n\nParallelism is a resource. A given machine provides a certain capacity for\nparallelism, i.e., a bound on the number of computations it can perform\nsimultaneously. This number often corresponds to the amount of CPUs a\ncomputer has, but it may diverge in various cases.\n\nHost environments such as VMs or container orchestrators may want to\nrestrict the amount of parallelism made available to programs in them. This\nis often done to limit the potential impact of (unintentionally)\nresource-intensive programs on other programs running on the same machine.\n\n# Limitations\n\nThe purpose of this API is to provide an easy and portable way to query\nthe default amount of parallelism the program should use. Among other things it\ndoes not expose information on NUMA regions, does not account for\ndifferences in (co)processor capabilities or current system load,\nand will not modify the program's global state in order to more accurately\nquery the amount of available parallelism.\n\nWhere both fixed steady-state and burst limits are available the steady-state\ncapacity will be used to ensure more predictable latencies.\n\nResource limits can be changed during the runtime of a program, therefore the value is\nnot cached and instead recomputed every time this function is called. It should not be\ncalled from hot code.\n\nThe value returned by this function should be considered a simplified\napproximation of the actual amount of parallelism available at any given\ntime. To get a more detailed or precise overview of the amount of\nparallelism available to the program, you may wish to use\nplatform-specific APIs as well. The following platform limitations currently\napply to `available_parallelism`:\n\nOn Windows:\n- It may undercount the amount of parallelism available on systems with more\n than 64 logical CPUs. However, programs typically need specific support to\n take advantage of more than 64 logical CPUs, and in the absence of such\n support, the number returned by this function accurately reflects the\n number of logical CPUs the program can use by default.\n- It may overcount the amount of parallelism available on systems limited by\n process-wide affinity masks, or job object limitations.\n\nOn Linux:\n- It may overcount the amount of parallelism available when limited by a\n process-wide affinity mask or cgroup quotas and `sched_getaffinity()` or cgroup fs can't be\n queried, e.g. due to sandboxing.\n- It may undercount the amount of parallelism if the current thread's affinity mask\n does not reflect the process' cpuset, e.g. due to pinned threads.\n- If the process is in a cgroup v1 cpu controller, this may need to\n scan mountpoints to find the corresponding cgroup v1 controller,\n which may take time on systems with large numbers of mountpoints.\n (This does not apply to cgroup v2, or to processes not in a\n cgroup.)\n\nOn all targets:\n- It may overcount the amount of parallelism available when running in a VM\nwith CPU usage limits (e.g. an overcommitted host).\n\n# Errors\n\nThis function will, but is not limited to, return errors in the following\ncases:\n\n- If the amount of parallelism is not known for the target platform.\n- If the program lacks permission to query the amount of parallelism made\n available to it.\n\n# Examples\n\n```rust\nuse std::{io, thread};\n\nfn main() -> io::Result<()> {\n let count = thread::available_parallelism()?.get();\n assert!(count >= 1_usize);\n Ok(())\n}\n```"},"filterText":"available_parallelismavailable_concurrencyhardware_concurrencynum_cpus","insertTextFormat":2,"kind":3,"label":"available_parallelism() (alias available_concurrency, hardware_concurrency, num_cpus) (use std::thread::available_parallelism)","sortText":"ffffffed","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"available_parallelism()$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"self::","kind":14,"label":"self::","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"self::","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"crate::","kind":14,"label":"crate::","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"crate::","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"fn()","filterText":"main","insertTextFormat":2,"kind":3,"label":"main()","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"main()$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! panic","filterText":"panic!","insertTextFormat":2,"kind":3,"label":"panic!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"panic!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! println","documentation":{"kind":"markdown","value":"Prints to the standard output, with a newline.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`)).\n\nThis macro uses the same syntax as [`format!`], but writes to the standard output instead.\nSee [`std::fmt`] for more information.\n\nThe `println!` macro will lock the standard output on each call. If you call\n`println!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwriteln!(lock, \"hello world\").unwrap();\n```\n\nUse `println!` only for the primary output of your program. Use\n[`eprintln!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`std::fmt`]: crate::fmt\n[`eprintln!`]: crate::eprintln\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to [`io::stdout`] fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n[`io::stdout`]: crate::io::stdout\n\n# Examples\n\n```rust\nprintln!(); // prints just a newline\nprintln!(\"hello there!\");\nprintln!(\"format {} arguments\", \"some\");\nlet local_variable = \"some\";\nprintln!(\"format {local_variable} arguments\");\n```"},"filterText":"println!","insertTextFormat":2,"kind":3,"label":"println!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"println!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_eq!`], `debug_assert_eq!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_eq!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_eq!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_eq!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\ndebug_assert_eq!(a, b);\n```"},"filterText":"debug_assert_eq!","insertTextFormat":2,"kind":3,"label":"debug_assert_eq!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert_eq!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include_str","documentation":{"kind":"markdown","value":"Includes a UTF-8 encoded file as a string.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static str` which is the\ncontents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_str = include_str!(\"spanish.in\");\n assert_eq!(my_str, \"adiós\\n\");\n print!(\"{my_str}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"filterText":"include_str!","insertTextFormat":2,"kind":3,"label":"include_str!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"include_str!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat","documentation":{"kind":"markdown","value":"Concatenates literals into a static string slice.\n\nThis macro takes any number of comma-separated literals, yielding an\nexpression of type `&'static str` which represents all of the literals\nconcatenated left-to-right.\n\nInteger and floating point literals are [stringified](core::stringify) in order to be\nconcatenated.\n\n# Examples\n\n```rust\nlet s = concat!(\"test\", 10, 'b', true);\nassert_eq!(s, \"test10btrue\");\n```"},"filterText":"concat!","insertTextFormat":2,"kind":3,"label":"concat!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"concat!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format","documentation":{"kind":"markdown","value":"Creates a `String` using interpolation of runtime expressions.\n\nThe first argument `format!` receives is a format string. This must be a string\nliteral. The power of the formatting string is in the `{}`s contained.\nAdditional parameters passed to `format!` replace the `{}`s within the\nformatting string in the order given unless named or positional parameters\nare used.\n\nSee [the formatting syntax documentation in `std::fmt`](../std/fmt/index.html)\nfor details.\n\nA common use for `format!` is concatenation and interpolation of strings.\nThe same convention is used with [`print!`] and [`write!`] macros,\ndepending on the intended destination of the string; all these macros internally use [`format_args!`].\n\nTo convert a single value to a string, use the [`to_string`] method. This\nwill use the [`Display`] formatting trait.\n\nTo concatenate literals into a `&'static str`, use the [`concat!`] macro.\n\n[`print!`]: ../std/macro.print.html\n[`write!`]: core::write\n[`format_args!`]: core::format_args\n[`to_string`]: crate::string::ToString\n[`Display`]: core::fmt::Display\n[`concat!`]: core::concat\n\n# Panics\n\n`format!` panics if a formatting trait implementation returns an error.\nThis indicates an incorrect implementation\nsince `fmt::Write for String` never returns an error itself.\n\n# Examples\n\n```rust\nformat!(\"test\"); // => \"test\"\nformat!(\"hello {}\", \"world!\"); // => \"hello world!\"\nformat!(\"x = {}, y = {val}\", 10, val = 30); // => \"x = 10, y = 30\"\nlet (x, y) = (1, 2);\nformat!(\"{x} + {y} = 3\"); // => \"1 + 2 = 3\"\n```"},"filterText":"format!","insertTextFormat":2,"kind":3,"label":"format!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"format!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! log_syntax","documentation":{"kind":"markdown","value":"Prints passed tokens into the standard output."},"filterText":"log_syntax!","insertTextFormat":2,"kind":3,"label":"log_syntax!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"log_syntax!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! stringify","documentation":{"kind":"markdown","value":"Stringifies its arguments.\n\nThis macro will yield an expression of type `&'static str` which is the\nstringification of all the tokens passed to the macro. No restrictions\nare placed on the syntax of the macro invocation itself.\n\nNote that the expanded results of the input tokens may change in the\nfuture. You should be careful if you rely on the output.\n\n# Examples\n\n```rust\nlet one_plus_one = stringify!(1 + 1);\nassert_eq!(one_plus_one, \"1 + 1\");\n```"},"filterText":"stringify!","insertTextFormat":2,"kind":3,"label":"stringify!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"stringify!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\nassert_ne!(a, b);\n\nassert_ne!(a, b, \"we are testing that the values are not equal\");\n```"},"filterText":"assert_ne!","insertTextFormat":2,"kind":3,"label":"assert_ne!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"assert_ne!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! dbg","documentation":{"kind":"markdown","value":"Prints and returns the value of a given expression for quick and dirty\ndebugging.\n\nAn example:\n\n```rust\nlet a = 2;\nlet b = dbg!(a * 2) + 1;\n// ^-- prints: [src/main.rs:2] a * 2 = 4\nassert_eq!(b, 5);\n```\n\nThe macro works by using the `Debug` implementation of the type of\nthe given expression to print the value to [stderr] along with the\nsource location of the macro invocation as well as the source code\nof the expression.\n\nInvoking the macro on an expression moves and takes ownership of it\nbefore returning the evaluated expression unchanged. If the type\nof the expression does not implement `Copy` and you don't want\nto give up ownership, you can instead borrow with `dbg!(&expr)`\nfor some expression `expr`.\n\nThe `dbg!` macro works exactly the same in release builds.\nThis is useful when debugging issues that only occur in release\nbuilds or when debugging in release mode is significantly faster.\n\nNote that the macro is intended as a debugging tool and therefore you\nshould avoid having uses of it in version control for long periods\n(other than in tests and similar).\nDebug output from production code is better done with other facilities\nsuch as the [`debug!`] macro from the [`log`] crate.\n\n# Stability\n\nThe exact output printed by this macro should not be relied upon\nand is subject to future changes.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\n# Further examples\n\nWith a method call:\n\n```rust\nfn foo(n: usize) {\n if let Some(_) = dbg!(n.checked_sub(4)) {\n // ...\n }\n}\n\nfoo(3)\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:4] n.checked_sub(4) = None\n```\n\nNaive factorial implementation:\n\n```rust\nfn factorial(n: u32) -> u32 {\n if dbg!(n <= 1) {\n dbg!(1)\n } else {\n dbg!(n * factorial(n - 1))\n }\n}\n\ndbg!(factorial(4));\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = true\n[src/main.rs:4] 1 = 1\n[src/main.rs:5] n * factorial(n - 1) = 2\n[src/main.rs:5] n * factorial(n - 1) = 6\n[src/main.rs:5] n * factorial(n - 1) = 24\n[src/main.rs:11] factorial(4) = 24\n```\n\nThe `dbg!(..)` macro moves the input:\n\n```rust\n/// A wrapper around `usize` which importantly is not Copyable.\n#[derive(Debug)]\nstruct NoCopy(usize);\n\nlet a = NoCopy(42);\nlet _ = dbg!(a); // <-- `a` is moved here.\nlet _ = dbg!(a); // <-- `a` is moved again; error!\n```\n\nYou can also use `dbg!()` without a value to just print the\nfile and line whenever it's reached.\n\nFinally, if you want to `dbg!(..)` multiple values, it will treat them as\na tuple (and return it, too):\n\n```rust\nassert_eq!(dbg!(1usize, 2u32), (1, 2));\n```\n\nHowever, a single argument with a trailing comma will still not be treated\nas a tuple, following the convention of ignoring trailing commas in macro\ninvocations. You can use a 1-tuple directly if you need one:\n\n```rust\nassert_eq!(1, dbg!(1u32,)); // trailing comma ignored\nassert_eq!((1,), dbg!((1u32,))); // 1-tuple\n```\n\n[stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)\n[`debug!`]: https://docs.rs/log/*/log/macro.debug.html\n[`log`]: https://crates.io/crates/log"},"filterText":"dbg!","insertTextFormat":2,"kind":3,"label":"dbg!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"dbg!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! vec","documentation":{"kind":"markdown","value":"Creates a [`Vec`] containing the arguments.\n\n`vec!` allows `Vec`s to be defined with the same syntax as array expressions.\nThere are two forms of this macro:\n\n- Create a [`Vec`] containing a given list of elements:\n\n```rust\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```\n\n- Create a [`Vec`] from a given element and size:\n\n```rust\nlet v = vec![1; 3];\nassert_eq!(v, [1, 1, 1]);\n```\n\nNote that unlike array expressions this syntax supports all elements\nwhich implement [`Clone`] and the number of elements doesn't have to be\na constant.\n\nThis will use `clone` to duplicate an expression, so one should be careful\nusing this with types having a nonstandard `Clone` implementation. For\nexample, `vec![Rc::new(1); 5]` will create a vector of five references\nto the same boxed integer value, not five references pointing to independently\nboxed integers.\n\nAlso, note that `vec![expr; 0]` is allowed, and produces an empty vector.\nThis will still evaluate `expr`, however, and immediately drop the resulting value, so\nbe mindful of side effects.\n\n[`Vec`]: crate::vec::Vec"},"filterText":"vec!","insertTextFormat":2,"kind":3,"label":"vec![…]","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"vec![$0]","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include","documentation":{"kind":"markdown","value":"Parses a file as an expression or an item according to the context.\n\n**Warning**: For multi-file Rust projects, the `include!` macro is probably not what you\nare looking for. Usually, multi-file Rust projects use\n[modules](https://doc.rust-lang.org/reference/items/modules.html). Multi-file projects and\nmodules are explained in the Rust-by-Example book\n[here](https://doc.rust-lang.org/rust-by-example/mod/split.html) and the module system is\nexplained in the Rust Book\n[here](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html).\n\nThe included file is placed in the surrounding code\n[unhygienically](https://doc.rust-lang.org/reference/macros-by-example.html#hygiene). If\nthe included file is parsed as an expression and variables or functions share names across\nboth files, it could result in variables or functions being different from what the\nincluded file expected.\n\nThe included file is located relative to the current file (similarly to how modules are\nfound). The provided path is interpreted in a platform-specific way at compile time. So,\nfor instance, an invocation with a Windows path containing backslashes `\\` would not\ncompile correctly on Unix.\n\n# Uses\n\nThe `include!` macro is primarily used for two purposes. It is used to include\ndocumentation that is written in a separate file and it is used to include [build artifacts\nusually as a result from the `build.rs`\nscript](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script).\n\nWhen using the `include` macro to include stretches of documentation, remember that the\nincluded file still needs to be a valid rust syntax. It is also possible to\nuse the [`include_str`] macro as `#![doc = include_str!(\"...\")]` (at the module level) or\n`#[doc = include_str!(\"...\")]` (at the item level) to include documentation from a plain\ntext or markdown file.\n\n# Examples\n\nAssume there are two files in the same directory with the following contents:\n\nFile 'monkeys.in':\n\n```rust\n['🙈', '🙊', '🙉']\n .iter()\n .cycle()\n .take(6)\n .collect::()\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_string = include!(\"monkeys.in\");\n assert_eq!(\"🙈🙊🙉🙈🙊🙉\", my_string);\n println!(\"{my_string}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print\n\"🙈🙊🙉🙈🙊🙉\"."},"filterText":"include!","insertTextFormat":2,"kind":3,"label":"include!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"include!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! print","documentation":{"kind":"markdown","value":"Prints to the standard output.\n\nEquivalent to the [`println!`] macro except that a newline is not printed at\nthe end of the message.\n\nNote that stdout is frequently line-buffered by default so it may be\nnecessary to use [`io::stdout().flush()`][flush] to ensure the output is emitted\nimmediately.\n\nThe `print!` macro will lock the standard output on each call. If you call\n`print!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwrite!(lock, \"hello world\").unwrap();\n```\n\nUse `print!` only for the primary output of your program. Use\n[`eprint!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[flush]: crate::io::Write::flush\n[`println!`]: crate::println\n[`eprint!`]: crate::eprint\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to `io::stdout()` fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\nuse std::io::{self, Write};\n\nprint!(\"this \");\nprint!(\"will \");\nprint!(\"be \");\nprint!(\"on \");\nprint!(\"the \");\nprint!(\"same \");\nprint!(\"line \");\n\nio::stdout().flush().unwrap();\n\nprint!(\"this string has a newline, why not choose println! instead?\\n\");\n\nio::stdout().flush().unwrap();\n```"},"filterText":"print!","insertTextFormat":2,"kind":3,"label":"print!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"print!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro cfg_match","documentation":{"kind":"markdown","value":"A macro for defining `#[cfg]` match-like statements.\n\nIt is similar to the `if/elif` C preprocessor macro by allowing definition of a cascade of\n`#[cfg]` cases, emitting the implementation which matches first.\n\nThis allows you to conveniently provide a long list `#[cfg]`'d blocks of code\nwithout having to rewrite each clause multiple times.\n\nTrailing `_` wildcard match arms are **optional** and they indicate a fallback branch when\nall previous declarations do not evaluate to true.\n\n# Example\n\n```rust\n#![feature(cfg_match)]\n\ncfg_match! {\n cfg(unix) => {\n fn foo() { /* unix specific functionality */ }\n }\n cfg(target_pointer_width = \"32\") => {\n fn foo() { /* non-unix, 32-bit functionality */ }\n }\n _ => {\n fn foo() { /* fallback implementation */ }\n }\n}\n```"},"filterText":"cfg_match!","insertTextFormat":2,"kind":3,"label":"cfg_match! {…}","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"cfg_match! {$0}","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat_idents","documentation":{"kind":"markdown","value":"Concatenates identifiers into one identifier.\n\nThis macro takes any number of comma-separated identifiers, and\nconcatenates them all into one, yielding an expression which is a new\nidentifier. Note that hygiene makes it such that this macro cannot\ncapture local variables. Also, as a general rule, macros are only\nallowed in item, statement or expression position. That means while\nyou may use this macro for referring to existing variables, functions or\nmodules etc, you cannot define a new one with it.\n\n# Examples\n\n```rust\n#![feature(concat_idents)]\n\nfn foobar() -> u32 { 23 }\n\nlet f = concat_idents!(foo, bar);\nprintln!(\"{}\", f());\n\n// fn concat_idents!(new, fun, name) { } // not usable in this way!\n```"},"filterText":"concat_idents!","insertTextFormat":2,"kind":3,"label":"concat_idents!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"concat_idents!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! write","documentation":{"kind":"markdown","value":"Writes formatted data into a buffer.\n\nThis macro accepts a 'writer', a format string, and a list of arguments. Arguments will be\nformatted according to the specified format string and the result will be passed to the writer.\nThe writer may be any value with a `write_fmt` method; generally this comes from an\nimplementation of either the [`fmt::Write`] or the [`io::Write`] trait. The macro\nreturns whatever the `write_fmt` method returns; commonly a [`fmt::Result`], or an\n[`io::Result`].\n\nSee [`std::fmt`] for more information on the format string syntax.\n\n[`std::fmt`]: ../std/fmt/index.html\n[`fmt::Write`]: crate::fmt::Write\n[`io::Write`]: ../std/io/trait.Write.html\n[`fmt::Result`]: crate::fmt::Result\n[`io::Result`]: ../std/io/type.Result.html\n\n# Examples\n\n```rust\nuse std::io::Write;\n\nfn main() -> std::io::Result<()> {\n let mut w = Vec::new();\n write!(&mut w, \"test\")?;\n write!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(w, b\"testformatted arguments\");\n Ok(())\n}\n```\n\nA module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects\nimplementing either, as objects do not typically implement both. However, the module must\navoid conflict between the trait names, such as by importing them as `_` or otherwise renaming\nthem:\n\n```rust\nuse std::fmt::Write as _;\nuse std::io::Write as _;\n\nfn main() -> Result<(), Box> {\n let mut s = String::new();\n let mut v = Vec::new();\n\n write!(&mut s, \"{} {}\", \"abc\", 123)?; // uses fmt::Write::write_fmt\n write!(&mut v, \"s = {:?}\", s)?; // uses io::Write::write_fmt\n assert_eq!(v, b\"s = \\\"abc 123\\\"\");\n Ok(())\n}\n```\n\nIf you also need the trait names themselves, such as to implement one or both on your types,\nimport the containing module and then name them with a prefix:\n\n```rust\nuse std::fmt::{self, Write as _};\nuse std::io::{self, Write as _};\n\nstruct Example;\n\nimpl fmt::Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n```\n\nNote: This macro can be used in `no_std` setups as well.\nIn a `no_std` setup you are responsible for the implementation details of the components.\n\n```rust\nuse core::fmt::Write;\n\nstruct Example;\n\nimpl Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n\nlet mut m = Example{};\nwrite!(&mut m, \"Hello World\").expect(\"Not written\");\n```"},"filterText":"write!","insertTextFormat":2,"kind":3,"label":"write!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"write!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! line","documentation":{"kind":"markdown","value":"Expands to the line number on which it was invoked.\n\nWith [`column!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first line\nin each file evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned line is *not necessarily* the line of the `line!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `line!` macro.\n\n# Examples\n\n```rust\nlet current_line = line!();\nprintln!(\"defined on line: {current_line}\");\n```"},"filterText":"line!","insertTextFormat":2,"kind":3,"label":"line!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"line!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\nLike [`assert!`], this macro also has a second version, where a custom panic\nmessage can be provided.\n\n# Uses\n\nUnlike [`assert!`], `debug_assert!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert!` is always type checked.\n\nAn unchecked assertion allows a program in an inconsistent state to keep\nrunning, which might have unexpected consequences but does not introduce\nunsafety as long as this only happens in safe code. The performance cost\nof assertions, however, is not measurable in general. Replacing [`assert!`]\nwith `debug_assert!` is thus only encouraged after thorough profiling, and\nmore importantly, only in safe code!\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\ndebug_assert!(true);\n\nfn some_expensive_computation() -> bool { true } // a very simple function\ndebug_assert!(some_expensive_computation());\n\n// assert with a custom message\nlet x = true;\ndebug_assert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\ndebug_assert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"filterText":"debug_assert!","insertTextFormat":2,"kind":3,"label":"debug_assert!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include_bytes","documentation":{"kind":"markdown","value":"Includes a file as a reference to a byte array.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static [u8; N]` which is\nthe contents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let bytes = include_bytes!(\"spanish.in\");\n assert_eq!(bytes, b\"adi\\xc3\\xb3s\\n\");\n print!(\"{}\", String::from_utf8_lossy(bytes));\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"filterText":"include_bytes!","insertTextFormat":2,"kind":3,"label":"include_bytes!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"include_bytes!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! const_format_args","documentation":{"kind":"markdown","value":"Same as [`format_args`], but can be used in some const contexts.\n\nThis macro is used by the panic macros for the `const_panic` feature.\n\nThis macro will be removed once `format_args` is allowed in const contexts."},"filterText":"const_format_args!","insertTextFormat":2,"kind":3,"label":"const_format_args!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"const_format_args!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! env","documentation":{"kind":"markdown","value":"Inspects an environment variable at compile time.\n\nThis macro will expand to the value of the named environment variable at\ncompile time, yielding an expression of type `&'static str`. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nIf the environment variable is not defined, then a compilation error\nwill be emitted. To not emit a compile error, use the [`option_env!`]\nmacro instead.\n\n# Examples\n\n```rust\nlet path: &'static str = env!(\"PATH\");\nprintln!(\"the $PATH variable at the time of compiling was: {path}\");\n```\n\nYou can customize the error message by passing a string as the second\nparameter:\n\n```rust\nlet doc: &'static str = env!(\"documentation\", \"what's that?!\");\n```\n\nIf the `documentation` environment variable is not defined, you'll get\nthe following error:\n\n```text\nerror: what's that?!\n```"},"filterText":"env!","insertTextFormat":2,"kind":3,"label":"env!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"env!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":true,"detail":"macro_rules! r#try","documentation":{"kind":"markdown","value":"Unwraps a result or propagates its error.\n\nThe [`?` operator][propagating-errors] was added to replace `try!`\nand should be used instead. Furthermore, `try` is a reserved word\nin Rust 2018, so if you must use it, you will need to use the\n[raw-identifier syntax][ris]: `r#try`.\n\n[propagating-errors]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator\n[ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html\n\n`try!` matches the given [`Result`]. In case of the `Ok` variant, the\nexpression has the value of the wrapped value.\n\nIn case of the `Err` variant, it retrieves the inner error. `try!` then\nperforms conversion using `From`. This provides automatic conversion\nbetween specialized errors and more general ones. The resulting\nerror is then immediately returned.\n\nBecause of the early return, `try!` can only be used in functions that\nreturn [`Result`].\n\n# Examples\n\n```rust\nuse std::io;\nuse std::fs::File;\nuse std::io::prelude::*;\n\nenum MyError {\n FileWriteError\n}\n\nimpl From for MyError {\n fn from(e: io::Error) -> MyError {\n MyError::FileWriteError\n }\n}\n\n// The preferred method of quick returning Errors\nfn write_to_file_question() -> Result<(), MyError> {\n let mut file = File::create(\"my_best_friends.txt\")?;\n file.write_all(b\"This is a list of my best friends.\")?;\n Ok(())\n}\n\n// The previous method of quick returning Errors\nfn write_to_file_using_try() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n r#try!(file.write_all(b\"This is a list of my best friends.\"));\n Ok(())\n}\n\n// This is equivalent to:\nfn write_to_file_using_match() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n match file.write_all(b\"This is a list of my best friends.\") {\n Ok(v) => v,\n Err(e) => return Err(From::from(e)),\n }\n Ok(())\n}\n```"},"filterText":"try!","insertTextFormat":2,"kind":3,"label":"try!(…)","sortText":"ffffffef","tags":[1],"textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"r#try!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! file","documentation":{"kind":"markdown","value":"Expands to the file name in which it was invoked.\n\nWith [`line!`] and [`column!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `&'static str`, and the returned file\nis not the invocation of the `file!` macro itself, but rather the\nfirst macro invocation leading up to the invocation of the `file!`\nmacro.\n\n# Examples\n\n```rust\nlet this_file = file!();\nprintln!(\"defined in file: {this_file}\");\n```"},"filterText":"file!","insertTextFormat":2,"kind":3,"label":"file!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"file!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! thread_local","documentation":{"kind":"markdown","value":"Declare a new thread local storage key of type [`std::thread::LocalKey`].\n\n# Syntax\n\nThe macro wraps any number of static declarations and makes them thread local.\nPublicity and attributes for each static are allowed. Example:\n\n```rust\nuse std::cell::RefCell;\nthread_local! {\n pub static FOO: RefCell = RefCell::new(1);\n\n static BAR: RefCell = RefCell::new(1.0);\n}\n\nFOO.with(|foo| assert_eq!(*foo.borrow(), 1));\nBAR.with(|bar| assert_eq!(*bar.borrow(), 1.0));\n```\n\nThis macro supports a special `const {}` syntax that can be used\nwhen the initialization expression can be evaluated as a constant.\nThis can enable a more efficient thread local implementation that\ncan avoid lazy initialization. For types that do not\n[need to be dropped][crate::mem::needs_drop], this can enable an\neven more efficient implementation that does not need to\ntrack any additional state.\n\n```rust\nuse std::cell::Cell;\nthread_local! {\n pub static FOO: Cell = const { Cell::new(1) };\n}\n\nFOO.with(|foo| assert_eq!(foo.get(), 1));\n```\n\nSee [`LocalKey` documentation][`std::thread::LocalKey`] for more\ninformation.\n\n[`std::thread::LocalKey`]: crate::thread::LocalKey"},"filterText":"thread_local!","insertTextFormat":2,"kind":3,"label":"thread_local! {…}","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"thread_local! {$0}","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\n# Uses\n\nAssertions are always checked in both debug and release builds, and cannot\nbe disabled. See [`debug_assert!`] for assertions that are not enabled in\nrelease builds by default.\n\nUnsafe code may rely on `assert!` to enforce run-time invariants that, if\nviolated could lead to unsafety.\n\nOther use-cases of `assert!` include testing and enforcing run-time\ninvariants in safe code (whose violation cannot result in unsafety).\n\n# Custom Messages\n\nThis macro has a second form, where a custom panic message can\nbe provided with or without arguments for formatting. See [`std::fmt`]\nfor syntax for this form. Expressions used as format arguments will only\nbe evaluated if the assertion fails.\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\nassert!(true);\n\nfn some_computation() -> bool { true } // a very simple function\n\nassert!(some_computation());\n\n// assert with a custom message\nlet x = true;\nassert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\nassert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"filterText":"assert!","insertTextFormat":2,"kind":3,"label":"assert!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"assert!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! column","documentation":{"kind":"markdown","value":"Expands to the column number at which it was invoked.\n\nWith [`line!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first column\nin each line evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned column is *not necessarily* the line of the `column!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `column!` macro.\n\n# Examples\n\n```rust\nlet current_col = column!();\nprintln!(\"defined on column: {current_col}\");\n```\n\n`column!` counts Unicode code points, not bytes or graphemes. As a result, the first two\ninvocations return the same value, but the third does not.\n\n```rust\nlet a = (\"foobar\", column!()).1;\nlet b = (\"人之初性本善\", column!()).1;\nlet c = (\"f̅o̅o̅b̅a̅r̅\", column!()).1; // Uses combining overline (U+0305)\n\nassert_eq!(a, b);\nassert_ne!(b, c);\n```"},"filterText":"column!","insertTextFormat":2,"kind":3,"label":"column!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"column!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format_args_nl","documentation":{"kind":"markdown","value":"Same as [`format_args`], but adds a newline in the end."},"filterText":"format_args_nl!","insertTextFormat":2,"kind":3,"label":"format_args_nl!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"format_args_nl!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! unreachable","documentation":{"kind":"markdown","value":"Indicates unreachable code.\n\nThis is useful any time that the compiler can't determine that some code is unreachable. For\nexample:\n\n* Match arms with guard conditions.\n* Loops that dynamically terminate.\n* Iterators that dynamically terminate.\n\nIf the determination that the code is unreachable proves incorrect, the\nprogram immediately terminates with a [`panic!`].\n\nThe unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which\nwill cause undefined behavior if the code is reached.\n\n[`unreachable_unchecked`]: crate::hint::unreachable_unchecked\n\n# Panics\n\nThis will always [`panic!`] because `unreachable!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nMatch arms:\n\n```rust\nfn foo(x: Option) {\n match x {\n Some(n) if n >= 0 => println!(\"Some(Non-negative)\"),\n Some(n) if n < 0 => println!(\"Some(Negative)\"),\n Some(_) => unreachable!(), // compile error if commented out\n None => println!(\"None\")\n }\n}\n```\n\nIterators:\n\n```rust\nfn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3\n for i in 0.. {\n if 3*i < i { panic!(\"u32 overflow\"); }\n if x < 3*i { return i-1; }\n }\n unreachable!(\"The loop should always return\");\n}\n```"},"filterText":"unreachable!","insertTextFormat":2,"kind":3,"label":"unreachable!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"unreachable!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! eprintln","documentation":{"kind":"markdown","value":"Prints to the standard error, with a newline.\n\nEquivalent to the [`println!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`println!`] for\nexample usage.\n\nUse `eprintln!` only for error and progress messages. Use `println!`\ninstead for the primary output of your program.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n[`println!`]: crate::println\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprintln!(\"Error: Could not complete task\");\n```"},"filterText":"eprintln!","insertTextFormat":2,"kind":3,"label":"eprintln!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"eprintln!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! unimplemented","documentation":{"kind":"markdown","value":"Indicates unimplemented code by panicking with a message of \"not implemented\".\n\nThis allows your code to type-check, which is useful if you are prototyping or\nimplementing a trait that requires multiple methods which you don't plan to use all of.\n\nThe difference between `unimplemented!` and [`todo!`] is that while `todo!`\nconveys an intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `unimplemented!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n[`todo!`]: crate::todo\n\n# Examples\n\nSay we have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` for 'MyStruct', but for some reason it only makes sense\nto implement the `bar()` function. `baz()` and `qux()` will still need to be defined\nin our implementation of `Foo`, but we can use `unimplemented!` in their definitions\nto allow our code to compile.\n\nWe still want to have our program stop running if the unimplemented methods are\nreached.\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // It makes no sense to `baz` a `MyStruct`, so we have no logic here\n // at all.\n // This will display \"thread 'main' panicked at 'not implemented'\".\n unimplemented!();\n }\n\n fn qux(&self) -> Result {\n // We have some logic here,\n // We can add a message to unimplemented! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not implemented: MyStruct isn't quxable'\".\n unimplemented!(\"MyStruct isn't quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n}\n```"},"filterText":"unimplemented!","insertTextFormat":2,"kind":3,"label":"unimplemented!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"unimplemented!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! cfg","documentation":{"kind":"markdown","value":"Evaluates boolean combinations of configuration flags at compile-time.\n\nIn addition to the `#[cfg]` attribute, this macro is provided to allow\nboolean expression evaluation of configuration flags. This frequently\nleads to less duplicated code.\n\nThe syntax given to this macro is the same syntax as the [`cfg`]\nattribute.\n\n`cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For\nexample, all blocks in an if/else expression need to be valid when `cfg!` is used for\nthe condition, regardless of what `cfg!` is evaluating.\n\n[`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute\n\n# Examples\n\n```rust\nlet my_directory = if cfg!(windows) {\n \"windows-specific-directory\"\n} else {\n \"unix-directory\"\n};\n```"},"filterText":"cfg!","insertTextFormat":2,"kind":3,"label":"cfg!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"cfg!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! todo","documentation":{"kind":"markdown","value":"Indicates unfinished code.\n\nThis can be useful if you are prototyping and just\nwant a placeholder to let your code pass type analysis.\n\nThe difference between [`unimplemented!`] and `todo!` is that while `todo!` conveys\nan intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `todo!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nHere's an example of some in-progress code. We have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` on one of our types, but we also want to work on\njust `bar()` first. In order for our code to compile, we need to implement\n`baz()` and `qux()`, so we can use `todo!`:\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // Let's not worry about implementing baz() for now\n todo!();\n }\n\n fn qux(&self) -> Result {\n // We can add a message to todo! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not yet implemented: MyStruct is not yet quxable'\".\n todo!(\"MyStruct is not yet quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n\n // We aren't even using baz() or qux(), so this is fine.\n}\n```"},"filterText":"todo!","insertTextFormat":2,"kind":3,"label":"todo!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"todo!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! trace_macros","documentation":{"kind":"markdown","value":"Enables or disables tracing functionality used for debugging other macros."},"filterText":"trace_macros!","insertTextFormat":2,"kind":3,"label":"trace_macros!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"trace_macros!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! module_path","documentation":{"kind":"markdown","value":"Expands to a string that represents the current module path.\n\nThe current module path can be thought of as the hierarchy of modules\nleading back up to the crate root. The first component of the path\nreturned is the name of the crate currently being compiled.\n\n# Examples\n\n```rust\nmod test {\n pub fn foo() {\n assert!(module_path!().ends_with(\"test\"));\n }\n}\n\ntest::foo();\n```"},"filterText":"module_path!","insertTextFormat":2,"kind":3,"label":"module_path!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"module_path!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! option_env","documentation":{"kind":"markdown","value":"Optionally inspects an environment variable at compile time.\n\nIf the named environment variable is present at compile time, this will\nexpand into an expression of type `Option<&'static str>` whose value is\n`Some` of the value of the environment variable. If the environment\nvariable is not present, then this will expand to `None`. See\n[`Option`][Option] for more information on this type. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nA compile time error is never emitted when using this macro regardless\nof whether the environment variable is present or not.\nTo emit a compile error if the environment variable is not present,\nuse the [`env!`] macro instead.\n\n# Examples\n\n```rust\nlet key: Option<&'static str> = option_env!(\"SECRET_KEY\");\nprintln!(\"the secret key might be: {key:?}\");\n```"},"filterText":"option_env!","insertTextFormat":2,"kind":3,"label":"option_env!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"option_env!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! writeln","documentation":{"kind":"markdown","value":"Write formatted data into a buffer, with a newline appended.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`).\n\nFor more information, see [`write!`]. For information on the format string syntax, see\n[`std::fmt`].\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\nuse std::io::{Write, Result};\n\nfn main() -> Result<()> {\n let mut w = Vec::new();\n writeln!(&mut w)?;\n writeln!(&mut w, \"test\")?;\n writeln!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(&w[..], \"\\ntest\\nformatted arguments\\n\".as_bytes());\n Ok(())\n}\n```"},"filterText":"writeln!","insertTextFormat":2,"kind":3,"label":"writeln!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"writeln!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\nassert_eq!(a, b);\n\nassert_eq!(a, b, \"we are testing addition with {} and {}\", a, b);\n```"},"filterText":"assert_eq!","insertTextFormat":2,"kind":3,"label":"assert_eq!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"assert_eq!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! compile_error","documentation":{"kind":"markdown","value":"Causes compilation to fail with the given error message when encountered.\n\nThis macro should be used when a crate uses a conditional compilation strategy to provide\nbetter error messages for erroneous conditions. It's the compiler-level form of [`panic!`],\nbut emits an error during *compilation* rather than at *runtime*.\n\n# Examples\n\nTwo such examples are macros and `#[cfg]` environments.\n\nEmit a better compiler error if a macro is passed invalid values. Without the final branch,\nthe compiler would still emit an error, but the error's message would not mention the two\nvalid values.\n\n```rust\nmacro_rules! give_me_foo_or_bar {\n (foo) => {};\n (bar) => {};\n ($x:ident) => {\n compile_error!(\"This macro only accepts `foo` or `bar`\");\n }\n}\n\ngive_me_foo_or_bar!(neither);\n// ^ will fail at compile time with message \"This macro only accepts `foo` or `bar`\"\n```\n\nEmit a compiler error if one of a number of features isn't available.\n\n```rust\n#[cfg(not(any(feature = \"foo\", feature = \"bar\")))]\ncompile_error!(\"Either feature \\\"foo\\\" or \\\"bar\\\" must be enabled for this crate.\");\n```"},"filterText":"compile_error!","insertTextFormat":2,"kind":3,"label":"compile_error!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"compile_error!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! matches","documentation":{"kind":"markdown","value":"Returns whether the given expression matches any of the given patterns.\n\nLike in a `match` expression, the pattern can be optionally followed by `if`\nand a guard expression that has access to names bound by the pattern.\n\n# Examples\n\n```rust\nlet foo = 'f';\nassert!(matches!(foo, 'A'..='Z' | 'a'..='z'));\n\nlet bar = Some(4);\nassert!(matches!(bar, Some(x) if x > 2));\n```"},"filterText":"matches!","insertTextFormat":2,"kind":3,"label":"matches!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"matches!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format_args","documentation":{"kind":"markdown","value":"Constructs parameters for the other string-formatting macros.\n\nThis macro functions by taking a formatting string literal containing\n`{}` for each additional argument passed. `format_args!` prepares the\nadditional parameters to ensure the output can be interpreted as a string\nand canonicalizes the arguments into a single type. Any value that implements\nthe [`Display`] trait can be passed to `format_args!`, as can any\n[`Debug`] implementation be passed to a `{:?}` within the formatting string.\n\nThis macro produces a value of type [`fmt::Arguments`]. This value can be\npassed to the macros within [`std::fmt`] for performing useful redirection.\nAll other formatting macros ([`format!`], [`write!`], [`println!`], etc) are\nproxied through this one. `format_args!`, unlike its derived macros, avoids\nheap allocations.\n\nYou can use the [`fmt::Arguments`] value that `format_args!` returns\nin `Debug` and `Display` contexts as seen below. The example also shows\nthat `Debug` and `Display` format to the same thing: the interpolated\nformat string in `format_args!`.\n\n```rust\nlet debug = format!(\"{:?}\", format_args!(\"{} foo {:?}\", 1, 2));\nlet display = format!(\"{}\", format_args!(\"{} foo {:?}\", 1, 2));\nassert_eq!(\"1 foo 2\", display);\nassert_eq!(display, debug);\n```\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax, and further information.\n\n[`Display`]: crate::fmt::Display\n[`Debug`]: crate::fmt::Debug\n[`fmt::Arguments`]: crate::fmt::Arguments\n[`std::fmt`]: ../std/fmt/index.html\n[`format!`]: ../std/macro.format.html\n[`println!`]: ../std/macro.println.html\n\n# Examples\n\n```rust\nuse std::fmt;\n\nlet s = fmt::format(format_args!(\"hello {}\", \"world\"));\nassert_eq!(s, format!(\"hello {}\", \"world\"));\n```"},"filterText":"format_args!","insertTextFormat":2,"kind":3,"label":"format_args!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"format_args!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! is_x86_feature_detected","documentation":{"kind":"markdown","value":"A macro to test at *runtime* whether a CPU feature is available on\nx86/x86-64 platforms.\n\nThis macro is provided in the standard library and will detect at runtime\nwhether the specified CPU feature is detected. This does **not** resolve at\ncompile time unless the specified feature is already enabled for the entire\ncrate. Runtime detection currently relies mostly on the `cpuid` instruction.\n\nThis macro only takes one argument which is a string literal of the feature\nbeing tested for. The feature names supported are the lowercase versions of\nthe ones defined by Intel in [their documentation][docs].\n\n## Supported arguments\n\nThis macro supports the same names that `#[target_feature]` supports. Unlike\n`#[target_feature]`, however, this macro does not support names separated\nwith a comma. Instead testing for multiple features must be done through\nseparate macro invocations for now.\n\nSupported arguments are:\n\n* `\"aes\"`\n* `\"pclmulqdq\"`\n* `\"rdrand\"`\n* `\"rdseed\"`\n* `\"tsc\"`\n* `\"mmx\"`\n* `\"sse\"`\n* `\"sse2\"`\n* `\"sse3\"`\n* `\"ssse3\"`\n* `\"sse4.1\"`\n* `\"sse4.2\"`\n* `\"sse4a\"`\n* `\"sha\"`\n* `\"avx\"`\n* `\"avx2\"`\n* `\"avx512f\"`\n* `\"avx512cd\"`\n* `\"avx512er\"`\n* `\"avx512pf\"`\n* `\"avx512bw\"`\n* `\"avx512dq\"`\n* `\"avx512vl\"`\n* `\"avx512ifma\"`\n* `\"avx512vbmi\"`\n* `\"avx512vpopcntdq\"`\n* `\"avx512vbmi2\"`\n* `\"gfni\"`\n* `\"vaes\"`\n* `\"vpclmulqdq\"`\n* `\"avx512vnni\"`\n* `\"avx512bitalg\"`\n* `\"avx512bf16\"`\n* `\"avx512vp2intersect\"`\n* `\"f16c\"`\n* `\"fma\"`\n* `\"bmi1\"`\n* `\"bmi2\"`\n* `\"abm\"`\n* `\"lzcnt\"`\n* `\"tbm\"`\n* `\"popcnt\"`\n* `\"fxsr\"`\n* `\"xsave\"`\n* `\"xsaveopt\"`\n* `\"xsaves\"`\n* `\"xsavec\"`\n* `\"cmpxchg16b\"`\n* `\"adx\"`\n* `\"rtm\"`\n* `\"movbe\"`\n* `\"ermsb\"`\n\n[docs]: https://software.intel.com/sites/landingpage/IntrinsicsGuide"},"filterText":"is_x86_feature_detected!","insertTextFormat":2,"kind":3,"label":"is_x86_feature_detected!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"is_x86_feature_detected!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat_bytes","documentation":{"kind":"markdown","value":"Concatenates literals into a byte slice.\n\nThis macro takes any number of comma-separated literals, and concatenates them all into\none, yielding an expression of type `&[u8; _]`, which represents all of the literals\nconcatenated left-to-right. The literals passed can be any combination of:\n\n- byte literals (`b'r'`)\n- byte strings (`b\"Rust\"`)\n- arrays of bytes/numbers (`[b'A', 66, b'C']`)\n\n# Examples\n\n```rust\n#![feature(concat_bytes)]\n\nlet s: &[u8; 6] = concat_bytes!(b'A', b\"BC\", [68, b'E', 70]);\nassert_eq!(s, b\"ABCDEF\");\n```"},"filterText":"concat_bytes!","insertTextFormat":2,"kind":3,"label":"concat_bytes!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"concat_bytes!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! eprint","documentation":{"kind":"markdown","value":"Prints to the standard error.\n\nEquivalent to the [`print!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`print!`] for\nexample usage.\n\nUse `eprint!` only for error and progress messages. Use `print!`\ninstead for the primary output of your program.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprint!(\"Error: Could not complete task\");\n```"},"filterText":"eprint!","insertTextFormat":2,"kind":3,"label":"eprint!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"eprint!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_ne!`], `debug_assert_ne!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_ne!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_ne!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_ne!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\ndebug_assert_ne!(a, b);\n```"},"filterText":"debug_assert_ne!","insertTextFormat":2,"kind":3,"label":"debug_assert_ne!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert_ne!($0)","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust Standard Library\n\nThe Rust Standard Library is the foundation of portable Rust software, a\nset of minimal and battle-tested shared abstractions for the [broader Rust\necosystem][crates.io]. It offers core types, like [`Vec`] and\n[`Option`], library-defined [operations on language\nprimitives](#primitives), [standard macros](#macros), [I/O] and\n[multithreading], among [many other things][other].\n\n`std` is available to all Rust crates by default. Therefore, the\nstandard library can be accessed in [`use`] statements through the path\n`std`, as in [`use std::env`].\n\n# How to read this documentation\n\nIf you already know the name of what you are looking for, the fastest way to\nfind it is to use the search\nbar at the top of the page.\n\nOtherwise, you may want to jump to one of these useful sections:\n\n* [`std::*` modules](#modules)\n* [Primitive types](#primitives)\n* [Standard macros](#macros)\n* [The Rust Prelude]\n\nIf this is your first time, the documentation for the standard library is\nwritten to be casually perused. Clicking on interesting things should\ngenerally lead you to interesting places. Still, there are important bits\nyou don't want to miss, so read on for a tour of the standard library and\nits documentation!\n\nOnce you are familiar with the contents of the standard library you may\nbegin to find the verbosity of the prose distracting. At this stage in your\ndevelopment you may want to press the `[-]` button near the top of the\npage to collapse it into a more skimmable view.\n\nWhile you are looking at that `[-]` button also notice the `source`\nlink. Rust's API documentation comes with the source code and you are\nencouraged to read it. The standard library source is generally high\nquality and a peek behind the curtains is often enlightening.\n\n# What is in the standard library documentation?\n\nFirst of all, The Rust Standard Library is divided into a number of focused\nmodules, [all listed further down this page](#modules). These modules are\nthe bedrock upon which all of Rust is forged, and they have mighty names\nlike [`std::slice`] and [`std::cmp`]. Modules' documentation typically\nincludes an overview of the module along with examples, and are a smart\nplace to start familiarizing yourself with the library.\n\nSecond, implicit methods on [primitive types] are documented here. This can\nbe a source of confusion for two reasons:\n\n1. While primitives are implemented by the compiler, the standard library\n implements methods directly on the primitive types (and it is the only\n library that does so), which are [documented in the section on\n primitives](#primitives).\n2. The standard library exports many modules *with the same name as\n primitive types*. These define additional items related to the primitive\n type, but not the all-important methods.\n\nSo for example there is a [page for the primitive type\n`i32`](primitive::i32) that lists all the methods that can be called on\n32-bit integers (very useful), and there is a [page for the module\n`std::i32`] that documents the constant values [`MIN`] and [`MAX`] (rarely\nuseful).\n\nNote the documentation for the primitives [`str`] and [`[T]`][prim@slice] (also\ncalled 'slice'). Many method calls on [`String`] and [`Vec`] are actually\ncalls to methods on [`str`] and [`[T]`][prim@slice] respectively, via [deref\ncoercions][deref-coercions].\n\nThird, the standard library defines [The Rust Prelude], a small collection\nof items - mostly traits - that are imported into every module of every\ncrate. The traits in the prelude are pervasive, making the prelude\ndocumentation a good entry point to learning about the library.\n\nAnd finally, the standard library exports a number of standard macros, and\n[lists them on this page](#macros) (technically, not all of the standard\nmacros are defined by the standard library - some are defined by the\ncompiler - but they are documented here the same). Like the prelude, the\nstandard macros are imported by default into all crates.\n\n# Contributing changes to the documentation\n\nCheck out the rust contribution guidelines [here](\nhttps://rustc-dev-guide.rust-lang.org/contributing.html#writing-documentation).\nThe source for this documentation can be found on\n[GitHub](https://github.com/rust-lang/rust).\nTo contribute changes, make sure you read the guidelines first, then submit\npull-requests for your suggested changes.\n\nContributions are appreciated! If you see a part of the docs that can be\nimproved, submit a PR, or chat with us first on [Discord][rust-discord]\n#docs.\n\n# A Tour of The Rust Standard Library\n\nThe rest of this crate documentation is dedicated to pointing out notable\nfeatures of The Rust Standard Library.\n\n## Containers and collections\n\nThe [`option`] and [`result`] modules define optional and error-handling\ntypes, [`Option`] and [`Result`]. The [`iter`] module defines\nRust's iterator trait, [`Iterator`], which works with the [`for`] loop to\naccess collections.\n\nThe standard library exposes three common ways to deal with contiguous\nregions of memory:\n\n* [`Vec`] - A heap-allocated *vector* that is resizable at runtime.\n* [`[T; N]`][prim@array] - An inline *array* with a fixed size at compile time.\n* [`[T]`][prim@slice] - A dynamically sized *slice* into any other kind of contiguous\n storage, whether heap-allocated or not.\n\nSlices can only be handled through some kind of *pointer*, and as such come\nin many flavors such as:\n\n* `&[T]` - *shared slice*\n* `&mut [T]` - *mutable slice*\n* [`Box<[T]>`][owned slice] - *owned slice*\n\n[`str`], a UTF-8 string slice, is a primitive type, and the standard library\ndefines many methods for it. Rust [`str`]s are typically accessed as\nimmutable references: `&str`. Use the owned [`String`] for building and\nmutating strings.\n\nFor converting to strings use the [`format!`] macro, and for converting from\nstrings use the [`FromStr`] trait.\n\nData may be shared by placing it in a reference-counted box or the [`Rc`]\ntype, and if further contained in a [`Cell`] or [`RefCell`], may be mutated\nas well as shared. Likewise, in a concurrent setting it is common to pair an\natomically-reference-counted box, [`Arc`], with a [`Mutex`] to get the same\neffect.\n\nThe [`collections`] module defines maps, sets, linked lists and other\ntypical collection types, including the common [`HashMap`].\n\n## Platform abstractions and I/O\n\nBesides basic data types, the standard library is largely concerned with\nabstracting over differences in common platforms, most notably Windows and\nUnix derivatives.\n\nCommon types of I/O, including [files], [TCP], and [UDP], are defined in\nthe [`io`], [`fs`], and [`net`] modules.\n\nThe [`thread`] module contains Rust's threading abstractions. [`sync`]\ncontains further primitive shared memory types, including [`atomic`] and\n[`mpsc`], which contains the channel types for message passing.\n\n# Use before and after `main()`\n\nMany parts of the standard library are expected to work before and after `main()`;\nbut this is not guaranteed or ensured by tests. It is recommended that you write your own tests\nand run them on each platform you wish to support.\nThis means that use of `std` before/after main, especially of features that interact with the\nOS or global state, is exempted from stability and portability guarantees and instead only\nprovided on a best-effort basis. Nevertheless bug reports are appreciated.\n\nOn the other hand `core` and `alloc` are most likely to work in such environments with\nthe caveat that any hookable behavior such as panics, oom handling or allocators will also\ndepend on the compatibility of the hooks.\n\nSome features may also behave differently outside main, e.g. stdio could become unbuffered,\nsome panics might turn into aborts, backtraces might not get symbolicated or similar.\n\nNon-exhaustive list of known limitations:\n\n- after-main use of thread-locals, which also affects additional features:\n - [`thread::current()`]\n - [`thread::scope()`]\n - [`sync::mpsc`]\n- before-main stdio file descriptors are not guaranteed to be open on unix platforms\n\n\n[I/O]: io\n[`MIN`]: i32::MIN\n[`MAX`]: i32::MAX\n[page for the module `std::i32`]: crate::i32\n[TCP]: net::TcpStream\n[The Rust Prelude]: prelude\n[UDP]: net::UdpSocket\n[`Arc`]: sync::Arc\n[owned slice]: boxed\n[`Cell`]: cell::Cell\n[`FromStr`]: str::FromStr\n[`HashMap`]: collections::HashMap\n[`Mutex`]: sync::Mutex\n[`Option`]: option::Option\n[`Rc`]: rc::Rc\n[`RefCell`]: cell::RefCell\n[`Result`]: result::Result\n[`Vec`]: vec::Vec\n[`atomic`]: sync::atomic\n[`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for\n[`str`]: prim@str\n[`mpsc`]: sync::mpsc\n[`std::cmp`]: cmp\n[`std::slice`]: mod@slice\n[`use std::env`]: env/index.html\n[`use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html\n[crates.io]: https://crates.io\n[deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods\n[files]: fs::File\n[multithreading]: thread\n[other]: #what-is-in-the-standard-library-documentation\n[primitive types]: ../book/ch03-02-data-types.html\n[rust-discord]: https://discord.gg/rust-lang\n[array]: prim@array\n[slice]: prim@slice"},"filterText":"std","kind":9,"label":"std","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"std","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust core allocation and collections library\n\nThis library provides smart pointers and collections for managing\nheap-allocated values.\n\nThis library, like core, normally doesn’t need to be used directly\nsince its contents are re-exported in the [`std` crate](../std/index.html).\nCrates that use the `#![no_std]` attribute however will typically\nnot depend on `std`, so they’d use this crate instead.\n\n## Boxed values\n\nThe [`Box`] type is a smart pointer type. There can only be one owner of a\n[`Box`], and the owner can decide to mutate the contents, which live on the\nheap.\n\nThis type can be sent among threads efficiently as the size of a `Box` value\nis the same as that of a pointer. Tree-like data structures are often built\nwith boxes because each node often has only one owner, the parent.\n\n## Reference counted pointers\n\nThe [`Rc`] type is a non-threadsafe reference-counted pointer type intended\nfor sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and\nonly allows access to `&T`, a shared reference.\n\nThis type is useful when inherited mutability (such as using [`Box`]) is too\nconstraining for an application, and is often paired with the [`Cell`] or\n[`RefCell`] types in order to allow mutation.\n\n## Atomically reference counted pointers\n\nThe [`Arc`] type is the threadsafe equivalent of the [`Rc`] type. It\nprovides all the same functionality of [`Rc`], except it requires that the\ncontained type `T` is shareable. Additionally, [`Arc`][`Arc`] is itself\nsendable while [`Rc`][`Rc`] is not.\n\nThis type allows for shared access to the contained data, and is often\npaired with synchronization primitives such as mutexes to allow mutation of\nshared resources.\n\n## Collections\n\nImplementations of the most common general purpose data structures are\ndefined in this library. They are re-exported through the\n[standard collections library](../std/collections/index.html).\n\n## Heap interfaces\n\nThe [`alloc`](alloc/index.html) module defines the low-level interface to the\ndefault global allocator. It is not compatible with the libc allocator API.\n\n[`Arc`]: sync\n[`Box`]: boxed\n[`Cell`]: core::cell\n[`Rc`]: rc\n[`RefCell`]: core::cell"},"filterText":"alloc","kind":9,"label":"alloc","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"alloc","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust Core Library\n\nThe Rust Core Library is the dependency-free[^free] foundation of [The\nRust Standard Library](../std/index.html). It is the portable glue\nbetween the language and its libraries, defining the intrinsic and\nprimitive building blocks of all Rust code. It links to no\nupstream libraries, no system libraries, and no libc.\n\n[^free]: Strictly speaking, there are some symbols which are needed but\n they aren't always necessary.\n\nThe core library is *minimal*: it isn't even aware of heap allocation,\nnor does it provide concurrency or I/O. These things require\nplatform integration, and this library is platform-agnostic.\n\n# How to use the core library\n\nPlease note that all of these details are currently not considered stable.\n\nThis library is built on the assumption of a few existing symbols:\n\n* `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines\n which are generated by Rust codegen backends. Additionally, this library can make explicit\n calls to `strlen`. Their signatures are the same as found in C, but there are extra\n assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if\n the `n` parameter is 0, the function is assumed to not be UB, even if the pointers are NULL or\n dangling. (Note that making extra assumptions about these functions is common among compilers:\n [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)\n These functions are often provided by the system libc, but can also be provided by the\n [compiler-builtins crate](https://crates.io/crates/compiler_builtins).\n Note that the library does not guarantee that it will always make these assumptions, so Rust\n user code directly calling the C functions should follow the C specification! The advice for\n Rust user code is to call the functions provided by this library instead (such as\n `ptr::copy`).\n\n* `rust_begin_panic` - This function takes four arguments, a\n `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments\n dictate the panic message, the file at which panic was invoked, and the\n line and column inside the file. It is up to consumers of this core\n library to define this panic function; it is only required to never\n return. This requires a `lang` attribute named `panic_impl`.\n\n* `rust_eh_personality` - is used by the failure mechanisms of the\n compiler. This is often mapped to GCC's personality function, but crates\n which do not trigger a panic can be assured that this function is never\n called. The `lang` attribute is called `eh_personality`."},"filterText":"core","kind":9,"label":"core","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"core","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u32","kind":22,"label":"u32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"u32","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"bool","kind":22,"label":"bool","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"bool","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u8","kind":22,"label":"u8","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"u8","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"isize","kind":22,"label":"isize","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"isize","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u16","kind":22,"label":"u16","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"u16","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u64","kind":22,"label":"u64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"u64","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u128","kind":22,"label":"u128","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"u128","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"f32","kind":22,"label":"f32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"f32","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i128","kind":22,"label":"i128","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"i128","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i16","kind":22,"label":"i16","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"i16","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"str","kind":22,"label":"str","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"str","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i64","kind":22,"label":"i64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"i64","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"char","kind":22,"label":"char","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"char","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"f64","kind":22,"label":"f64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"f64","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i32","kind":22,"label":"i32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"i32","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i8","kind":22,"label":"i8","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"i8","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"usize","kind":22,"label":"usize","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"usize","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do a cheap mutable-to-mutable reference conversion.\n\nThis trait is similar to [`AsRef`] but used for converting between mutable\nreferences. If you need to do a costly conversion it is better to\nimplement [`From`] with type `&mut T` or write a custom function.\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsMut` auto-dereferences if the inner type is a mutable reference\n(e.g.: `foo.as_mut()` will work the same if `foo` has type `&mut Foo` or `&mut &mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[mutably dereferenceable types], e.g. `foo.as_mut()` will *not* work the same as\n`Box::new(foo).as_mut()`. Instead, many smart pointers provide an `as_mut` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsMut::as_mut`] should not be\nused for the sole purpose of mutable dereferencing; instead ['`Deref` coercion'] can be used:\n\n[mutably dereferenceable types]: core::ops::DerefMut\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::DerefMut#mutable-deref-coercion\n\n```rust\nlet mut x = Box::new(5i32);\n// Avoid this:\n// let y: &mut i32 = x.as_mut();\n// Better just write:\nlet y: &mut i32 = &mut x;\n```\n\nTypes which implement [`DerefMut`] should consider to add an implementation of `AsMut` as\nfollows:\n\n[`DerefMut`]: core::ops::DerefMut\n\n```rust\nimpl AsMut for SomeType\nwhere\n ::Target: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.deref_mut().as_mut()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsMut` would be reflexive, i.e. there would be an `impl AsMut for T`\nwith [`as_mut`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&mut T where T: AsMut` which allows `AsMut` to auto-dereference, see \"Generic\nImplementations\" above).\n\n[`as_mut`]: AsMut::as_mut\n\nA trivial implementation of `AsMut for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nUsing `AsMut` as trait bound for a generic function, we can accept all mutable references that\ncan be converted to type `&mut T`. Unlike [dereference], which has a single [target type],\nthere can be multiple implementations of `AsMut` for a type. In particular, `Vec` implements\nboth `AsMut>` and `AsMut<[T]>`.\n\nIn the following, the example functions `caesar` and `null_terminate` provide a generic\ninterface which work with any type that can be converted by cheap mutable-to-mutable conversion\ninto a byte slice (`[u8]`) or byte vector (`Vec`), respectively.\n\n[dereference]: core::ops::DerefMut\n[target type]: core::ops::Deref::Target\n\n```rust\nstruct Document {\n info: String,\n content: Vec,\n}\n\nimpl AsMut for Document\nwhere\n Vec: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.content.as_mut()\n }\n}\n\nfn caesar>(data: &mut T, key: u8) {\n for byte in data.as_mut() {\n *byte = byte.wrapping_add(key);\n }\n}\n\nfn null_terminate>>(data: &mut T) {\n // Using a non-generic inner function, which contains most of the\n // functionality, helps to minimize monomorphization overhead.\n fn doit(data: &mut Vec) {\n let len = data.len();\n if len == 0 || data[len-1] != 0 {\n data.push(0);\n }\n }\n doit(data.as_mut());\n}\n\nfn main() {\n let mut v: Vec = vec![1, 2, 3];\n caesar(&mut v, 5);\n assert_eq!(v, [6, 7, 8]);\n null_terminate(&mut v);\n assert_eq!(v, [6, 7, 8, 0]);\n let mut doc = Document {\n info: String::from(\"Example\"),\n content: vec![17, 19, 8],\n };\n caesar(&mut doc, 1);\n assert_eq!(doc.content, [18, 20, 9]);\n null_terminate(&mut doc);\n assert_eq!(doc.content, [18, 20, 9, 0]);\n}\n```\n\nNote, however, that APIs don't need to be generic. In many cases taking a `&mut [u8]` or\n`&mut Vec`, for example, is the better choice (callers need to pass the correct type then)."},"filterText":"AsMut","kind":8,"label":"AsMut","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"AsMut","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do a cheap reference-to-reference conversion.\n\nThis trait is similar to [`AsMut`] which is used for converting between mutable references.\nIf you need to do a costly conversion it is better to implement [`From`] with type\n`&T` or write a custom function.\n\n# Relation to `Borrow`\n\n`AsRef` has the same signature as [`Borrow`], but [`Borrow`] is different in a few aspects:\n\n- Unlike `AsRef`, [`Borrow`] has a blanket impl for any `T`, and can be used to accept either\n a reference or a value. (See also note on `AsRef`'s reflexibility below.)\n- [`Borrow`] also requires that [`Hash`], [`Eq`] and [`Ord`] for a borrowed value are\n equivalent to those of the owned value. For this reason, if you want to\n borrow only a single field of a struct you can implement `AsRef`, but not [`Borrow`].\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsRef` auto-dereferences if the inner type is a reference or a mutable reference\n(e.g.: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[dereferenceable types], e.g. `foo.as_ref()` will *not* work the same as\n`Box::new(foo).as_ref()`. Instead, many smart pointers provide an `as_ref` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsRef::as_ref`] should not be\nused for the sole purpose of dereferencing; instead ['`Deref` coercion'] can be used:\n\n[dereferenceable types]: core::ops::Deref\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::Deref#deref-coercion\n\n```rust\nlet x = Box::new(5i32);\n// Avoid this:\n// let y: &i32 = x.as_ref();\n// Better just write:\nlet y: &i32 = &x;\n```\n\nTypes which implement [`Deref`] should consider implementing `AsRef` as follows:\n\n[`Deref`]: core::ops::Deref\n\n```rust\nimpl AsRef for SomeType\nwhere\n T: ?Sized,\n ::Target: AsRef,\n{\n fn as_ref(&self) -> &T {\n self.deref().as_ref()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsRef` would be reflexive, i.e. there would be an `impl AsRef for T`\nwith [`as_ref`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&T where T: AsRef` which allows `AsRef` to auto-dereference, see \"Generic Implementations\"\nabove).\n\n[`as_ref`]: AsRef::as_ref\n\nA trivial implementation of `AsRef for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nBy using trait bounds we can accept arguments of different types as long as they can be\nconverted to the specified type `T`.\n\nFor example: By creating a generic function that takes an `AsRef` we express that we\nwant to accept all references that can be converted to [`&str`] as an argument.\nSince both [`String`] and [`&str`] implement `AsRef` we can accept both as input argument.\n\n[`&str`]: primitive@str\n[`Borrow`]: crate::borrow::Borrow\n[`Eq`]: crate::cmp::Eq\n[`Ord`]: crate::cmp::Ord\n[`String`]: ../../std/string/struct.String.html\n\n```rust\nfn is_hello>(s: T) {\n assert_eq!(\"hello\", s.as_ref());\n}\n\nlet s = \"hello\";\nis_hello(s);\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```"},"filterText":"AsRef","kind":8,"label":"AsRef","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"AsRef","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A pointer type that uniquely owns a heap allocation of type `T`.\n\nSee the [module-level documentation](../../std/boxed/index.html) for more."},"filterText":"Box","kind":22,"label":"Box","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Box","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A common trait for the ability to explicitly duplicate an object.\n\nDiffers from [`Copy`] in that [`Copy`] is implicit and an inexpensive bit-wise copy, while\n`Clone` is always explicit and may or may not be expensive. In order to enforce\nthese characteristics, Rust does not allow you to reimplement [`Copy`], but you\nmay reimplement `Clone` and run arbitrary code.\n\nSince `Clone` is more general than [`Copy`], you can automatically make anything\n[`Copy`] be `Clone` as well.\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d\nimplementation of [`Clone`] calls [`clone`] on each field.\n\n[`clone`]: Clone::clone\n\nFor a generic struct, `#[derive]` implements `Clone` conditionally by adding bound `Clone` on\ngeneric parameters.\n\n```rust\n// `derive` implements Clone for Reading when T is Clone.\n#[derive(Clone)]\nstruct Reading {\n frequency: T,\n}\n```\n\n## How can I implement `Clone`?\n\nTypes that are [`Copy`] should have a trivial implementation of `Clone`. More formally:\nif `T: Copy`, `x: T`, and `y: &T`, then `let x = y.clone();` is equivalent to `let x = *y;`.\nManual implementations should be careful to uphold this invariant; however, unsafe code\nmust not rely on it to ensure memory safety.\n\nAn example is a generic struct holding a function pointer. In this case, the\nimplementation of `Clone` cannot be `derive`d, but can be implemented as:\n\n```rust\nstruct Generate(fn() -> T);\n\nimpl Copy for Generate {}\n\nimpl Clone for Generate {\n fn clone(&self) -> Self {\n *self\n }\n}\n```\n\nIf we `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n```\n\nthe auto-derived implementations will have unnecessary `T: Copy` and `T: Clone` bounds:\n\n```rust\n\n// Automatically derived\nimpl Copy for Generate { }\n\n// Automatically derived\nimpl Clone for Generate {\n fn clone(&self) -> Generate {\n Generate(Clone::clone(&self.0))\n }\n}\n```\n\nThe bounds are unnecessary because clearly the function itself should be\ncopy- and cloneable even if its return type is not:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n\nstruct NotCloneable;\n\nfn generate_not_cloneable() -> NotCloneable {\n NotCloneable\n}\n\nGenerate(generate_not_cloneable).clone(); // error: trait bounds were not satisfied\n// Note: With the manual implementations the above line will compile.\n```\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Clone`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Clone` themselves.\n Note that variables captured by shared reference always implement `Clone`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Clone`.\n\n[impls]: #implementors"},"filterText":"Clone","kind":8,"label":"Clone","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Clone","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Types whose values can be duplicated simply by copying bits.\n\nBy default, variable bindings have 'move semantics.' In other\nwords:\n\n```rust\n#[derive(Debug)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `x` has moved into `y`, and so cannot be used\n\n// println!(\"{x:?}\"); // error: use of moved value\n```\n\nHowever, if a type implements `Copy`, it instead has 'copy semantics':\n\n```rust\n// We can derive a `Copy` implementation. `Clone` is also required, as it's\n// a supertrait of `Copy`.\n#[derive(Debug, Copy, Clone)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `y` is a copy of `x`\n\nprintln!(\"{x:?}\"); // A-OK!\n```\n\nIt's important to note that in these two examples, the only difference is whether you\nare allowed to access `x` after the assignment. Under the hood, both a copy and a move\ncan result in bits being copied in memory, although this is sometimes optimized away.\n\n## How can I implement `Copy`?\n\nThere are two ways to implement `Copy` on your type. The simplest is to use `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct MyStruct;\n```\n\nYou can also implement `Copy` and `Clone` manually:\n\n```rust\nstruct MyStruct;\n\nimpl Copy for MyStruct { }\n\nimpl Clone for MyStruct {\n fn clone(&self) -> MyStruct {\n *self\n }\n}\n```\n\nThere is a small difference between the two: the `derive` strategy will also place a `Copy`\nbound on type parameters, which isn't always desired.\n\n## What's the difference between `Copy` and `Clone`?\n\nCopies happen implicitly, for example as part of an assignment `y = x`. The behavior of\n`Copy` is not overloadable; it is always a simple bit-wise copy.\n\nCloning is an explicit action, `x.clone()`. The implementation of [`Clone`] can\nprovide any type-specific behavior necessary to duplicate values safely. For example,\nthe implementation of [`Clone`] for [`String`] needs to copy the pointed-to string\nbuffer in the heap. A simple bitwise copy of [`String`] values would merely copy the\npointer, leading to a double free down the line. For this reason, [`String`] is [`Clone`]\nbut not `Copy`.\n\n[`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement\n[`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`\n(see the example above).\n\n## When can my type be `Copy`?\n\nA type can implement `Copy` if all of its components implement `Copy`. For example, this\nstruct can be `Copy`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Point {\n x: i32,\n y: i32,\n}\n```\n\nA struct can be `Copy`, and [`i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.\nBy contrast, consider\n\n```rust\nstruct PointList {\n points: Vec,\n}\n```\n\nThe struct `PointList` cannot implement `Copy`, because [`Vec`] is not `Copy`. If we\nattempt to derive a `Copy` implementation, we'll get an error:\n\n```text\nthe trait `Copy` cannot be implemented for this type; field `points` does not implement `Copy`\n```\n\nShared references (`&T`) are also `Copy`, so a type can be `Copy`, even when it holds\nshared references of types `T` that are *not* `Copy`. Consider the following struct,\nwhich can implement `Copy`, because it only holds a *shared reference* to our non-`Copy`\ntype `PointList` from above:\n\n```rust\n#[derive(Copy, Clone)]\nstruct PointListWrapper<'a> {\n point_list_ref: &'a PointList,\n}\n```\n\n## When *can't* my type be `Copy`?\n\nSome types can't be copied safely. For example, copying `&mut T` would create an aliased\nmutable reference. Copying [`String`] would duplicate responsibility for managing the\n[`String`]'s buffer, leading to a double free.\n\nGeneralizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's\nmanaging some resource besides its own [`size_of::`] bytes.\n\nIf you try to implement `Copy` on a struct or enum containing non-`Copy` data, you will get\nthe error [E0204].\n\n[E0204]: ../../error_codes/E0204.html\n\n## When *should* my type be `Copy`?\n\nGenerally speaking, if your type _can_ implement `Copy`, it should. Keep in mind, though,\nthat implementing `Copy` is part of the public API of your type. If the type might become\nnon-`Copy` in the future, it could be prudent to omit the `Copy` implementation now, to\navoid a breaking API change.\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Copy`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Copy` themselves.\n Note that variables captured by shared reference always implement `Copy`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Copy`.\n\n[`Vec`]: ../../std/vec/struct.Vec.html\n[`String`]: ../../std/string/struct.String.html\n[`size_of::`]: crate::mem::size_of\n[impls]: #implementors"},"filterText":"Copy","kind":8,"label":"Copy","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Copy","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for giving a type a useful default value.\n\nSometimes, you want to fall back to some kind of default value, and\ndon't particularly care what it is. This comes up often with `struct`s\nthat define a set of options:\n\n```rust\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```\n\nHow can we define some default values? You can use `Default`:\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n\nfn main() {\n let options: SomeOptions = Default::default();\n}\n```\n\nNow, you get all of the default values. Rust implements `Default` for various primitives types.\n\nIf you want to override a particular option, but still retain the other defaults:\n\n```rust\nfn main() {\n let options = SomeOptions { foo: 42, ..Default::default() };\n}\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all of the type's fields implement\n`Default`. When `derive`d, it will use the default value for each field's type.\n\n### `enum`s\n\nWhen using `#[derive(Default)]` on an `enum`, you need to choose which unit variant will be\ndefault. You do this by placing the `#[default]` attribute on the variant.\n\n```rust\n#[derive(Default)]\nenum Kind {\n #[default]\n A,\n B,\n C,\n}\n```\n\nYou cannot use the `#[default]` attribute on non-unit or non-exhaustive variants.\n\n## How can I implement `Default`?\n\nProvide an implementation for the `default()` method that returns the value of\nyour type that should be the default:\n\n```rust\nenum Kind {\n A,\n B,\n C,\n}\n\nimpl Default for Kind {\n fn default() -> Self { Kind::A }\n}\n```\n\n# Examples\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```"},"filterText":"Default","kind":8,"label":"Default","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Default","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An iterator able to yield elements from both ends.\n\nSomething that implements `DoubleEndedIterator` has one extra capability\nover something that implements [`Iterator`]: the ability to also take\n`Item`s from the back, as well as the front.\n\nIt is important to note that both back and forth work on the same range,\nand do not cross: iteration is over when they meet in the middle.\n\nIn a similar fashion to the [`Iterator`] protocol, once a\n`DoubleEndedIterator` returns [`None`] from a [`next_back()`], calling it\nagain may or may not ever return [`Some`] again. [`next()`] and\n[`next_back()`] are interchangeable for this purpose.\n\n[`next_back()`]: DoubleEndedIterator::next_back\n[`next()`]: Iterator::next\n\n# Examples\n\nBasic usage:\n\n```rust\nlet numbers = vec![1, 2, 3, 4, 5, 6];\n\nlet mut iter = numbers.iter();\n\nassert_eq!(Some(&1), iter.next());\nassert_eq!(Some(&6), iter.next_back());\nassert_eq!(Some(&5), iter.next_back());\nassert_eq!(Some(&2), iter.next());\nassert_eq!(Some(&3), iter.next());\nassert_eq!(Some(&4), iter.next());\nassert_eq!(None, iter.next());\nassert_eq!(None, iter.next_back());\n```"},"filterText":"DoubleEndedIterator","kind":8,"label":"DoubleEndedIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"DoubleEndedIterator","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Custom code within the destructor.\n\nWhen a value is no longer needed, Rust will run a \"destructor\" on that value.\nThe most common way that a value is no longer needed is when it goes out of\nscope. Destructors may still run in other circumstances, but we're going to\nfocus on scope for the examples here. To learn about some of those other cases,\nplease see [the reference] section on destructors.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\nThis destructor consists of two components:\n- A call to `Drop::drop` for that value, if this special `Drop` trait is implemented for its type.\n- The automatically generated \"drop glue\" which recursively calls the destructors\n of all the fields of this value.\n\nAs Rust automatically calls the destructors of all contained fields,\nyou don't have to implement `Drop` in most cases. But there are some cases where\nit is useful, for example for types which directly manage a resource.\nThat resource may be memory, it may be a file descriptor, it may be a network socket.\nOnce a value of that type is no longer going to be used, it should \"clean up\" its\nresource by freeing the memory or closing the file or socket. This is\nthe job of a destructor, and therefore the job of `Drop::drop`.\n\n## Examples\n\nTo see destructors in action, let's take a look at the following program:\n\n```rust\nstruct HasDrop;\n\nimpl Drop for HasDrop {\n fn drop(&mut self) {\n println!(\"Dropping HasDrop!\");\n }\n}\n\nstruct HasTwoDrops {\n one: HasDrop,\n two: HasDrop,\n}\n\nimpl Drop for HasTwoDrops {\n fn drop(&mut self) {\n println!(\"Dropping HasTwoDrops!\");\n }\n}\n\nfn main() {\n let _x = HasTwoDrops { one: HasDrop, two: HasDrop };\n println!(\"Running!\");\n}\n```\n\nRust will first call `Drop::drop` for `_x` and then for both `_x.one` and `_x.two`,\nmeaning that running this will print\n\n```text\nRunning!\nDropping HasTwoDrops!\nDropping HasDrop!\nDropping HasDrop!\n```\n\nEven if we remove the implementation of `Drop` for `HasTwoDrop`, the destructors of its fields are still called.\nThis would result in\n\n```test\nRunning!\nDropping HasDrop!\nDropping HasDrop!\n```\n\n## You cannot call `Drop::drop` yourself\n\nBecause `Drop::drop` is used to clean up a value, it may be dangerous to use this value after\nthe method has been called. As `Drop::drop` does not take ownership of its input,\nRust prevents misuse by not allowing you to call `Drop::drop` directly.\n\nIn other words, if you tried to explicitly call `Drop::drop` in the above example, you'd get a compiler error.\n\nIf you'd like to explicitly call the destructor of a value, [`mem::drop`] can be used instead.\n\n[`mem::drop`]: drop\n\n## Drop order\n\nWhich of our two `HasDrop` drops first, though? For structs, it's the same\norder that they're declared: first `one`, then `two`. If you'd like to try\nthis yourself, you can modify `HasDrop` above to contain some data, like an\ninteger, and then use it in the `println!` inside of `Drop`. This behavior is\nguaranteed by the language.\n\nUnlike for structs, local variables are dropped in reverse order:\n\n```rust\nstruct Foo;\n\nimpl Drop for Foo {\n fn drop(&mut self) {\n println!(\"Dropping Foo!\")\n }\n}\n\nstruct Bar;\n\nimpl Drop for Bar {\n fn drop(&mut self) {\n println!(\"Dropping Bar!\")\n }\n}\n\nfn main() {\n let _foo = Foo;\n let _bar = Bar;\n}\n```\n\nThis will print\n\n```text\nDropping Bar!\nDropping Foo!\n```\n\nPlease see [the reference] for the full rules.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\n## `Copy` and `Drop` are exclusive\n\nYou cannot implement both [`Copy`] and `Drop` on the same type. Types that\nare `Copy` get implicitly duplicated by the compiler, making it very\nhard to predict when, and how often destructors will be executed. As such,\nthese types cannot have destructors.\n\n## Drop check\n\nDropping interacts with the borrow checker in subtle ways: when a type `T` is being implicitly\ndropped as some variable of this type goes out of scope, the borrow checker needs to ensure that\ncalling `T`'s destructor at this moment is safe. In particular, it also needs to be safe to\nrecursively drop all the fields of `T`. For example, it is crucial that code like the following\nis being rejected:\n\n```rust\nuse std::cell::Cell;\n\nstruct S<'a>(Cell>>, Box);\nimpl Drop for S<'_> {\n fn drop(&mut self) {\n if let Some(r) = self.0.get() {\n // Print the contents of the `Box` in `r`.\n println!(\"{}\", r.1);\n }\n }\n}\n\nfn main() {\n // Set up two `S` that point to each other.\n let s1 = S(Cell::new(None), Box::new(42));\n let s2 = S(Cell::new(Some(&s1)), Box::new(42));\n s1.0.set(Some(&s2));\n // Now they both get dropped. But whichever is the 2nd one\n // to be dropped will access the `Box` in the first one,\n // which is a use-after-free!\n}\n```\n\nThe Nomicon discusses the need for [drop check in more detail][drop check].\n\nTo reject such code, the \"drop check\" analysis determines which types and lifetimes need to\nstill be live when `T` gets dropped. The exact details of this analysis are not yet\nstably guaranteed and **subject to change**. Currently, the analysis works as follows:\n- If `T` has no drop glue, then trivially nothing is required to be live. This is the case if\n neither `T` nor any of its (recursive) fields have a destructor (`impl Drop`). [`PhantomData`]\n and [`ManuallyDrop`] are considered to never have a destructor, no matter their field type.\n- If `T` has drop glue, then, for all types `U` that are *owned* by any field of `T`,\n recursively add the types and lifetimes that need to be live when `U` gets dropped. The set of\n owned types is determined by recursively traversing `T`:\n - Recursively descend through `PhantomData`, `Box`, tuples, and arrays (including arrays of\n length 0).\n - Stop at reference and raw pointer types as well as function pointers and function items;\n they do not own anything.\n - Stop at non-composite types (type parameters that remain generic in the current context and\n base types such as integers and `bool`); these types are owned.\n - When hitting an ADT with `impl Drop`, stop there; this type is owned.\n - When hitting an ADT without `impl Drop`, recursively descend to its fields. (For an `enum`,\n consider all fields of all variants.)\n- Furthermore, if `T` implements `Drop`, then all generic (lifetime and type) parameters of `T`\n must be live.\n\nIn the above example, the last clause implies that `'a` must be live when `S<'a>` is dropped,\nand hence the example is rejected. If we remove the `impl Drop`, the liveness requirement\ndisappears and the example is accepted.\n\nThere exists an unstable way for a type to opt-out of the last clause; this is called \"drop\ncheck eyepatch\" or `may_dangle`. For more details on this nightly-only feature, see the\n[discussion in the Nomicon][nomicon].\n\n[`ManuallyDrop`]: crate::mem::ManuallyDrop\n[`PhantomData`]: crate::marker::PhantomData\n[drop check]: ../../nomicon/dropck.html\n[nomicon]: ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standard-library-and-its-unstable-may_dangle"},"filterText":"Drop","kind":8,"label":"Drop","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Drop","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for comparisons corresponding to [equivalence relations](\nhttps://en.wikipedia.org/wiki/Equivalence_relation).\n\nThis means, that in addition to `a == b` and `a != b` being strict inverses,\nthe relation must be (for all `a`, `b` and `c`):\n\n- reflexive: `a == a`;\n- symmetric: `a == b` implies `b == a` (required by `PartialEq` as well); and\n- transitive: `a == b` and `b == c` implies `a == c` (required by `PartialEq` as well).\n\nThis property cannot be checked by the compiler, and therefore `Eq` implies\n[`PartialEq`], and has no extra methods.\n\nViolating this property is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\nImplement `Eq` in addition to `PartialEq` if it's guaranteed that\n`PartialEq::eq(a, a)` always returns `true` (reflexivity), in addition to\nthe symmetric and transitive properties already required by `PartialEq`.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d, because `Eq` has\nno extra methods, it is only informing the compiler that this is an\nequivalence relation rather than a partial equivalence relation. Note that\nthe `derive` strategy requires all fields are `Eq`, which isn't\nalways desired.\n\n## How can I implement `Eq`?\n\nIf you cannot use the `derive` strategy, specify that your type implements\n`Eq`, which has no methods:\n\n```rust\nenum BookFormat { Paperback, Hardback, Ebook }\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\nimpl Eq for Book {}\n```"},"filterText":"Eq","kind":8,"label":"Eq (alias ==, !=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Eq","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Err(E)","documentation":{"kind":"markdown","value":"Contains the error value"},"filterText":"Err()","insertTextFormat":2,"kind":20,"label":"Err(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Err(${1:()})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An iterator that knows its exact length.\n\nMany [`Iterator`]s don't know how many times they will iterate, but some do.\nIf an iterator knows how many times it can iterate, providing access to\nthat information can be useful. For example, if you want to iterate\nbackwards, a good start is to know where the end is.\n\nWhen implementing an `ExactSizeIterator`, you must also implement\n[`Iterator`]. When doing so, the implementation of [`Iterator::size_hint`]\n*must* return the exact size of the iterator.\n\nThe [`len`] method has a default implementation, so you usually shouldn't\nimplement it. However, you may be able to provide a more performant\nimplementation than the default, so overriding it in this case makes sense.\n\nNote that this trait is a safe trait and as such does *not* and *cannot*\nguarantee that the returned length is correct. This means that `unsafe`\ncode **must not** rely on the correctness of [`Iterator::size_hint`]. The\nunstable and unsafe [`TrustedLen`](super::marker::TrustedLen) trait gives\nthis additional guarantee.\n\n[`len`]: ExactSizeIterator::len\n\n# When *shouldn't* an adapter be `ExactSizeIterator`?\n\nIf an adapter makes an iterator *longer*, then it's usually incorrect for\nthat adapter to implement `ExactSizeIterator`. The inner exact-sized\niterator might already be `usize::MAX`-long, and thus the length of the\nlonger adapted iterator would no longer be exactly representable in `usize`.\n\nThis is why [`Chain`](crate::iter::Chain) isn't `ExactSizeIterator`,\neven when `A` and `B` are both `ExactSizeIterator`.\n\n# Examples\n\nBasic usage:\n\n```rust\n// a finite range knows exactly how many times it will iterate\nlet five = 0..5;\n\nassert_eq!(5, five.len());\n```\n\nIn the [module-level docs], we implemented an [`Iterator`], `Counter`.\nLet's implement `ExactSizeIterator` for it as well:\n\n[module-level docs]: crate::iter\n\n```rust\nimpl ExactSizeIterator for Counter {\n // We can easily calculate the remaining number of iterations.\n fn len(&self) -> usize {\n 5 - self.count\n }\n}\n\n// And now we can use it!\n\nlet mut counter = Counter::new();\n\nassert_eq!(5, counter.len());\nlet _ = counter.next();\nassert_eq!(4, counter.len());\n```"},"filterText":"ExactSizeIterator","kind":8,"label":"ExactSizeIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"ExactSizeIterator","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Extend a collection with the contents of an iterator.\n\nIterators produce a series of values, and collections can also be thought\nof as a series of values. The `Extend` trait bridges this gap, allowing you\nto extend a collection by including the contents of that iterator. When\nextending a collection with an already existing key, that entry is updated\nor, in the case of collections that permit multiple entries with equal\nkeys, that entry is inserted.\n\n# Examples\n\nBasic usage:\n\n```rust\n// You can extend a String with some chars:\nlet mut message = String::from(\"The first three letters are: \");\n\nmessage.extend(&['a', 'b', 'c']);\n\nassert_eq!(\"abc\", &message[29..32]);\n```\n\nImplementing `Extend`:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// since MyCollection has a list of i32s, we implement Extend for i32\nimpl Extend for MyCollection {\n\n // This is a bit simpler with the concrete type signature: we can call\n // extend on anything which can be turned into an Iterator which gives\n // us i32s. Because we need i32s to put into MyCollection.\n fn extend>(&mut self, iter: T) {\n\n // The implementation is very straightforward: loop through the\n // iterator, and add() each element to ourselves.\n for elem in iter {\n self.add(elem);\n }\n }\n}\n\nlet mut c = MyCollection::new();\n\nc.add(5);\nc.add(6);\nc.add(7);\n\n// let's extend our collection with three more numbers\nc.extend(vec![1, 2, 3]);\n\n// we've added these elements onto the end\nassert_eq!(\"MyCollection([5, 6, 7, 1, 2, 3])\", format!(\"{c:?}\"));\n```"},"filterText":"Extend","kind":8,"label":"Extend","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Extend","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes an immutable receiver.\n\nInstances of `Fn` can be called repeatedly without mutating state.\n\n*This trait (`Fn`) is not to be confused with [function pointers]\n(`fn`).*\n\n`Fn` is implemented automatically by closures which only take immutable\nreferences to captured variables or don't capture anything at all, as well\nas (safe) [function pointers] (with some caveats, see their documentation\nfor more details). Additionally, for any type `F` that implements `Fn`, `&F`\nimplements `Fn`, too.\n\nSince both [`FnMut`] and [`FnOnce`] are supertraits of `Fn`, any\ninstance of `Fn` can be used as a parameter where a [`FnMut`] or [`FnOnce`]\nis expected.\n\nUse `Fn` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly and without mutating state (e.g., when\ncalling it concurrently). If you do not need such strict requirements, use\n[`FnMut`] or [`FnOnce`] as bounds.\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a closure\n\n```rust\nlet square = |x| x * x;\nassert_eq!(square(5), 25);\n```\n\n## Using a `Fn` parameter\n\n```rust\nfn call_with_one(func: F) -> usize\n where F: Fn(usize) -> usize {\n func(1)\n}\n\nlet double = |x| x * 2;\nassert_eq!(call_with_one(double), 2);\n```"},"filterText":"Fn","kind":8,"label":"Fn","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Fn","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a mutable receiver.\n\nInstances of `FnMut` can be called repeatedly and may mutate state.\n\n`FnMut` is implemented automatically by closures which take mutable\nreferences to captured variables, as well as all types that implement\n[`Fn`], e.g., (safe) [function pointers] (since `FnMut` is a supertrait of\n[`Fn`]). Additionally, for any type `F` that implements `FnMut`, `&mut F`\nimplements `FnMut`, too.\n\nSince [`FnOnce`] is a supertrait of `FnMut`, any instance of `FnMut` can be\nused where a [`FnOnce`] is expected, and since [`Fn`] is a subtrait of\n`FnMut`, any instance of [`Fn`] can be used where `FnMut` is expected.\n\nUse `FnMut` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly, while allowing it to mutate state.\nIf you don't want the parameter to mutate state, use [`Fn`] as a\nbound; if you don't need to call it repeatedly, use [`FnOnce`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a mutably capturing closure\n\n```rust\nlet mut x = 5;\n{\n let mut square_x = || x *= x;\n square_x();\n}\nassert_eq!(x, 25);\n```\n\n## Using a `FnMut` parameter\n\n```rust\nfn do_twice(mut func: F)\n where F: FnMut()\n{\n func();\n func();\n}\n\nlet mut x: usize = 1;\n{\n let add_two_to_x = || x += 2;\n do_twice(add_two_to_x);\n}\n\nassert_eq!(x, 5);\n```"},"filterText":"FnMut","kind":8,"label":"FnMut","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"FnMut","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a by-value receiver.\n\nInstances of `FnOnce` can be called, but might not be callable multiple\ntimes. Because of this, if the only thing known about a type is that it\nimplements `FnOnce`, it can only be called once.\n\n`FnOnce` is implemented automatically by closures that might consume captured\nvariables, as well as all types that implement [`FnMut`], e.g., (safe)\n[function pointers] (since `FnOnce` is a supertrait of [`FnMut`]).\n\nSince both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of\n[`Fn`] or [`FnMut`] can be used where a `FnOnce` is expected.\n\nUse `FnOnce` as a bound when you want to accept a parameter of function-like\ntype and only need to call it once. If you need to call the parameter\nrepeatedly, use [`FnMut`] as a bound; if you also need it to not mutate\nstate, use [`Fn`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Using a `FnOnce` parameter\n\n```rust\nfn consume_with_relish(func: F)\n where F: FnOnce() -> String\n{\n // `func` consumes its captured variables, so it cannot be run more\n // than once.\n println!(\"Consumed: {}\", func());\n\n println!(\"Delicious!\");\n\n // Attempting to invoke `func()` again will throw a `use of moved\n // value` error for `func`.\n}\n\nlet x = String::from(\"x\");\nlet consume_and_return_x = move || x;\nconsume_with_relish(consume_and_return_x);\n\n// `consume_and_return_x` can no longer be invoked at this point\n```"},"filterText":"FnOnce","kind":8,"label":"FnOnce","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"FnOnce","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do value-to-value conversions while consuming the input value. It is the reciprocal of\n[`Into`].\n\nOne should always prefer implementing `From` over [`Into`]\nbecause implementing `From` automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nOnly implement [`Into`] when targeting a version prior to Rust 1.41 and converting to a type\noutside the current crate.\n`From` was not able to do these types of conversions in earlier versions because of Rust's\norphaning rules.\nSee [`Into`] for more details.\n\nPrefer using [`Into`] over using `From` when specifying trait bounds on a generic function.\nThis way, types that directly implement [`Into`] can be used as arguments as well.\n\nThe `From` is also very useful when performing error handling. When constructing a function\nthat is capable of failing, the return type will generally be of the form `Result`.\nThe `From` trait simplifies error handling by allowing a function to return a single error type\nthat encapsulate multiple error types. See the \"Examples\" section and [the book][book] for more\ndetails.\n\n**Note: This trait must not fail**. The `From` trait is intended for perfect conversions.\nIf the conversion can fail or is not perfect, use [`TryFrom`].\n\n# Generic Implementations\n\n- `From for U` implies [`Into`]` for T`\n- `From` is reflexive, which means that `From for T` is implemented\n\n# When to implement `From`\n\nWhile there's no technical restrictions on which conversions can be done using\na `From` implementation, the general expectation is that the conversions\nshould typically be restricted as follows:\n\n* The conversion is *infallible*: if the conversion can fail, use [`TryFrom`]\n instead; don't provide a `From` impl that panics.\n\n* The conversion is *lossless*: semantically, it should not lose or discard\n information. For example, `i32: From` exists, where the original\n value can be recovered using `u16: TryFrom`. And `String: From<&str>`\n exists, where you can get something equivalent to the original value via\n `Deref`. But `From` cannot be used to convert from `u32` to `u16`, since\n that cannot succeed in a lossless way. (There's some wiggle room here for\n information not considered semantically relevant. For example,\n `Box<[T]>: From>` exists even though it might not preserve capacity,\n like how two vectors can be equal despite differing capacities.)\n\n* The conversion is *value-preserving*: the conceptual kind and meaning of\n the resulting value is the same, even though the Rust type and technical\n representation might be different. For example `-1_i8 as u8` is *lossless*,\n since `as` casting back can recover the original value, but that conversion\n is *not* available via `From` because `-1` and `255` are different conceptual\n values (despite being identical bit patterns technically). But\n `f32: From` *is* available because `1_i16` and `1.0_f32` are conceptually\n the same real number (despite having very different bit patterns technically).\n `String: From` is available because they're both *text*, but\n `String: From` is *not* available, since `1` (a number) and `\"1\"`\n (text) are too different. (Converting values to text is instead covered\n by the [`Display`](crate::fmt::Display) trait.)\n\n* The conversion is *obvious*: it's the only reasonable conversion between\n the two types. Otherwise it's better to have it be a named method or\n constructor, like how [`str::as_bytes`] is a method and how integers have\n methods like [`u32::from_ne_bytes`], [`u32::from_le_bytes`], and\n [`u32::from_be_bytes`], none of which are `From` implementations. Whereas\n there's only one reasonable way to wrap an [`Ipv6Addr`](crate::net::Ipv6Addr)\n into an [`IpAddr`](crate::net::IpAddr), thus `IpAddr: From` exists.\n\n# Examples\n\n[`String`] implements `From<&str>`:\n\nAn explicit conversion from a `&str` to a String is done as follows:\n\n```rust\nlet string = \"hello\".to_string();\nlet other_string = String::from(\"hello\");\n\nassert_eq!(string, other_string);\n```\n\nWhile performing error handling it is often useful to implement `From` for your own error type.\nBy converting underlying error types to our own custom error type that encapsulates the\nunderlying error type, we can return a single error type without losing information on the\nunderlying cause. The '?' operator automatically converts the underlying error type to our\ncustom error type with `From::from`.\n\n```rust\nuse std::fs;\nuse std::io;\nuse std::num;\n\nenum CliError {\n IoError(io::Error),\n ParseError(num::ParseIntError),\n}\n\nimpl From for CliError {\n fn from(error: io::Error) -> Self {\n CliError::IoError(error)\n }\n}\n\nimpl From for CliError {\n fn from(error: num::ParseIntError) -> Self {\n CliError::ParseError(error)\n }\n}\n\nfn open_and_parse_file(file_name: &str) -> Result {\n let mut contents = fs::read_to_string(&file_name)?;\n let num: i32 = contents.trim().parse()?;\n Ok(num)\n}\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`from`]: From::from\n[book]: ../../book/ch09-00-error-handling.html"},"filterText":"From","kind":8,"label":"From","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"From","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Conversion from an [`Iterator`].\n\nBy implementing `FromIterator` for a type, you define how it will be\ncreated from an iterator. This is common for types which describe a\ncollection of some kind.\n\nIf you want to create a collection from the contents of an iterator, the\n[`Iterator::collect()`] method is preferred. However, when you need to\nspecify the container type, [`FromIterator::from_iter()`] can be more\nreadable than using a turbofish (e.g. `::>()`). See the\n[`Iterator::collect()`] documentation for more examples of its use.\n\nSee also: [`IntoIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v = Vec::from_iter(five_fives);\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`Iterator::collect()`] to implicitly use `FromIterator`:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v: Vec = five_fives.collect();\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`FromIterator::from_iter()`] as a more readable alternative to\n[`Iterator::collect()`]:\n\n```rust\nuse std::collections::VecDeque;\nlet first = (0..10).collect::>();\nlet second = VecDeque::from_iter(0..10);\n\nassert_eq!(first, second);\n```\n\nImplementing `FromIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement FromIterator\nimpl FromIterator for MyCollection {\n fn from_iter>(iter: I) -> Self {\n let mut c = MyCollection::new();\n\n for i in iter {\n c.add(i);\n }\n\n c\n }\n}\n\n// Now we can make a new iterator...\nlet iter = (0..5).into_iter();\n\n// ... and make a MyCollection out of it\nlet c = MyCollection::from_iter(iter);\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n\n// collect works too!\n\nlet iter = (0..5).into_iter();\nlet c: MyCollection = iter.collect();\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n```"},"filterText":"FromIterator","kind":8,"label":"FromIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"FromIterator","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A value-to-value conversion that consumes the input value. The\nopposite of [`From`].\n\nOne should avoid implementing [`Into`] and implement [`From`] instead.\nImplementing [`From`] automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nPrefer using [`Into`] over [`From`] when specifying trait bounds on a generic function\nto ensure that types that only implement [`Into`] can be used as well.\n\n**Note: This trait must not fail**. If the conversion can fail, use [`TryInto`].\n\n# Generic Implementations\n\n- [`From`]` for U` implies `Into for T`\n- [`Into`] is reflexive, which means that `Into for T` is implemented\n\n# Implementing [`Into`] for conversions to external types in old versions of Rust\n\nPrior to Rust 1.41, if the destination type was not part of the current crate\nthen you couldn't implement [`From`] directly.\nFor example, take this code:\n\n```rust\nstruct Wrapper(Vec);\nimpl From> for Vec {\n fn from(w: Wrapper) -> Vec {\n w.0\n }\n}\n```\nThis will fail to compile in older versions of the language because Rust's orphaning rules\nused to be a little bit more strict. To bypass this, you could implement [`Into`] directly:\n\n```rust\nstruct Wrapper(Vec);\nimpl Into> for Wrapper {\n fn into(self) -> Vec {\n self.0\n }\n}\n```\n\nIt is important to understand that [`Into`] does not provide a [`From`] implementation\n(as [`From`] does with [`Into`]). Therefore, you should always try to implement [`From`]\nand then fall back to [`Into`] if [`From`] can't be implemented.\n\n# Examples\n\n[`String`] implements [`Into`]`<`[`Vec`]`<`[`u8`]`>>`:\n\nIn order to express that we want a generic function to take all arguments that can be\nconverted to a specified type `T`, we can use a trait bound of [`Into`]``.\nFor example: The function `is_hello` takes all arguments that can be converted into a\n[`Vec`]`<`[`u8`]`>`.\n\n```rust\nfn is_hello>>(s: T) {\n let bytes = b\"hello\".to_vec();\n assert_eq!(bytes, s.into());\n}\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`Vec`]: ../../std/vec/struct.Vec.html"},"filterText":"Into","kind":8,"label":"Into","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Into","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Conversion into an [`Iterator`].\n\nBy implementing `IntoIterator` for a type, you define how it will be\nconverted to an iterator. This is common for types which describe a\ncollection of some kind.\n\nOne benefit of implementing `IntoIterator` is that your type will [work\nwith Rust's `for` loop syntax](crate::iter#for-loops-and-intoiterator).\n\nSee also: [`FromIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = [1, 2, 3];\nlet mut iter = v.into_iter();\n\nassert_eq!(Some(1), iter.next());\nassert_eq!(Some(2), iter.next());\nassert_eq!(Some(3), iter.next());\nassert_eq!(None, iter.next());\n```\nImplementing `IntoIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement IntoIterator\nimpl IntoIterator for MyCollection {\n type Item = i32;\n type IntoIter = std::vec::IntoIter;\n\n fn into_iter(self) -> Self::IntoIter {\n self.0.into_iter()\n }\n}\n\n// Now we can make a new collection...\nlet mut c = MyCollection::new();\n\n// ... add some stuff to it ...\nc.add(0);\nc.add(1);\nc.add(2);\n\n// ... and then turn it into an Iterator:\nfor (i, n) in c.into_iter().enumerate() {\n assert_eq!(i as i32, n);\n}\n```\n\nIt is common to use `IntoIterator` as a trait bound. This allows\nthe input collection type to change, so long as it is still an\niterator. Additional bounds can be specified by restricting on\n`Item`:\n\n```rust\nfn collect_as_strings(collection: T) -> Vec\nwhere\n T: IntoIterator,\n T::Item: std::fmt::Debug,\n{\n collection\n .into_iter()\n .map(|item| format!(\"{item:?}\"))\n .collect()\n}\n```"},"filterText":"IntoIterator","kind":8,"label":"IntoIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"IntoIterator","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for dealing with iterators.\n\nThis is the main iterator trait. For more about the concept of iterators\ngenerally, please see the [module-level documentation]. In particular, you\nmay want to know how to [implement `Iterator`][impl].\n\n[module-level documentation]: crate::iter\n[impl]: crate::iter#implementing-iterator"},"filterText":"Iterator","kind":8,"label":"Iterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Iterator","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"None","documentation":{"kind":"markdown","value":"No value."},"filterText":"None","insertTextFormat":2,"kind":20,"label":"None","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"None$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Ok(T)","documentation":{"kind":"markdown","value":"Contains the success value"},"filterText":"Ok()","insertTextFormat":2,"kind":20,"label":"Ok(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Ok(${1:()})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The `Option` type. See [the module level documentation](self) for more."},"filterText":"Option","kind":13,"label":"Option","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Option","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for types that form a [total order](https://en.wikipedia.org/wiki/Total_order).\n\nImplementations must be consistent with the [`PartialOrd`] implementation, and ensure\n`max`, `min`, and `clamp` are consistent with `cmp`:\n\n- `partial_cmp(a, b) == Some(cmp(a, b))`.\n- `max(a, b) == max_by(a, b, cmp)` (ensured by the default implementation).\n- `min(a, b) == min_by(a, b, cmp)` (ensured by the default implementation).\n- For `a.clamp(min, max)`, see the [method docs](#method.clamp)\n (ensured by the default implementation).\n\nIt's easy to accidentally make `cmp` and `partial_cmp` disagree by\nderiving some of the traits and manually implementing others.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nFrom the above and the requirements of `PartialOrd`, it follows that for\nall `a`, `b` and `c`:\n\n- exactly one of `a < b`, `a == b` or `a > b` is true; and\n- `<` is transitive: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n\nMathematically speaking, the `<` operator defines a strict [weak order]. In\ncases where `==` conforms to mathematical equality, it also defines a\nstrict [total order].\n\n[weak order]: https://en.wikipedia.org/wiki/Weak_ordering\n[total order]: https://en.wikipedia.org/wiki/Total_order\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## Lexicographical comparison\n\nLexicographical comparison is an operation with the following properties:\n - Two sequences are compared element by element.\n - The first mismatching element defines which sequence is lexicographically less or greater than the other.\n - If one sequence is a prefix of another, the shorter sequence is lexicographically less than the other.\n - If two sequences have equivalent elements and are of the same length, then the sequences are lexicographically equal.\n - An empty sequence is lexicographically less than any non-empty sequence.\n - Two empty sequences are lexicographically equal.\n\n## How can I implement `Ord`?\n\n`Ord` requires that the type also be [`PartialOrd`] and [`Eq`] (which requires [`PartialEq`]).\n\nThen you must define an implementation for [`cmp`]. You may find it useful to use\n[`cmp`] on your type's fields.\n\nHere's an example where you want to sort people by height only, disregarding `id`\nand `name`:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n[`cmp`]: Ord::cmp"},"filterText":"Ord","kind":8,"label":"Ord (alias <, >, <=, >=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Ord","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for comparisons using the equality operator.\n\nImplementing this trait for types provides the `==` and `!=` operators for\nthose types.\n\n`x.eq(y)` can also be written `x == y`, and `x.ne(y)` can be written `x != y`.\nWe use the easier-to-read infix notation in the remainder of this documentation.\n\nThis trait allows for comparisons using the equality operator, for types\nthat do not have a full equivalence relation. For example, in floating point\nnumbers `NaN != NaN`, so floating point types implement `PartialEq` but not\n[`trait@Eq`]. Formally speaking, when `Rhs == Self`, this trait corresponds\nto a [partial equivalence relation].\n\n[partial equivalence relation]: https://en.wikipedia.org/wiki/Partial_equivalence_relation\n\nImplementations must ensure that `eq` and `ne` are consistent with each other:\n\n- `a != b` if and only if `!(a == b)`.\n\nThe default implementation of `ne` provides this consistency and is almost\nalways sufficient. It should not be overridden without very good reason.\n\nIf [`PartialOrd`] or [`Ord`] are also implemented for `Self` and `Rhs`, their methods must also\nbe consistent with `PartialEq` (see the documentation of those traits for the exact\nrequirements). It's easy to accidentally make them disagree by deriving some of the traits and\nmanually implementing others.\n\nThe equality relation `==` must satisfy the following conditions\n(for all `a`, `b`, `c` of type `A`, `B`, `C`):\n\n- **Symmetric**: if `A: PartialEq` and `B: PartialEq`, then **`a == b`\n implies `b == a`**; and\n\n- **Transitive**: if `A: PartialEq` and `B: PartialEq` and `A:\n PartialEq`, then **`a == b` and `b == c` implies `a == c`**.\n\nNote that the `B: PartialEq` (symmetric) and `A: PartialEq`\n(transitive) impls are not forced to exist, but these requirements apply\nwhenever they do exist.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d on structs, two\ninstances are equal if all fields are equal, and not equal if any fields\nare not equal. When `derive`d on enums, two instances are equal if they\nare the same variant and all fields are equal.\n\n## How can I implement `PartialEq`?\n\nAn example implementation for a domain in which two books are considered\nthe same book if their ISBN matches, even if the formats differ:\n\n```rust\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\nlet b2 = Book { isbn: 3, format: BookFormat::Ebook };\nlet b3 = Book { isbn: 10, format: BookFormat::Paperback };\n\nassert!(b1 == b2);\nassert!(b1 != b3);\n```\n\n## How can I compare two different types?\n\nThe type you can compare with is controlled by `PartialEq`'s type parameter.\nFor example, let's tweak our previous code a bit:\n\n```rust\n// The derive implements == comparisons\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\n// Implement == comparisons\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\n// Implement == comparisons\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\n\nassert!(b1 == BookFormat::Paperback);\nassert!(BookFormat::Ebook != b1);\n```\n\nBy changing `impl PartialEq for Book` to `impl PartialEq for Book`,\nwe allow `BookFormat`s to be compared with `Book`s.\n\nA comparison like the one above, which ignores some fields of the struct,\ncan be dangerous. It can easily lead to an unintended violation of the\nrequirements for a partial equivalence relation. For example, if we kept\nthe above implementation of `PartialEq` for `BookFormat` and added an\nimplementation of `PartialEq` for `Book` (either via a `#[derive]` or\nvia the manual implementation from the first example) then the result would\nviolate transitivity:\n\n```rust\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\n#[derive(PartialEq)]\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nfn main() {\n let b1 = Book { isbn: 1, format: BookFormat::Paperback };\n let b2 = Book { isbn: 2, format: BookFormat::Paperback };\n\n assert!(b1 == BookFormat::Paperback);\n assert!(BookFormat::Paperback == b2);\n\n // The following should hold by transitivity but doesn't.\n assert!(b1 == b2); // <-- PANICS\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x == y, false);\nassert_eq!(x.eq(&y), false);\n```\n\n[`eq`]: PartialEq::eq\n[`ne`]: PartialEq::ne"},"filterText":"PartialEq","kind":8,"label":"PartialEq (alias ==, !=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"PartialEq","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for types that form a [partial order](https://en.wikipedia.org/wiki/Partial_order).\n\nThe `lt`, `le`, `gt`, and `ge` methods of this trait can be called using\nthe `<`, `<=`, `>`, and `>=` operators, respectively.\n\nThe methods of this trait must be consistent with each other and with those of [`PartialEq`].\nThe following conditions must hold:\n\n1. `a == b` if and only if `partial_cmp(a, b) == Some(Equal)`.\n2. `a < b` if and only if `partial_cmp(a, b) == Some(Less)`\n3. `a > b` if and only if `partial_cmp(a, b) == Some(Greater)`\n4. `a <= b` if and only if `a < b || a == b`\n5. `a >= b` if and only if `a > b || a == b`\n6. `a != b` if and only if `!(a == b)`.\n\nConditions 2–5 above are ensured by the default implementation.\nCondition 6 is already ensured by [`PartialEq`].\n\nIf [`Ord`] is also implemented for `Self` and `Rhs`, it must also be consistent with\n`partial_cmp` (see the documentation of that trait for the exact requirements). It's\neasy to accidentally make them disagree by deriving some of the traits and manually\nimplementing others.\n\nThe comparison must satisfy, for all `a`, `b` and `c`:\n\n- transitivity: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n- duality: `a < b` if and only if `b > a`.\n\nNote that these requirements mean that the trait itself must be implemented symmetrically and\ntransitively: if `T: PartialOrd` and `U: PartialOrd` then `U: PartialOrd` and `T:\nPartialOrd`.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nThe following corollaries follow from the above requirements:\n\n- irreflexivity of `<` and `>`: `!(a < a)`, `!(a > a)`\n- transitivity of `>`: if `a > b` and `b > c` then `a > c`\n- duality of `partial_cmp`: `partial_cmp(a, b) == partial_cmp(b, a).map(Ordering::reverse)`\n\n## Strict and non-strict partial orders\n\nThe `<` and `>` operators behave according to a *strict* partial order.\nHowever, `<=` and `>=` do **not** behave according to a *non-strict*\npartial order.\nThat is because mathematically, a non-strict partial order would require\nreflexivity, i.e. `a <= a` would need to be true for every `a`. This isn't\nalways the case for types that implement `PartialOrd`, for example:\n\n```rust\nlet a = f64::sqrt(-1.0);\nassert_eq!(a <= a, false);\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## How can I implement `PartialOrd`?\n\n`PartialOrd` only requires implementation of the [`partial_cmp`] method, with the others\ngenerated from default implementations.\n\nHowever it remains possible to implement the others separately for types which do not have a\ntotal order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==\nfalse` (cf. IEEE 754-2008 section 5.11).\n\n`PartialOrd` requires your type to be [`PartialEq`].\n\nIf your type is [`Ord`], you can implement [`partial_cmp`] by using [`cmp`]:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\nYou may also find it useful to use [`partial_cmp`] on your type's fields. Here\nis an example of `Person` types who have a floating-point `height` field that\nis the only field to be used for sorting:\n\n```rust\nuse std::cmp::Ordering;\n\nstruct Person {\n id: u32,\n name: String,\n height: f64,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n self.height.partial_cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x < y, true);\nassert_eq!(x.lt(&y), true);\n```\n\n[`partial_cmp`]: PartialOrd::partial_cmp\n[`cmp`]: Ord::cmp"},"filterText":"PartialOrd","kind":8,"label":"PartialOrd (alias >, <, <=, >=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"PartialOrd","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"`Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).\n\nSee the [module documentation](self) for details."},"filterText":"Result","kind":13,"label":"Result","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Result","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"RustcDecodable","kind":18,"label":"RustcDecodable","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"RustcDecodable","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"RustcEncodable","kind":18,"label":"RustcEncodable","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"RustcEncodable","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Some(T)","documentation":{"kind":"markdown","value":"Some value of type `T`."},"filterText":"Some()","insertTextFormat":2,"kind":20,"label":"Some(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Some(${1:()})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A UTF-8–encoded, growable string.\n\nThe `String` type is the most common string type that has ownership over the\ncontents of the string. It has a close relationship with its borrowed\ncounterpart, the primitive [`str`].\n\n# Examples\n\nYou can create a `String` from [a literal string][`&str`] with [`String::from`]:\n\n[`String::from`]: From::from\n\n```rust\nlet hello = String::from(\"Hello, world!\");\n```\n\nYou can append a [`char`] to a `String` with the [`push`] method, and\nappend a [`&str`] with the [`push_str`] method:\n\n```rust\nlet mut hello = String::from(\"Hello, \");\n\nhello.push('w');\nhello.push_str(\"orld!\");\n```\n\n[`push`]: String::push\n[`push_str`]: String::push_str\n\nIf you have a vector of UTF-8 bytes, you can create a `String` from it with\nthe [`from_utf8`] method:\n\n```rust\n// some bytes, in a vector\nlet sparkle_heart = vec![240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `unwrap()`.\nlet sparkle_heart = String::from_utf8(sparkle_heart).unwrap();\n\nassert_eq!(\"💖\", sparkle_heart);\n```\n\n[`from_utf8`]: String::from_utf8\n\n# UTF-8\n\n`String`s are always valid UTF-8. If you need a non-UTF-8 string, consider\n[`OsString`]. It is similar, but without the UTF-8 constraint. Because UTF-8\nis a variable width encoding, `String`s are typically smaller than an array of\nthe same `chars`:\n\n```rust\nuse std::mem;\n\n// `s` is ASCII which represents each `char` as one byte\nlet s = \"hello\";\nassert_eq!(s.len(), 5);\n\n// A `char` array with the same contents would be longer because\n// every `char` is four bytes\nlet s = ['h', 'e', 'l', 'l', 'o'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n\n// However, for non-ASCII strings, the difference will be smaller\n// and sometimes they are the same\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.len(), 20);\n\nlet s = ['💖', '💖', '💖', '💖', '💖'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n```\n\nThis raises interesting questions as to how `s[i]` should work.\nWhat should `i` be here? Several options include byte indices and\n`char` indices but, because of UTF-8 encoding, only byte indices\nwould provide constant time indexing. Getting the `i`th `char`, for\nexample, is available using [`chars`]:\n\n```rust\nlet s = \"hello\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('l'));\n\nlet s = \"💖💖💖💖💖\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('💖'));\n```\n\nNext, what should `s[i]` return? Because indexing returns a reference\nto underlying data it could be `&u8`, `&[u8]`, or something else similar.\nSince we're only providing one index, `&u8` makes the most sense but that\nmight not be what the user expects and can be explicitly achieved with\n[`as_bytes()`]:\n\n```rust\n// The first byte is 104 - the byte value of `'h'`\nlet s = \"hello\";\nassert_eq!(s.as_bytes()[0], 104);\n// or\nassert_eq!(s.as_bytes()[0], b'h');\n\n// The first byte is 240 which isn't obviously useful\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.as_bytes()[0], 240);\n```\n\nDue to these ambiguities/restrictions, indexing with a `usize` is simply\nforbidden:\n\n```rust\nlet s = \"hello\";\n\n// The following will not compile!\nprintln!(\"The first letter of s is {}\", s[0]);\n```\n\nIt is more clear, however, how `&s[i..j]` should work (that is,\nindexing with a range). It should accept byte indices (to be constant-time)\nand return a `&str` which is UTF-8 encoded. This is also called \"string slicing\".\nNote this will panic if the byte indices provided are not character\nboundaries - see [`is_char_boundary`] for more details. See the implementations\nfor [`SliceIndex`] for more details on string slicing. For a non-panicking\nversion of string slicing, see [`get`].\n\n[`OsString`]: ../../std/ffi/struct.OsString.html \"ffi::OsString\"\n[`SliceIndex`]: core::slice::SliceIndex\n[`as_bytes()`]: str::as_bytes\n[`get`]: str::get\n[`is_char_boundary`]: str::is_char_boundary\n\nThe [`bytes`] and [`chars`] methods return iterators over the bytes and\ncodepoints of the string, respectively. To iterate over codepoints along\nwith byte indices, use [`char_indices`].\n\n[`bytes`]: str::bytes\n[`chars`]: str::chars\n[`char_indices`]: str::char_indices\n\n# Deref\n\n`String` implements [Deref], and so inherits all of [`str`]'s\nmethods. In addition, this means that you can pass a `String` to a\nfunction which takes a [`&str`] by using an ampersand (`&`):\n\n```rust\nfn takes_str(s: &str) { }\n\nlet s = String::from(\"Hello\");\n\ntakes_str(&s);\n```\n\nThis will create a [`&str`] from the `String` and pass it in. This\nconversion is very inexpensive, and so generally, functions will accept\n[`&str`]s as arguments unless they need a `String` for some specific\nreason.\n\nIn certain cases Rust doesn't have enough information to make this\nconversion, known as [`Deref`] coercion. In the following example a string\nslice [`&'a str`][`&str`] implements the trait `TraitExample`, and the function\n`example_func` takes anything that implements the trait. In this case Rust\nwould need to make two implicit conversions, which Rust doesn't have the\nmeans to do. For that reason, the following example will not compile.\n\n```rust\ntrait TraitExample {}\n\nimpl<'a> TraitExample for &'a str {}\n\nfn example_func(example_arg: A) {}\n\nlet example_string = String::from(\"example_string\");\nexample_func(&example_string);\n```\n\nThere are two options that would work instead. The first would be to\nchange the line `example_func(&example_string);` to\n`example_func(example_string.as_str());`, using the method [`as_str()`]\nto explicitly extract the string slice containing the string. The second\nway changes `example_func(&example_string);` to\n`example_func(&*example_string);`. In this case we are dereferencing a\n`String` to a [`str`], then referencing the [`str`] back to\n[`&str`]. The second way is more idiomatic, however both work to do the\nconversion explicitly rather than relying on the implicit conversion.\n\n# Representation\n\nA `String` is made up of three components: a pointer to some bytes, a\nlength, and a capacity. The pointer points to an internal buffer `String`\nuses to store its data. The length is the number of bytes currently stored\nin the buffer, and the capacity is the size of the buffer in bytes. As such,\nthe length will always be less than or equal to the capacity.\n\nThis buffer is always stored on the heap.\n\nYou can look at these with the [`as_ptr`], [`len`], and [`capacity`]\nmethods:\n\n```rust\nuse std::mem;\n\nlet story = String::from(\"Once upon a time...\");\n\n// Prevent automatically dropping the String's data\nlet mut story = mem::ManuallyDrop::new(story);\n\nlet ptr = story.as_mut_ptr();\nlet len = story.len();\nlet capacity = story.capacity();\n\n// story has nineteen bytes\nassert_eq!(19, len);\n\n// We can re-build a String out of ptr, len, and capacity. This is all\n// unsafe because we are responsible for making sure the components are\n// valid:\nlet s = unsafe { String::from_raw_parts(ptr, len, capacity) } ;\n\nassert_eq!(String::from(\"Once upon a time...\"), s);\n```\n\n[`as_ptr`]: str::as_ptr\n[`len`]: String::len\n[`capacity`]: String::capacity\n\nIf a `String` has enough capacity, adding elements to it will not\nre-allocate. For example, consider this program:\n\n```rust\nlet mut s = String::new();\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\nThis will output the following:\n\n```text\n0\n8\n16\n16\n32\n32\n```\n\nAt first, we have no memory allocated at all, but as we append to the\nstring, it increases its capacity appropriately. If we instead use the\n[`with_capacity`] method to allocate the correct capacity initially:\n\n```rust\nlet mut s = String::with_capacity(25);\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\n[`with_capacity`]: String::with_capacity\n\nWe end up with a different output:\n\n```text\n25\n25\n25\n25\n25\n25\n```\n\nHere, there's no need to allocate more memory inside the loop.\n\n[str]: prim@str \"str\"\n[`str`]: prim@str \"str\"\n[`&str`]: prim@str \"&str\"\n[Deref]: core::ops::Deref \"ops::Deref\"\n[`Deref`]: core::ops::Deref \"ops::Deref\"\n[`as_str()`]: String::as_str"},"filterText":"String","kind":22,"label":"String","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"String","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A generalization of `Clone` to borrowed data.\n\nSome types make it possible to go from borrowed to owned, usually by\nimplementing the `Clone` trait. But `Clone` works only for going from `&T`\nto `T`. The `ToOwned` trait generalizes `Clone` to construct owned data\nfrom any borrow of a given type."},"filterText":"ToOwned","kind":8,"label":"ToOwned","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"ToOwned","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for converting a value to a `String`.\n\nThis trait is automatically implemented for any type which implements the\n[`Display`] trait. As such, `ToString` shouldn't be implemented directly:\n[`Display`] should be implemented instead, and you get the `ToString`\nimplementation for free.\n\n[`Display`]: fmt::Display"},"filterText":"ToString","kind":8,"label":"ToString","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"ToString","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Simple and safe type conversions that may fail in a controlled\nway under some circumstances. It is the reciprocal of [`TryInto`].\n\nThis is useful when you are doing a type conversion that may\ntrivially succeed but may also need special handling.\nFor example, there is no way to convert an [`i64`] into an [`i32`]\nusing the [`From`] trait, because an [`i64`] may contain a value\nthat an [`i32`] cannot represent and so the conversion would lose data.\nThis might be handled by truncating the [`i64`] to an [`i32`] or by\nsimply returning [`i32::MAX`], or by some other method. The [`From`]\ntrait is intended for perfect conversions, so the `TryFrom` trait\ninforms the programmer when a type conversion could go bad and lets\nthem decide how to handle it.\n\n# Generic Implementations\n\n- `TryFrom for U` implies [`TryInto`]` for T`\n- [`try_from`] is reflexive, which means that `TryFrom for T`\nis implemented and cannot fail -- the associated `Error` type for\ncalling `T::try_from()` on a value of type `T` is [`Infallible`].\nWhen the [`!`] type is stabilized [`Infallible`] and [`!`] will be\nequivalent.\n\n`TryFrom` can be implemented as follows:\n\n```rust\nstruct GreaterThanZero(i32);\n\nimpl TryFrom for GreaterThanZero {\n type Error = &'static str;\n\n fn try_from(value: i32) -> Result {\n if value <= 0 {\n Err(\"GreaterThanZero only accepts values greater than zero!\")\n } else {\n Ok(GreaterThanZero(value))\n }\n }\n}\n```\n\n# Examples\n\nAs described, [`i32`] implements `TryFrom<`[`i64`]`>`:\n\n```rust\nlet big_number = 1_000_000_000_000i64;\n// Silently truncates `big_number`, requires detecting\n// and handling the truncation after the fact.\nlet smaller_number = big_number as i32;\nassert_eq!(smaller_number, -727379968);\n\n// Returns an error because `big_number` is too big to\n// fit in an `i32`.\nlet try_smaller_number = i32::try_from(big_number);\nassert!(try_smaller_number.is_err());\n\n// Returns `Ok(3)`.\nlet try_successful_smaller_number = i32::try_from(3);\nassert!(try_successful_smaller_number.is_ok());\n```\n\n[`try_from`]: TryFrom::try_from"},"filterText":"TryFrom","kind":8,"label":"TryFrom","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"TryFrom","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An attempted conversion that consumes `self`, which may or may not be\nexpensive.\n\nLibrary authors should usually not directly implement this trait,\nbut should prefer implementing the [`TryFrom`] trait, which offers\ngreater flexibility and provides an equivalent `TryInto`\nimplementation for free, thanks to a blanket implementation in the\nstandard library. For more information on this, see the\ndocumentation for [`Into`].\n\n# Implementing `TryInto`\n\nThis suffers the same restrictions and reasoning as implementing\n[`Into`], see there for details."},"filterText":"TryInto","kind":8,"label":"TryInto","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"TryInto","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A contiguous growable array type, written as `Vec`, short for 'vector'.\n\n# Examples\n\n```rust\nlet mut vec = Vec::new();\nvec.push(1);\nvec.push(2);\n\nassert_eq!(vec.len(), 2);\nassert_eq!(vec[0], 1);\n\nassert_eq!(vec.pop(), Some(2));\nassert_eq!(vec.len(), 1);\n\nvec[0] = 7;\nassert_eq!(vec[0], 7);\n\nvec.extend([1, 2, 3]);\n\nfor x in &vec {\n println!(\"{x}\");\n}\nassert_eq!(vec, [7, 1, 2, 3]);\n```\n\nThe [`vec!`] macro is provided for convenient initialization:\n\n```rust\nlet mut vec1 = vec![1, 2, 3];\nvec1.push(4);\nlet vec2 = Vec::from([1, 2, 3, 4]);\nassert_eq!(vec1, vec2);\n```\n\nIt can also initialize each element of a `Vec` with a given value.\nThis may be more efficient than performing allocation and initialization\nin separate steps, especially when initializing a vector of zeros:\n\n```rust\nlet vec = vec![0; 5];\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n\n// The following is equivalent, but potentially slower:\nlet mut vec = Vec::with_capacity(5);\nvec.resize(5, 0);\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n```\n\nFor more information, see\n[Capacity and Reallocation](#capacity-and-reallocation).\n\nUse a `Vec` as an efficient stack:\n\n```rust\nlet mut stack = Vec::new();\n\nstack.push(1);\nstack.push(2);\nstack.push(3);\n\nwhile let Some(top) = stack.pop() {\n // Prints 3, 2, 1\n println!(\"{top}\");\n}\n```\n\n# Indexing\n\nThe `Vec` type allows access to values by index, because it implements the\n[`Index`] trait. An example will be more explicit:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[1]); // it will display '2'\n```\n\nHowever be careful: if you try to access an index which isn't in the `Vec`,\nyour software will panic! You cannot do this:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[6]); // it will panic!\n```\n\nUse [`get`] and [`get_mut`] if you want to check whether the index is in\nthe `Vec`.\n\n# Slicing\n\nA `Vec` can be mutable. On the other hand, slices are read-only objects.\nTo get a [slice][prim@slice], use [`&`]. Example:\n\n```rust\nfn read_slice(slice: &[usize]) {\n // ...\n}\n\nlet v = vec![0, 1];\nread_slice(&v);\n\n// ... and that's all!\n// you can also do it like this:\nlet u: &[usize] = &v;\n// or like this:\nlet u: &[_] = &v;\n```\n\nIn Rust, it's more common to pass slices as arguments rather than vectors\nwhen you just want to provide read access. The same goes for [`String`] and\n[`&str`].\n\n# Capacity and reallocation\n\nThe capacity of a vector is the amount of space allocated for any future\nelements that will be added onto the vector. This is not to be confused with\nthe *length* of a vector, which specifies the number of actual elements\nwithin the vector. If a vector's length exceeds its capacity, its capacity\nwill automatically be increased, but its elements will have to be\nreallocated.\n\nFor example, a vector with capacity 10 and length 0 would be an empty vector\nwith space for 10 more elements. Pushing 10 or fewer elements onto the\nvector will not change its capacity or cause reallocation to occur. However,\nif the vector's length is increased to 11, it will have to reallocate, which\ncan be slow. For this reason, it is recommended to use [`Vec::with_capacity`]\nwhenever possible to specify how big the vector is expected to get.\n\n# Guarantees\n\nDue to its incredibly fundamental nature, `Vec` makes a lot of guarantees\nabout its design. This ensures that it's as low-overhead as possible in\nthe general case, and can be correctly manipulated in primitive ways\nby unsafe code. Note that these guarantees refer to an unqualified `Vec`.\nIf additional type parameters are added (e.g., to support custom allocators),\noverriding their defaults may change the behavior.\n\nMost fundamentally, `Vec` is and always will be a (pointer, capacity, length)\ntriplet. No more, no less. The order of these fields is completely\nunspecified, and you should use the appropriate methods to modify these.\nThe pointer will never be null, so this type is null-pointer-optimized.\n\nHowever, the pointer might not actually point to allocated memory. In particular,\nif you construct a `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],\n[`Vec::with_capacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]\non an empty Vec, it will not allocate memory. Similarly, if you store zero-sized\ntypes inside a `Vec`, it will not allocate space for them. *Note that in this case\nthe `Vec` might not report a [`capacity`] of 0*. `Vec` will allocate if and only\nif [mem::size_of::\\]\\() * [capacity]\\() > 0. In general, `Vec`'s allocation\ndetails are very subtle --- if you intend to allocate memory using a `Vec`\nand use it for something else (either to pass to unsafe code, or to build your\nown memory-backed collection), be sure to deallocate this memory by using\n`from_raw_parts` to recover the `Vec` and then dropping it.\n\nIf a `Vec` *has* allocated memory, then the memory it points to is on the heap\n(as defined by the allocator Rust is configured to use by default), and its\npointer points to [`len`] initialized, contiguous elements in order (what\nyou would see if you coerced it to a slice), followed by [capacity] - [len]\nlogically uninitialized, contiguous elements.\n\nA vector containing the elements `'a'` and `'b'` with capacity 4 can be\nvisualized as below. The top part is the `Vec` struct, it contains a\npointer to the head of the allocation in the heap, length and capacity.\nThe bottom part is the allocation on the heap, a contiguous memory block.\n\n```text\n ptr len capacity\n +--------+--------+--------+\n | 0x0123 | 2 | 4 |\n +--------+--------+--------+\n |\n v\nHeap +--------+--------+--------+--------+\n | 'a' | 'b' | uninit | uninit |\n +--------+--------+--------+--------+\n```\n\n- **uninit** represents memory that is not initialized, see [`MaybeUninit`].\n- Note: the ABI is not stable and `Vec` makes no guarantees about its memory\n layout (including the order of fields).\n\n`Vec` will never perform a \"small optimization\" where elements are actually\nstored on the stack for two reasons:\n\n* It would make it more difficult for unsafe code to correctly manipulate\n a `Vec`. The contents of a `Vec` wouldn't have a stable address if it were\n only moved, and it would be more difficult to determine if a `Vec` had\n actually allocated memory.\n\n* It would penalize the general case, incurring an additional branch\n on every access.\n\n`Vec` will never automatically shrink itself, even if completely empty. This\nensures no unnecessary allocations or deallocations occur. Emptying a `Vec`\nand then filling it back up to the same [`len`] should incur no calls to\nthe allocator. If you wish to free up unused memory, use\n[`shrink_to_fit`] or [`shrink_to`].\n\n[`push`] and [`insert`] will never (re)allocate if the reported capacity is\nsufficient. [`push`] and [`insert`] *will* (re)allocate if\n[len] == [capacity]. That is, the reported capacity is completely\naccurate, and can be relied on. It can even be used to manually free the memory\nallocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even\nwhen not necessary.\n\n`Vec` does not guarantee any particular growth strategy when reallocating\nwhen full, nor when [`reserve`] is called. The current strategy is basic\nand it may prove desirable to use a non-constant growth factor. Whatever\nstrategy is used will of course guarantee *O*(1) amortized [`push`].\n\n`vec![x; n]`, `vec![a, b, c, d]`, and\n[`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`\nwith exactly the requested capacity. If [len] == [capacity],\n(as is the case for the [`vec!`] macro), then a `Vec` can be converted to\nand from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.\n\n`Vec` will not specifically overwrite any data that is removed from it,\nbut also won't specifically preserve it. Its uninitialized memory is\nscratch space that it may use however it wants. It will generally just do\nwhatever is most efficient or otherwise easy to implement. Do not rely on\nremoved data to be erased for security purposes. Even if you drop a `Vec`, its\nbuffer may simply be reused by another allocation. Even if you zero a `Vec`'s memory\nfirst, that might not actually happen because the optimizer does not consider\nthis a side-effect that must be preserved. There is one case which we will\nnot break, however: using `unsafe` code to write to the excess capacity,\nand then increasing the length to match, is always valid.\n\nCurrently, `Vec` does not guarantee the order in which elements are dropped.\nThe order has changed in the past and may change again.\n\n[`get`]: slice::get\n[`get_mut`]: slice::get_mut\n[`String`]: crate::string::String\n[`&str`]: type@str\n[`shrink_to_fit`]: Vec::shrink_to_fit\n[`shrink_to`]: Vec::shrink_to\n[capacity]: Vec::capacity\n[`capacity`]: Vec::capacity\n[mem::size_of::\\]: core::mem::size_of\n[len]: Vec::len\n[`len`]: Vec::len\n[`push`]: Vec::push\n[`insert`]: Vec::insert\n[`reserve`]: Vec::reserve\n[`MaybeUninit`]: core::mem::MaybeUninit\n[owned slice]: Box"},"filterText":"Vec","kind":22,"label":"Vec","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"Vec","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"alloc_error_handler","kind":18,"label":"alloc_error_handler","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"alloc_error_handler","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"fn(T)","documentation":{"kind":"markdown","value":"Disposes of a value.\n\nThis does so by calling the argument's implementation of [`Drop`][drop].\n\nThis effectively does nothing for types which implement `Copy`, e.g.\nintegers. Such values are copied and _then_ moved into the function, so the\nvalue persists after this function call.\n\nThis function is not magic; it is literally defined as\n\n```rust\npub fn drop(_x: T) {}\n```\n\nBecause `_x` is moved into the function, it is automatically dropped before\nthe function returns.\n\n[drop]: Drop\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = vec![1, 2, 3];\n\ndrop(v); // explicitly drop the vector\n```\n\nSince [`RefCell`] enforces the borrow rules at runtime, `drop` can\nrelease a [`RefCell`] borrow:\n\n```rust\nuse std::cell::RefCell;\n\nlet x = RefCell::new(1);\n\nlet mut mutable_borrow = x.borrow_mut();\n*mutable_borrow = 1;\n\ndrop(mutable_borrow); // relinquish the mutable borrow on this slot\n\nlet borrow = x.borrow();\nprintln!(\"{}\", *borrow);\n```\n\nIntegers and other types implementing [`Copy`] are unaffected by `drop`.\n\n```rust\n#[derive(Copy, Clone)]\nstruct Foo(u8);\n\nlet x = 1;\nlet y = Foo(2);\ndrop(x); // a copy of `x` is moved and dropped\ndrop(y); // a copy of `y` is moved and dropped\n\nprintln!(\"x: {}, y: {}\", x, y.0); // still available\n```\n\n[`RefCell`]: crate::cell::RefCell"},"filterText":"drop","insertTextFormat":2,"kind":3,"label":"drop(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"drop(${1:x})$0","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"type_ascribe","kind":18,"label":"type_ascribe","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"type_ascribe","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"unsafe","insertTextFormat":2,"kind":14,"label":"unsafe","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"unsafe {\n $0\n};","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"match","insertTextFormat":2,"kind":14,"label":"match","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"match $1 {\n $0\n};","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"while","insertTextFormat":2,"kind":14,"label":"while","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"while $1 {\n $0\n};","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"while let","insertTextFormat":2,"kind":14,"label":"while let","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"while let $1 = $2 {\n $0\n};","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"loop","insertTextFormat":2,"kind":14,"label":"loop","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"loop {\n $0\n};","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"if","insertTextFormat":2,"kind":14,"label":"if","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"if $1 {\n $0\n};","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"if let","insertTextFormat":2,"kind":14,"label":"if let","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"if let $1 = $2 {\n $0\n};","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"for","insertTextFormat":2,"kind":14,"label":"for","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"for $1 in $2 {\n $0\n};","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"true","insertTextFormat":2,"kind":14,"label":"true","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"true","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"false","insertTextFormat":2,"kind":14,"label":"false","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"false","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"return","insertTextFormat":2,"kind":14,"label":"return","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}},"newText":"return","replace":{"end":{"character":16,"line":1},"start":{"character":12,"line":1}}}}]} 2023-12-27T20:29:08.872 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":16,"line":1},"start":{"character":16,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":4}}} 2023-12-27T20:29:08.873 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":17},"end":{"line":1,"character":17}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":4}} 2023-12-27T20:29:09.258 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":17,"line":1},"start":{"character":17,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":5}}} 2023-12-27T20:29:09.259 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":18},"end":{"line":1,"character":18}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":5}} 2023-12-27T20:29:09.669 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":18,"line":1},"start":{"character":18,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":6}}} 2023-12-27T20:29:09.670 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":19},"end":{"line":1,"character":19}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":6}} 2023-12-27T20:29:10.112 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":19,"line":1},"start":{"character":19,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":7}}} 2023-12-27T20:29:10.112 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":20},"end":{"line":1,"character":20}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":7}} 2023-12-27T20:29:10.551 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":20,"line":1},"start":{"character":20,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":8}}} 2023-12-27T20:29:10.552 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":21},"end":{"line":1,"character":21}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":8}} 2023-12-27T20:29:10.987 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":21,"line":1},"start":{"character":21,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":9}}} 2023-12-27T20:29:10.989 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":22},"end":{"line":1,"character":22}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":9}} 2023-12-27T20:29:11.402 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":22,"line":1},"start":{"character":22,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":10}}} 2023-12-27T20:29:11.403 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":23},"end":{"line":1,"character":23}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":10}} 2023-12-27T20:29:11.837 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":23,"line":1},"start":{"character":23,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":11}}} 2023-12-27T20:29:11.838 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":24},"end":{"line":1,"character":24}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":11}} 2023-12-27T20:29:11.938 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":24,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}},"id":4} 2023-12-27T20:29:11.947 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":4,"result":{"isIncomplete":true,"items":[{"label":"self::","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"self::","textEdit":{"newText":"self::","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"crate::","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"crate::","textEdit":{"newText":"crate::","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"main()","kind":3,"detail":"fn()","deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"main","insertTextFormat":2,"textEdit":{"newText":"main()$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"panic!(…)","kind":3,"detail":"macro_rules! panic","deprecated":false,"sortText":"ffffffef","filterText":"panic!","insertTextFormat":2,"textEdit":{"newText":"panic!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"println!(…)","kind":3,"detail":"macro_rules! println","documentation":{"kind":"markdown","value":"Prints to the standard output, with a newline.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`)).\n\nThis macro uses the same syntax as [`format!`], but writes to the standard output instead.\nSee [`std::fmt`] for more information.\n\nThe `println!` macro will lock the standard output on each call. If you call\n`println!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwriteln!(lock, \"hello world\").unwrap();\n```\n\nUse `println!` only for the primary output of your program. Use\n[`eprintln!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`std::fmt`]: crate::fmt\n[`eprintln!`]: crate::eprintln\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to [`io::stdout`] fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n[`io::stdout`]: crate::io::stdout\n\n# Examples\n\n```rust\nprintln!(); // prints just a newline\nprintln!(\"hello there!\");\nprintln!(\"format {} arguments\", \"some\");\nlet local_variable = \"some\";\nprintln!(\"format {local_variable} arguments\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"println!","insertTextFormat":2,"textEdit":{"newText":"println!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"debug_assert_eq!(…)","kind":3,"detail":"macro_rules! debug_assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_eq!`], `debug_assert_eq!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_eq!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_eq!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_eq!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\ndebug_assert_eq!(a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert_eq!","insertTextFormat":2,"textEdit":{"newText":"debug_assert_eq!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"include_str!(…)","kind":3,"detail":"macro_rules! include_str","documentation":{"kind":"markdown","value":"Includes a UTF-8 encoded file as a string.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static str` which is the\ncontents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_str = include_str!(\"spanish.in\");\n assert_eq!(my_str, \"adiós\\n\");\n print!(\"{my_str}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include_str!","insertTextFormat":2,"textEdit":{"newText":"include_str!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"concat!(…)","kind":3,"detail":"macro_rules! concat","documentation":{"kind":"markdown","value":"Concatenates literals into a static string slice.\n\nThis macro takes any number of comma-separated literals, yielding an\nexpression of type `&'static str` which represents all of the literals\nconcatenated left-to-right.\n\nInteger and floating point literals are [stringified](core::stringify) in order to be\nconcatenated.\n\n# Examples\n\n```rust\nlet s = concat!(\"test\", 10, 'b', true);\nassert_eq!(s, \"test10btrue\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat!","insertTextFormat":2,"textEdit":{"newText":"concat!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"format!(…)","kind":3,"detail":"macro_rules! format","documentation":{"kind":"markdown","value":"Creates a `String` using interpolation of runtime expressions.\n\nThe first argument `format!` receives is a format string. This must be a string\nliteral. The power of the formatting string is in the `{}`s contained.\nAdditional parameters passed to `format!` replace the `{}`s within the\nformatting string in the order given unless named or positional parameters\nare used.\n\nSee [the formatting syntax documentation in `std::fmt`](../std/fmt/index.html)\nfor details.\n\nA common use for `format!` is concatenation and interpolation of strings.\nThe same convention is used with [`print!`] and [`write!`] macros,\ndepending on the intended destination of the string; all these macros internally use [`format_args!`].\n\nTo convert a single value to a string, use the [`to_string`] method. This\nwill use the [`Display`] formatting trait.\n\nTo concatenate literals into a `&'static str`, use the [`concat!`] macro.\n\n[`print!`]: ../std/macro.print.html\n[`write!`]: core::write\n[`format_args!`]: core::format_args\n[`to_string`]: crate::string::ToString\n[`Display`]: core::fmt::Display\n[`concat!`]: core::concat\n\n# Panics\n\n`format!` panics if a formatting trait implementation returns an error.\nThis indicates an incorrect implementation\nsince `fmt::Write for String` never returns an error itself.\n\n# Examples\n\n```rust\nformat!(\"test\"); // => \"test\"\nformat!(\"hello {}\", \"world!\"); // => \"hello world!\"\nformat!(\"x = {}, y = {val}\", 10, val = 30); // => \"x = 10, y = 30\"\nlet (x, y) = (1, 2);\nformat!(\"{x} + {y} = 3\"); // => \"1 + 2 = 3\"\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"format!","insertTextFormat":2,"textEdit":{"newText":"format!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"log_syntax!(…)","kind":3,"detail":"macro_rules! log_syntax","documentation":{"kind":"markdown","value":"Prints passed tokens into the standard output."},"deprecated":false,"sortText":"ffffffef","filterText":"log_syntax!","insertTextFormat":2,"textEdit":{"newText":"log_syntax!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"stringify!(…)","kind":3,"detail":"macro_rules! stringify","documentation":{"kind":"markdown","value":"Stringifies its arguments.\n\nThis macro will yield an expression of type `&'static str` which is the\nstringification of all the tokens passed to the macro. No restrictions\nare placed on the syntax of the macro invocation itself.\n\nNote that the expanded results of the input tokens may change in the\nfuture. You should be careful if you rely on the output.\n\n# Examples\n\n```rust\nlet one_plus_one = stringify!(1 + 1);\nassert_eq!(one_plus_one, \"1 + 1\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"stringify!","insertTextFormat":2,"textEdit":{"newText":"stringify!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"assert_ne!(…)","kind":3,"detail":"macro_rules! assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\nassert_ne!(a, b);\n\nassert_ne!(a, b, \"we are testing that the values are not equal\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert_ne!","insertTextFormat":2,"textEdit":{"newText":"assert_ne!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"dbg!(…)","kind":3,"detail":"macro_rules! dbg","documentation":{"kind":"markdown","value":"Prints and returns the value of a given expression for quick and dirty\ndebugging.\n\nAn example:\n\n```rust\nlet a = 2;\nlet b = dbg!(a * 2) + 1;\n// ^-- prints: [src/main.rs:2] a * 2 = 4\nassert_eq!(b, 5);\n```\n\nThe macro works by using the `Debug` implementation of the type of\nthe given expression to print the value to [stderr] along with the\nsource location of the macro invocation as well as the source code\nof the expression.\n\nInvoking the macro on an expression moves and takes ownership of it\nbefore returning the evaluated expression unchanged. If the type\nof the expression does not implement `Copy` and you don't want\nto give up ownership, you can instead borrow with `dbg!(&expr)`\nfor some expression `expr`.\n\nThe `dbg!` macro works exactly the same in release builds.\nThis is useful when debugging issues that only occur in release\nbuilds or when debugging in release mode is significantly faster.\n\nNote that the macro is intended as a debugging tool and therefore you\nshould avoid having uses of it in version control for long periods\n(other than in tests and similar).\nDebug output from production code is better done with other facilities\nsuch as the [`debug!`] macro from the [`log`] crate.\n\n# Stability\n\nThe exact output printed by this macro should not be relied upon\nand is subject to future changes.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\n# Further examples\n\nWith a method call:\n\n```rust\nfn foo(n: usize) {\n if let Some(_) = dbg!(n.checked_sub(4)) {\n // ...\n }\n}\n\nfoo(3)\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:4] n.checked_sub(4) = None\n```\n\nNaive factorial implementation:\n\n```rust\nfn factorial(n: u32) -> u32 {\n if dbg!(n <= 1) {\n dbg!(1)\n } else {\n dbg!(n * factorial(n - 1))\n }\n}\n\ndbg!(factorial(4));\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = true\n[src/main.rs:4] 1 = 1\n[src/main.rs:5] n * factorial(n - 1) = 2\n[src/main.rs:5] n * factorial(n - 1) = 6\n[src/main.rs:5] n * factorial(n - 1) = 24\n[src/main.rs:11] factorial(4) = 24\n```\n\nThe `dbg!(..)` macro moves the input:\n\n```rust\n/// A wrapper around `usize` which importantly is not Copyable.\n#[derive(Debug)]\nstruct NoCopy(usize);\n\nlet a = NoCopy(42);\nlet _ = dbg!(a); // <-- `a` is moved here.\nlet _ = dbg!(a); // <-- `a` is moved again; error!\n```\n\nYou can also use `dbg!()` without a value to just print the\nfile and line whenever it's reached.\n\nFinally, if you want to `dbg!(..)` multiple values, it will treat them as\na tuple (and return it, too):\n\n```rust\nassert_eq!(dbg!(1usize, 2u32), (1, 2));\n```\n\nHowever, a single argument with a trailing comma will still not be treated\nas a tuple, following the convention of ignoring trailing commas in macro\ninvocations. You can use a 1-tuple directly if you need one:\n\n```rust\nassert_eq!(1, dbg!(1u32,)); // trailing comma ignored\nassert_eq!((1,), dbg!((1u32,))); // 1-tuple\n```\n\n[stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)\n[`debug!`]: https://docs.rs/log/*/log/macro.debug.html\n[`log`]: https://crates.io/crates/log"},"deprecated":false,"sortText":"ffffffef","filterText":"dbg!","insertTextFormat":2,"textEdit":{"newText":"dbg!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"vec![…]","kind":3,"detail":"macro_rules! vec","documentation":{"kind":"markdown","value":"Creates a [`Vec`] containing the arguments.\n\n`vec!` allows `Vec`s to be defined with the same syntax as array expressions.\nThere are two forms of this macro:\n\n- Create a [`Vec`] containing a given list of elements:\n\n```rust\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```\n\n- Create a [`Vec`] from a given element and size:\n\n```rust\nlet v = vec![1; 3];\nassert_eq!(v, [1, 1, 1]);\n```\n\nNote that unlike array expressions this syntax supports all elements\nwhich implement [`Clone`] and the number of elements doesn't have to be\na constant.\n\nThis will use `clone` to duplicate an expression, so one should be careful\nusing this with types having a nonstandard `Clone` implementation. For\nexample, `vec![Rc::new(1); 5]` will create a vector of five references\nto the same boxed integer value, not five references pointing to independently\nboxed integers.\n\nAlso, note that `vec![expr; 0]` is allowed, and produces an empty vector.\nThis will still evaluate `expr`, however, and immediately drop the resulting value, so\nbe mindful of side effects.\n\n[`Vec`]: crate::vec::Vec"},"deprecated":false,"sortText":"ffffffef","filterText":"vec!","insertTextFormat":2,"textEdit":{"newText":"vec![$0]","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"include!(…)","kind":3,"detail":"macro_rules! include","documentation":{"kind":"markdown","value":"Parses a file as an expression or an item according to the context.\n\n**Warning**: For multi-file Rust projects, the `include!` macro is probably not what you\nare looking for. Usually, multi-file Rust projects use\n[modules](https://doc.rust-lang.org/reference/items/modules.html). Multi-file projects and\nmodules are explained in the Rust-by-Example book\n[here](https://doc.rust-lang.org/rust-by-example/mod/split.html) and the module system is\nexplained in the Rust Book\n[here](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html).\n\nThe included file is placed in the surrounding code\n[unhygienically](https://doc.rust-lang.org/reference/macros-by-example.html#hygiene). If\nthe included file is parsed as an expression and variables or functions share names across\nboth files, it could result in variables or functions being different from what the\nincluded file expected.\n\nThe included file is located relative to the current file (similarly to how modules are\nfound). The provided path is interpreted in a platform-specific way at compile time. So,\nfor instance, an invocation with a Windows path containing backslashes `\\` would not\ncompile correctly on Unix.\n\n# Uses\n\nThe `include!` macro is primarily used for two purposes. It is used to include\ndocumentation that is written in a separate file and it is used to include [build artifacts\nusually as a result from the `build.rs`\nscript](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script).\n\nWhen using the `include` macro to include stretches of documentation, remember that the\nincluded file still needs to be a valid rust syntax. It is also possible to\nuse the [`include_str`] macro as `#![doc = include_str!(\"...\")]` (at the module level) or\n`#[doc = include_str!(\"...\")]` (at the item level) to include documentation from a plain\ntext or markdown file.\n\n# Examples\n\nAssume there are two files in the same directory with the following contents:\n\nFile 'monkeys.in':\n\n```rust\n['🙈', '🙊', '🙉']\n .iter()\n .cycle()\n .take(6)\n .collect::()\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_string = include!(\"monkeys.in\");\n assert_eq!(\"🙈🙊🙉🙈🙊🙉\", my_string);\n println!(\"{my_string}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print\n\"🙈🙊🙉🙈🙊🙉\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include!","insertTextFormat":2,"textEdit":{"newText":"include!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"print!(…)","kind":3,"detail":"macro_rules! print","documentation":{"kind":"markdown","value":"Prints to the standard output.\n\nEquivalent to the [`println!`] macro except that a newline is not printed at\nthe end of the message.\n\nNote that stdout is frequently line-buffered by default so it may be\nnecessary to use [`io::stdout().flush()`][flush] to ensure the output is emitted\nimmediately.\n\nThe `print!` macro will lock the standard output on each call. If you call\n`print!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwrite!(lock, \"hello world\").unwrap();\n```\n\nUse `print!` only for the primary output of your program. Use\n[`eprint!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[flush]: crate::io::Write::flush\n[`println!`]: crate::println\n[`eprint!`]: crate::eprint\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to `io::stdout()` fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\nuse std::io::{self, Write};\n\nprint!(\"this \");\nprint!(\"will \");\nprint!(\"be \");\nprint!(\"on \");\nprint!(\"the \");\nprint!(\"same \");\nprint!(\"line \");\n\nio::stdout().flush().unwrap();\n\nprint!(\"this string has a newline, why not choose println! instead?\\n\");\n\nio::stdout().flush().unwrap();\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"print!","insertTextFormat":2,"textEdit":{"newText":"print!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"cfg_match! {…}","kind":3,"detail":"macro cfg_match","documentation":{"kind":"markdown","value":"A macro for defining `#[cfg]` match-like statements.\n\nIt is similar to the `if/elif` C preprocessor macro by allowing definition of a cascade of\n`#[cfg]` cases, emitting the implementation which matches first.\n\nThis allows you to conveniently provide a long list `#[cfg]`'d blocks of code\nwithout having to rewrite each clause multiple times.\n\nTrailing `_` wildcard match arms are **optional** and they indicate a fallback branch when\nall previous declarations do not evaluate to true.\n\n# Example\n\n```rust\n#![feature(cfg_match)]\n\ncfg_match! {\n cfg(unix) => {\n fn foo() { /* unix specific functionality */ }\n }\n cfg(target_pointer_width = \"32\") => {\n fn foo() { /* non-unix, 32-bit functionality */ }\n }\n _ => {\n fn foo() { /* fallback implementation */ }\n }\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"cfg_match!","insertTextFormat":2,"textEdit":{"newText":"cfg_match! {$0}","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"concat_idents!(…)","kind":3,"detail":"macro_rules! concat_idents","documentation":{"kind":"markdown","value":"Concatenates identifiers into one identifier.\n\nThis macro takes any number of comma-separated identifiers, and\nconcatenates them all into one, yielding an expression which is a new\nidentifier. Note that hygiene makes it such that this macro cannot\ncapture local variables. Also, as a general rule, macros are only\nallowed in item, statement or expression position. That means while\nyou may use this macro for referring to existing variables, functions or\nmodules etc, you cannot define a new one with it.\n\n# Examples\n\n```rust\n#![feature(concat_idents)]\n\nfn foobar() -> u32 { 23 }\n\nlet f = concat_idents!(foo, bar);\nprintln!(\"{}\", f());\n\n// fn concat_idents!(new, fun, name) { } // not usable in this way!\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat_idents!","insertTextFormat":2,"textEdit":{"newText":"concat_idents!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"write!(…)","kind":3,"detail":"macro_rules! write","documentation":{"kind":"markdown","value":"Writes formatted data into a buffer.\n\nThis macro accepts a 'writer', a format string, and a list of arguments. Arguments will be\nformatted according to the specified format string and the result will be passed to the writer.\nThe writer may be any value with a `write_fmt` method; generally this comes from an\nimplementation of either the [`fmt::Write`] or the [`io::Write`] trait. The macro\nreturns whatever the `write_fmt` method returns; commonly a [`fmt::Result`], or an\n[`io::Result`].\n\nSee [`std::fmt`] for more information on the format string syntax.\n\n[`std::fmt`]: ../std/fmt/index.html\n[`fmt::Write`]: crate::fmt::Write\n[`io::Write`]: ../std/io/trait.Write.html\n[`fmt::Result`]: crate::fmt::Result\n[`io::Result`]: ../std/io/type.Result.html\n\n# Examples\n\n```rust\nuse std::io::Write;\n\nfn main() -> std::io::Result<()> {\n let mut w = Vec::new();\n write!(&mut w, \"test\")?;\n write!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(w, b\"testformatted arguments\");\n Ok(())\n}\n```\n\nA module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects\nimplementing either, as objects do not typically implement both. However, the module must\navoid conflict between the trait names, such as by importing them as `_` or otherwise renaming\nthem:\n\n```rust\nuse std::fmt::Write as _;\nuse std::io::Write as _;\n\nfn main() -> Result<(), Box> {\n let mut s = String::new();\n let mut v = Vec::new();\n\n write!(&mut s, \"{} {}\", \"abc\", 123)?; // uses fmt::Write::write_fmt\n write!(&mut v, \"s = {:?}\", s)?; // uses io::Write::write_fmt\n assert_eq!(v, b\"s = \\\"abc 123\\\"\");\n Ok(())\n}\n```\n\nIf you also need the trait names themselves, such as to implement one or both on your types,\nimport the containing module and then name them with a prefix:\n\n```rust\nuse std::fmt::{self, Write as _};\nuse std::io::{self, Write as _};\n\nstruct Example;\n\nimpl fmt::Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n```\n\nNote: This macro can be used in `no_std` setups as well.\nIn a `no_std` setup you are responsible for the implementation details of the components.\n\n```rust\nuse core::fmt::Write;\n\nstruct Example;\n\nimpl Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n\nlet mut m = Example{};\nwrite!(&mut m, \"Hello World\").expect(\"Not written\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"write!","insertTextFormat":2,"textEdit":{"newText":"write!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"line!(…)","kind":3,"detail":"macro_rules! line","documentation":{"kind":"markdown","value":"Expands to the line number on which it was invoked.\n\nWith [`column!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first line\nin each file evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned line is *not necessarily* the line of the `line!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `line!` macro.\n\n# Examples\n\n```rust\nlet current_line = line!();\nprintln!(\"defined on line: {current_line}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"line!","insertTextFormat":2,"textEdit":{"newText":"line!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"debug_assert!(…)","kind":3,"detail":"macro_rules! debug_assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\nLike [`assert!`], this macro also has a second version, where a custom panic\nmessage can be provided.\n\n# Uses\n\nUnlike [`assert!`], `debug_assert!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert!` is always type checked.\n\nAn unchecked assertion allows a program in an inconsistent state to keep\nrunning, which might have unexpected consequences but does not introduce\nunsafety as long as this only happens in safe code. The performance cost\nof assertions, however, is not measurable in general. Replacing [`assert!`]\nwith `debug_assert!` is thus only encouraged after thorough profiling, and\nmore importantly, only in safe code!\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\ndebug_assert!(true);\n\nfn some_expensive_computation() -> bool { true } // a very simple function\ndebug_assert!(some_expensive_computation());\n\n// assert with a custom message\nlet x = true;\ndebug_assert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\ndebug_assert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert!","insertTextFormat":2,"textEdit":{"newText":"debug_assert!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"include_bytes!(…)","kind":3,"detail":"macro_rules! include_bytes","documentation":{"kind":"markdown","value":"Includes a file as a reference to a byte array.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static [u8; N]` which is\nthe contents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let bytes = include_bytes!(\"spanish.in\");\n assert_eq!(bytes, b\"adi\\xc3\\xb3s\\n\");\n print!(\"{}\", String::from_utf8_lossy(bytes));\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include_bytes!","insertTextFormat":2,"textEdit":{"newText":"include_bytes!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"const_format_args!(…)","kind":3,"detail":"macro_rules! const_format_args","documentation":{"kind":"markdown","value":"Same as [`format_args`], but can be used in some const contexts.\n\nThis macro is used by the panic macros for the `const_panic` feature.\n\nThis macro will be removed once `format_args` is allowed in const contexts."},"deprecated":false,"sortText":"ffffffef","filterText":"const_format_args!","insertTextFormat":2,"textEdit":{"newText":"const_format_args!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"env!(…)","kind":3,"detail":"macro_rules! env","documentation":{"kind":"markdown","value":"Inspects an environment variable at compile time.\n\nThis macro will expand to the value of the named environment variable at\ncompile time, yielding an expression of type `&'static str`. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nIf the environment variable is not defined, then a compilation error\nwill be emitted. To not emit a compile error, use the [`option_env!`]\nmacro instead.\n\n# Examples\n\n```rust\nlet path: &'static str = env!(\"PATH\");\nprintln!(\"the $PATH variable at the time of compiling was: {path}\");\n```\n\nYou can customize the error message by passing a string as the second\nparameter:\n\n```rust\nlet doc: &'static str = env!(\"documentation\", \"what's that?!\");\n```\n\nIf the `documentation` environment variable is not defined, you'll get\nthe following error:\n\n```text\nerror: what's that?!\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"env!","insertTextFormat":2,"textEdit":{"newText":"env!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"try!(…)","kind":3,"detail":"macro_rules! r#try","documentation":{"kind":"markdown","value":"Unwraps a result or propagates its error.\n\nThe [`?` operator][propagating-errors] was added to replace `try!`\nand should be used instead. Furthermore, `try` is a reserved word\nin Rust 2018, so if you must use it, you will need to use the\n[raw-identifier syntax][ris]: `r#try`.\n\n[propagating-errors]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator\n[ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html\n\n`try!` matches the given [`Result`]. In case of the `Ok` variant, the\nexpression has the value of the wrapped value.\n\nIn case of the `Err` variant, it retrieves the inner error. `try!` then\nperforms conversion using `From`. This provides automatic conversion\nbetween specialized errors and more general ones. The resulting\nerror is then immediately returned.\n\nBecause of the early return, `try!` can only be used in functions that\nreturn [`Result`].\n\n# Examples\n\n```rust\nuse std::io;\nuse std::fs::File;\nuse std::io::prelude::*;\n\nenum MyError {\n FileWriteError\n}\n\nimpl From for MyError {\n fn from(e: io::Error) -> MyError {\n MyError::FileWriteError\n }\n}\n\n// The preferred method of quick returning Errors\nfn write_to_file_question() -> Result<(), MyError> {\n let mut file = File::create(\"my_best_friends.txt\")?;\n file.write_all(b\"This is a list of my best friends.\")?;\n Ok(())\n}\n\n// The previous method of quick returning Errors\nfn write_to_file_using_try() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n r#try!(file.write_all(b\"This is a list of my best friends.\"));\n Ok(())\n}\n\n// This is equivalent to:\nfn write_to_file_using_match() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n match file.write_all(b\"This is a list of my best friends.\") {\n Ok(v) => v,\n Err(e) => return Err(From::from(e)),\n }\n Ok(())\n}\n```"},"deprecated":true,"sortText":"ffffffef","filterText":"try!","insertTextFormat":2,"textEdit":{"newText":"r#try!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[],"tags":[1]},{"label":"file!(…)","kind":3,"detail":"macro_rules! file","documentation":{"kind":"markdown","value":"Expands to the file name in which it was invoked.\n\nWith [`line!`] and [`column!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `&'static str`, and the returned file\nis not the invocation of the `file!` macro itself, but rather the\nfirst macro invocation leading up to the invocation of the `file!`\nmacro.\n\n# Examples\n\n```rust\nlet this_file = file!();\nprintln!(\"defined in file: {this_file}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"file!","insertTextFormat":2,"textEdit":{"newText":"file!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"thread_local! {…}","kind":3,"detail":"macro_rules! thread_local","documentation":{"kind":"markdown","value":"Declare a new thread local storage key of type [`std::thread::LocalKey`].\n\n# Syntax\n\nThe macro wraps any number of static declarations and makes them thread local.\nPublicity and attributes for each static are allowed. Example:\n\n```rust\nuse std::cell::RefCell;\nthread_local! {\n pub static FOO: RefCell = RefCell::new(1);\n\n static BAR: RefCell = RefCell::new(1.0);\n}\n\nFOO.with(|foo| assert_eq!(*foo.borrow(), 1));\nBAR.with(|bar| assert_eq!(*bar.borrow(), 1.0));\n```\n\nThis macro supports a special `const {}` syntax that can be used\nwhen the initialization expression can be evaluated as a constant.\nThis can enable a more efficient thread local implementation that\ncan avoid lazy initialization. For types that do not\n[need to be dropped][crate::mem::needs_drop], this can enable an\neven more efficient implementation that does not need to\ntrack any additional state.\n\n```rust\nuse std::cell::Cell;\nthread_local! {\n pub static FOO: Cell = const { Cell::new(1) };\n}\n\nFOO.with(|foo| assert_eq!(foo.get(), 1));\n```\n\nSee [`LocalKey` documentation][`std::thread::LocalKey`] for more\ninformation.\n\n[`std::thread::LocalKey`]: crate::thread::LocalKey"},"deprecated":false,"sortText":"ffffffef","filterText":"thread_local!","insertTextFormat":2,"textEdit":{"newText":"thread_local! {$0}","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"assert!(…)","kind":3,"detail":"macro_rules! assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\n# Uses\n\nAssertions are always checked in both debug and release builds, and cannot\nbe disabled. See [`debug_assert!`] for assertions that are not enabled in\nrelease builds by default.\n\nUnsafe code may rely on `assert!` to enforce run-time invariants that, if\nviolated could lead to unsafety.\n\nOther use-cases of `assert!` include testing and enforcing run-time\ninvariants in safe code (whose violation cannot result in unsafety).\n\n# Custom Messages\n\nThis macro has a second form, where a custom panic message can\nbe provided with or without arguments for formatting. See [`std::fmt`]\nfor syntax for this form. Expressions used as format arguments will only\nbe evaluated if the assertion fails.\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\nassert!(true);\n\nfn some_computation() -> bool { true } // a very simple function\n\nassert!(some_computation());\n\n// assert with a custom message\nlet x = true;\nassert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\nassert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert!","insertTextFormat":2,"textEdit":{"newText":"assert!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"column!(…)","kind":3,"detail":"macro_rules! column","documentation":{"kind":"markdown","value":"Expands to the column number at which it was invoked.\n\nWith [`line!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first column\nin each line evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned column is *not necessarily* the line of the `column!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `column!` macro.\n\n# Examples\n\n```rust\nlet current_col = column!();\nprintln!(\"defined on column: {current_col}\");\n```\n\n`column!` counts Unicode code points, not bytes or graphemes. As a result, the first two\ninvocations return the same value, but the third does not.\n\n```rust\nlet a = (\"foobar\", column!()).1;\nlet b = (\"人之初性本善\", column!()).1;\nlet c = (\"f̅o̅o̅b̅a̅r̅\", column!()).1; // Uses combining overline (U+0305)\n\nassert_eq!(a, b);\nassert_ne!(b, c);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"column!","insertTextFormat":2,"textEdit":{"newText":"column!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"format_args_nl!(…)","kind":3,"detail":"macro_rules! format_args_nl","documentation":{"kind":"markdown","value":"Same as [`format_args`], but adds a newline in the end."},"deprecated":false,"sortText":"ffffffef","filterText":"format_args_nl!","insertTextFormat":2,"textEdit":{"newText":"format_args_nl!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"unreachable!(…)","kind":3,"detail":"macro_rules! unreachable","documentation":{"kind":"markdown","value":"Indicates unreachable code.\n\nThis is useful any time that the compiler can't determine that some code is unreachable. For\nexample:\n\n* Match arms with guard conditions.\n* Loops that dynamically terminate.\n* Iterators that dynamically terminate.\n\nIf the determination that the code is unreachable proves incorrect, the\nprogram immediately terminates with a [`panic!`].\n\nThe unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which\nwill cause undefined behavior if the code is reached.\n\n[`unreachable_unchecked`]: crate::hint::unreachable_unchecked\n\n# Panics\n\nThis will always [`panic!`] because `unreachable!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nMatch arms:\n\n```rust\nfn foo(x: Option) {\n match x {\n Some(n) if n >= 0 => println!(\"Some(Non-negative)\"),\n Some(n) if n < 0 => println!(\"Some(Negative)\"),\n Some(_) => unreachable!(), // compile error if commented out\n None => println!(\"None\")\n }\n}\n```\n\nIterators:\n\n```rust\nfn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3\n for i in 0.. {\n if 3*i < i { panic!(\"u32 overflow\"); }\n if x < 3*i { return i-1; }\n }\n unreachable!(\"The loop should always return\");\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"unreachable!","insertTextFormat":2,"textEdit":{"newText":"unreachable!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"eprintln!(…)","kind":3,"detail":"macro_rules! eprintln","documentation":{"kind":"markdown","value":"Prints to the standard error, with a newline.\n\nEquivalent to the [`println!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`println!`] for\nexample usage.\n\nUse `eprintln!` only for error and progress messages. Use `println!`\ninstead for the primary output of your program.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n[`println!`]: crate::println\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprintln!(\"Error: Could not complete task\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"eprintln!","insertTextFormat":2,"textEdit":{"newText":"eprintln!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"unimplemented!(…)","kind":3,"detail":"macro_rules! unimplemented","documentation":{"kind":"markdown","value":"Indicates unimplemented code by panicking with a message of \"not implemented\".\n\nThis allows your code to type-check, which is useful if you are prototyping or\nimplementing a trait that requires multiple methods which you don't plan to use all of.\n\nThe difference between `unimplemented!` and [`todo!`] is that while `todo!`\nconveys an intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `unimplemented!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n[`todo!`]: crate::todo\n\n# Examples\n\nSay we have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` for 'MyStruct', but for some reason it only makes sense\nto implement the `bar()` function. `baz()` and `qux()` will still need to be defined\nin our implementation of `Foo`, but we can use `unimplemented!` in their definitions\nto allow our code to compile.\n\nWe still want to have our program stop running if the unimplemented methods are\nreached.\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // It makes no sense to `baz` a `MyStruct`, so we have no logic here\n // at all.\n // This will display \"thread 'main' panicked at 'not implemented'\".\n unimplemented!();\n }\n\n fn qux(&self) -> Result {\n // We have some logic here,\n // We can add a message to unimplemented! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not implemented: MyStruct isn't quxable'\".\n unimplemented!(\"MyStruct isn't quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"unimplemented!","insertTextFormat":2,"textEdit":{"newText":"unimplemented!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"cfg!(…)","kind":3,"detail":"macro_rules! cfg","documentation":{"kind":"markdown","value":"Evaluates boolean combinations of configuration flags at compile-time.\n\nIn addition to the `#[cfg]` attribute, this macro is provided to allow\nboolean expression evaluation of configuration flags. This frequently\nleads to less duplicated code.\n\nThe syntax given to this macro is the same syntax as the [`cfg`]\nattribute.\n\n`cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For\nexample, all blocks in an if/else expression need to be valid when `cfg!` is used for\nthe condition, regardless of what `cfg!` is evaluating.\n\n[`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute\n\n# Examples\n\n```rust\nlet my_directory = if cfg!(windows) {\n \"windows-specific-directory\"\n} else {\n \"unix-directory\"\n};\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"cfg!","insertTextFormat":2,"textEdit":{"newText":"cfg!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"todo!(…)","kind":3,"detail":"macro_rules! todo","documentation":{"kind":"markdown","value":"Indicates unfinished code.\n\nThis can be useful if you are prototyping and just\nwant a placeholder to let your code pass type analysis.\n\nThe difference between [`unimplemented!`] and `todo!` is that while `todo!` conveys\nan intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `todo!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nHere's an example of some in-progress code. We have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` on one of our types, but we also want to work on\njust `bar()` first. In order for our code to compile, we need to implement\n`baz()` and `qux()`, so we can use `todo!`:\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // Let's not worry about implementing baz() for now\n todo!();\n }\n\n fn qux(&self) -> Result {\n // We can add a message to todo! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not yet implemented: MyStruct is not yet quxable'\".\n todo!(\"MyStruct is not yet quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n\n // We aren't even using baz() or qux(), so this is fine.\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"todo!","insertTextFormat":2,"textEdit":{"newText":"todo!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"trace_macros!(…)","kind":3,"detail":"macro_rules! trace_macros","documentation":{"kind":"markdown","value":"Enables or disables tracing functionality used for debugging other macros."},"deprecated":false,"sortText":"ffffffef","filterText":"trace_macros!","insertTextFormat":2,"textEdit":{"newText":"trace_macros!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"module_path!(…)","kind":3,"detail":"macro_rules! module_path","documentation":{"kind":"markdown","value":"Expands to a string that represents the current module path.\n\nThe current module path can be thought of as the hierarchy of modules\nleading back up to the crate root. The first component of the path\nreturned is the name of the crate currently being compiled.\n\n# Examples\n\n```rust\nmod test {\n pub fn foo() {\n assert!(module_path!().ends_with(\"test\"));\n }\n}\n\ntest::foo();\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"module_path!","insertTextFormat":2,"textEdit":{"newText":"module_path!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"option_env!(…)","kind":3,"detail":"macro_rules! option_env","documentation":{"kind":"markdown","value":"Optionally inspects an environment variable at compile time.\n\nIf the named environment variable is present at compile time, this will\nexpand into an expression of type `Option<&'static str>` whose value is\n`Some` of the value of the environment variable. If the environment\nvariable is not present, then this will expand to `None`. See\n[`Option`][Option] for more information on this type. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nA compile time error is never emitted when using this macro regardless\nof whether the environment variable is present or not.\nTo emit a compile error if the environment variable is not present,\nuse the [`env!`] macro instead.\n\n# Examples\n\n```rust\nlet key: Option<&'static str> = option_env!(\"SECRET_KEY\");\nprintln!(\"the secret key might be: {key:?}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"option_env!","insertTextFormat":2,"textEdit":{"newText":"option_env!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"writeln!(…)","kind":3,"detail":"macro_rules! writeln","documentation":{"kind":"markdown","value":"Write formatted data into a buffer, with a newline appended.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`).\n\nFor more information, see [`write!`]. For information on the format string syntax, see\n[`std::fmt`].\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\nuse std::io::{Write, Result};\n\nfn main() -> Result<()> {\n let mut w = Vec::new();\n writeln!(&mut w)?;\n writeln!(&mut w, \"test\")?;\n writeln!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(&w[..], \"\\ntest\\nformatted arguments\\n\".as_bytes());\n Ok(())\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"writeln!","insertTextFormat":2,"textEdit":{"newText":"writeln!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"assert_eq!(…)","kind":3,"detail":"macro_rules! assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\nassert_eq!(a, b);\n\nassert_eq!(a, b, \"we are testing addition with {} and {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert_eq!","insertTextFormat":2,"textEdit":{"newText":"assert_eq!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"compile_error!(…)","kind":3,"detail":"macro_rules! compile_error","documentation":{"kind":"markdown","value":"Causes compilation to fail with the given error message when encountered.\n\nThis macro should be used when a crate uses a conditional compilation strategy to provide\nbetter error messages for erroneous conditions. It's the compiler-level form of [`panic!`],\nbut emits an error during *compilation* rather than at *runtime*.\n\n# Examples\n\nTwo such examples are macros and `#[cfg]` environments.\n\nEmit a better compiler error if a macro is passed invalid values. Without the final branch,\nthe compiler would still emit an error, but the error's message would not mention the two\nvalid values.\n\n```rust\nmacro_rules! give_me_foo_or_bar {\n (foo) => {};\n (bar) => {};\n ($x:ident) => {\n compile_error!(\"This macro only accepts `foo` or `bar`\");\n }\n}\n\ngive_me_foo_or_bar!(neither);\n// ^ will fail at compile time with message \"This macro only accepts `foo` or `bar`\"\n```\n\nEmit a compiler error if one of a number of features isn't available.\n\n```rust\n#[cfg(not(any(feature = \"foo\", feature = \"bar\")))]\ncompile_error!(\"Either feature \\\"foo\\\" or \\\"bar\\\" must be enabled for this crate.\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"compile_error!","insertTextFormat":2,"textEdit":{"newText":"compile_error!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"matches!(…)","kind":3,"detail":"macro_rules! matches","documentation":{"kind":"markdown","value":"Returns whether the given expression matches any of the given patterns.\n\nLike in a `match` expression, the pattern can be optionally followed by `if`\nand a guard expression that has access to names bound by the pattern.\n\n# Examples\n\n```rust\nlet foo = 'f';\nassert!(matches!(foo, 'A'..='Z' | 'a'..='z'));\n\nlet bar = Some(4);\nassert!(matches!(bar, Some(x) if x > 2));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"matches!","insertTextFormat":2,"textEdit":{"newText":"matches!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"format_args!(…)","kind":3,"detail":"macro_rules! format_args","documentation":{"kind":"markdown","value":"Constructs parameters for the other string-formatting macros.\n\nThis macro functions by taking a formatting string literal containing\n`{}` for each additional argument passed. `format_args!` prepares the\nadditional parameters to ensure the output can be interpreted as a string\nand canonicalizes the arguments into a single type. Any value that implements\nthe [`Display`] trait can be passed to `format_args!`, as can any\n[`Debug`] implementation be passed to a `{:?}` within the formatting string.\n\nThis macro produces a value of type [`fmt::Arguments`]. This value can be\npassed to the macros within [`std::fmt`] for performing useful redirection.\nAll other formatting macros ([`format!`], [`write!`], [`println!`], etc) are\nproxied through this one. `format_args!`, unlike its derived macros, avoids\nheap allocations.\n\nYou can use the [`fmt::Arguments`] value that `format_args!` returns\nin `Debug` and `Display` contexts as seen below. The example also shows\nthat `Debug` and `Display` format to the same thing: the interpolated\nformat string in `format_args!`.\n\n```rust\nlet debug = format!(\"{:?}\", format_args!(\"{} foo {:?}\", 1, 2));\nlet display = format!(\"{}\", format_args!(\"{} foo {:?}\", 1, 2));\nassert_eq!(\"1 foo 2\", display);\nassert_eq!(display, debug);\n```\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax, and further information.\n\n[`Display`]: crate::fmt::Display\n[`Debug`]: crate::fmt::Debug\n[`fmt::Arguments`]: crate::fmt::Arguments\n[`std::fmt`]: ../std/fmt/index.html\n[`format!`]: ../std/macro.format.html\n[`println!`]: ../std/macro.println.html\n\n# Examples\n\n```rust\nuse std::fmt;\n\nlet s = fmt::format(format_args!(\"hello {}\", \"world\"));\nassert_eq!(s, format!(\"hello {}\", \"world\"));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"format_args!","insertTextFormat":2,"textEdit":{"newText":"format_args!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"is_x86_feature_detected!(…)","kind":3,"detail":"macro_rules! is_x86_feature_detected","documentation":{"kind":"markdown","value":"A macro to test at *runtime* whether a CPU feature is available on\nx86/x86-64 platforms.\n\nThis macro is provided in the standard library and will detect at runtime\nwhether the specified CPU feature is detected. This does **not** resolve at\ncompile time unless the specified feature is already enabled for the entire\ncrate. Runtime detection currently relies mostly on the `cpuid` instruction.\n\nThis macro only takes one argument which is a string literal of the feature\nbeing tested for. The feature names supported are the lowercase versions of\nthe ones defined by Intel in [their documentation][docs].\n\n## Supported arguments\n\nThis macro supports the same names that `#[target_feature]` supports. Unlike\n`#[target_feature]`, however, this macro does not support names separated\nwith a comma. Instead testing for multiple features must be done through\nseparate macro invocations for now.\n\nSupported arguments are:\n\n* `\"aes\"`\n* `\"pclmulqdq\"`\n* `\"rdrand\"`\n* `\"rdseed\"`\n* `\"tsc\"`\n* `\"mmx\"`\n* `\"sse\"`\n* `\"sse2\"`\n* `\"sse3\"`\n* `\"ssse3\"`\n* `\"sse4.1\"`\n* `\"sse4.2\"`\n* `\"sse4a\"`\n* `\"sha\"`\n* `\"avx\"`\n* `\"avx2\"`\n* `\"avx512f\"`\n* `\"avx512cd\"`\n* `\"avx512er\"`\n* `\"avx512pf\"`\n* `\"avx512bw\"`\n* `\"avx512dq\"`\n* `\"avx512vl\"`\n* `\"avx512ifma\"`\n* `\"avx512vbmi\"`\n* `\"avx512vpopcntdq\"`\n* `\"avx512vbmi2\"`\n* `\"gfni\"`\n* `\"vaes\"`\n* `\"vpclmulqdq\"`\n* `\"avx512vnni\"`\n* `\"avx512bitalg\"`\n* `\"avx512bf16\"`\n* `\"avx512vp2intersect\"`\n* `\"f16c\"`\n* `\"fma\"`\n* `\"bmi1\"`\n* `\"bmi2\"`\n* `\"abm\"`\n* `\"lzcnt\"`\n* `\"tbm\"`\n* `\"popcnt\"`\n* `\"fxsr\"`\n* `\"xsave\"`\n* `\"xsaveopt\"`\n* `\"xsaves\"`\n* `\"xsavec\"`\n* `\"cmpxchg16b\"`\n* `\"adx\"`\n* `\"rtm\"`\n* `\"movbe\"`\n* `\"ermsb\"`\n\n[docs]: https://software.intel.com/sites/landingpage/IntrinsicsGuide"},"deprecated":false,"sortText":"ffffffef","filterText":"is_x86_feature_detected!","insertTextFormat":2,"textEdit":{"newText":"is_x86_feature_detected!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"concat_bytes!(…)","kind":3,"detail":"macro_rules! concat_bytes","documentation":{"kind":"markdown","value":"Concatenates literals into a byte slice.\n\nThis macro takes any number of comma-separated literals, and concatenates them all into\none, yielding an expression of type `&[u8; _]`, which represents all of the literals\nconcatenated left-to-right. The literals passed can be any combination of:\n\n- byte literals (`b'r'`)\n- byte strings (`b\"Rust\"`)\n- arrays of bytes/numbers (`[b'A', 66, b'C']`)\n\n# Examples\n\n```rust\n#![feature(concat_bytes)]\n\nlet s: &[u8; 6] = concat_bytes!(b'A', b\"BC\", [68, b'E', 70]);\nassert_eq!(s, b\"ABCDEF\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat_bytes!","insertTextFormat":2,"textEdit":{"newText":"concat_bytes!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"eprint!(…)","kind":3,"detail":"macro_rules! eprint","documentation":{"kind":"markdown","value":"Prints to the standard error.\n\nEquivalent to the [`print!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`print!`] for\nexample usage.\n\nUse `eprint!` only for error and progress messages. Use `print!`\ninstead for the primary output of your program.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprint!(\"Error: Could not complete task\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"eprint!","insertTextFormat":2,"textEdit":{"newText":"eprint!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"debug_assert_ne!(…)","kind":3,"detail":"macro_rules! debug_assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_ne!`], `debug_assert_ne!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_ne!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_ne!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_ne!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\ndebug_assert_ne!(a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert_ne!","insertTextFormat":2,"textEdit":{"newText":"debug_assert_ne!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"std","kind":9,"documentation":{"kind":"markdown","value":"# The Rust Standard Library\n\nThe Rust Standard Library is the foundation of portable Rust software, a\nset of minimal and battle-tested shared abstractions for the [broader Rust\necosystem][crates.io]. It offers core types, like [`Vec`] and\n[`Option`], library-defined [operations on language\nprimitives](#primitives), [standard macros](#macros), [I/O] and\n[multithreading], among [many other things][other].\n\n`std` is available to all Rust crates by default. Therefore, the\nstandard library can be accessed in [`use`] statements through the path\n`std`, as in [`use std::env`].\n\n# How to read this documentation\n\nIf you already know the name of what you are looking for, the fastest way to\nfind it is to use the search\nbar at the top of the page.\n\nOtherwise, you may want to jump to one of these useful sections:\n\n* [`std::*` modules](#modules)\n* [Primitive types](#primitives)\n* [Standard macros](#macros)\n* [The Rust Prelude]\n\nIf this is your first time, the documentation for the standard library is\nwritten to be casually perused. Clicking on interesting things should\ngenerally lead you to interesting places. Still, there are important bits\nyou don't want to miss, so read on for a tour of the standard library and\nits documentation!\n\nOnce you are familiar with the contents of the standard library you may\nbegin to find the verbosity of the prose distracting. At this stage in your\ndevelopment you may want to press the `[-]` button near the top of the\npage to collapse it into a more skimmable view.\n\nWhile you are looking at that `[-]` button also notice the `source`\nlink. Rust's API documentation comes with the source code and you are\nencouraged to read it. The standard library source is generally high\nquality and a peek behind the curtains is often enlightening.\n\n# What is in the standard library documentation?\n\nFirst of all, The Rust Standard Library is divided into a number of focused\nmodules, [all listed further down this page](#modules). These modules are\nthe bedrock upon which all of Rust is forged, and they have mighty names\nlike [`std::slice`] and [`std::cmp`]. Modules' documentation typically\nincludes an overview of the module along with examples, and are a smart\nplace to start familiarizing yourself with the library.\n\nSecond, implicit methods on [primitive types] are documented here. This can\nbe a source of confusion for two reasons:\n\n1. While primitives are implemented by the compiler, the standard library\n implements methods directly on the primitive types (and it is the only\n library that does so), which are [documented in the section on\n primitives](#primitives).\n2. The standard library exports many modules *with the same name as\n primitive types*. These define additional items related to the primitive\n type, but not the all-important methods.\n\nSo for example there is a [page for the primitive type\n`i32`](primitive::i32) that lists all the methods that can be called on\n32-bit integers (very useful), and there is a [page for the module\n`std::i32`] that documents the constant values [`MIN`] and [`MAX`] (rarely\nuseful).\n\nNote the documentation for the primitives [`str`] and [`[T]`][prim@slice] (also\ncalled 'slice'). Many method calls on [`String`] and [`Vec`] are actually\ncalls to methods on [`str`] and [`[T]`][prim@slice] respectively, via [deref\ncoercions][deref-coercions].\n\nThird, the standard library defines [The Rust Prelude], a small collection\nof items - mostly traits - that are imported into every module of every\ncrate. The traits in the prelude are pervasive, making the prelude\ndocumentation a good entry point to learning about the library.\n\nAnd finally, the standard library exports a number of standard macros, and\n[lists them on this page](#macros) (technically, not all of the standard\nmacros are defined by the standard library - some are defined by the\ncompiler - but they are documented here the same). Like the prelude, the\nstandard macros are imported by default into all crates.\n\n# Contributing changes to the documentation\n\nCheck out the rust contribution guidelines [here](\nhttps://rustc-dev-guide.rust-lang.org/contributing.html#writing-documentation).\nThe source for this documentation can be found on\n[GitHub](https://github.com/rust-lang/rust).\nTo contribute changes, make sure you read the guidelines first, then submit\npull-requests for your suggested changes.\n\nContributions are appreciated! If you see a part of the docs that can be\nimproved, submit a PR, or chat with us first on [Discord][rust-discord]\n#docs.\n\n# A Tour of The Rust Standard Library\n\nThe rest of this crate documentation is dedicated to pointing out notable\nfeatures of The Rust Standard Library.\n\n## Containers and collections\n\nThe [`option`] and [`result`] modules define optional and error-handling\ntypes, [`Option`] and [`Result`]. The [`iter`] module defines\nRust's iterator trait, [`Iterator`], which works with the [`for`] loop to\naccess collections.\n\nThe standard library exposes three common ways to deal with contiguous\nregions of memory:\n\n* [`Vec`] - A heap-allocated *vector* that is resizable at runtime.\n* [`[T; N]`][prim@array] - An inline *array* with a fixed size at compile time.\n* [`[T]`][prim@slice] - A dynamically sized *slice* into any other kind of contiguous\n storage, whether heap-allocated or not.\n\nSlices can only be handled through some kind of *pointer*, and as such come\nin many flavors such as:\n\n* `&[T]` - *shared slice*\n* `&mut [T]` - *mutable slice*\n* [`Box<[T]>`][owned slice] - *owned slice*\n\n[`str`], a UTF-8 string slice, is a primitive type, and the standard library\ndefines many methods for it. Rust [`str`]s are typically accessed as\nimmutable references: `&str`. Use the owned [`String`] for building and\nmutating strings.\n\nFor converting to strings use the [`format!`] macro, and for converting from\nstrings use the [`FromStr`] trait.\n\nData may be shared by placing it in a reference-counted box or the [`Rc`]\ntype, and if further contained in a [`Cell`] or [`RefCell`], may be mutated\nas well as shared. Likewise, in a concurrent setting it is common to pair an\natomically-reference-counted box, [`Arc`], with a [`Mutex`] to get the same\neffect.\n\nThe [`collections`] module defines maps, sets, linked lists and other\ntypical collection types, including the common [`HashMap`].\n\n## Platform abstractions and I/O\n\nBesides basic data types, the standard library is largely concerned with\nabstracting over differences in common platforms, most notably Windows and\nUnix derivatives.\n\nCommon types of I/O, including [files], [TCP], and [UDP], are defined in\nthe [`io`], [`fs`], and [`net`] modules.\n\nThe [`thread`] module contains Rust's threading abstractions. [`sync`]\ncontains further primitive shared memory types, including [`atomic`] and\n[`mpsc`], which contains the channel types for message passing.\n\n# Use before and after `main()`\n\nMany parts of the standard library are expected to work before and after `main()`;\nbut this is not guaranteed or ensured by tests. It is recommended that you write your own tests\nand run them on each platform you wish to support.\nThis means that use of `std` before/after main, especially of features that interact with the\nOS or global state, is exempted from stability and portability guarantees and instead only\nprovided on a best-effort basis. Nevertheless bug reports are appreciated.\n\nOn the other hand `core` and `alloc` are most likely to work in such environments with\nthe caveat that any hookable behavior such as panics, oom handling or allocators will also\ndepend on the compatibility of the hooks.\n\nSome features may also behave differently outside main, e.g. stdio could become unbuffered,\nsome panics might turn into aborts, backtraces might not get symbolicated or similar.\n\nNon-exhaustive list of known limitations:\n\n- after-main use of thread-locals, which also affects additional features:\n - [`thread::current()`]\n - [`thread::scope()`]\n - [`sync::mpsc`]\n- before-main stdio file descriptors are not guaranteed to be open on unix platforms\n\n\n[I/O]: io\n[`MIN`]: i32::MIN\n[`MAX`]: i32::MAX\n[page for the module `std::i32`]: crate::i32\n[TCP]: net::TcpStream\n[The Rust Prelude]: prelude\n[UDP]: net::UdpSocket\n[`Arc`]: sync::Arc\n[owned slice]: boxed\n[`Cell`]: cell::Cell\n[`FromStr`]: str::FromStr\n[`HashMap`]: collections::HashMap\n[`Mutex`]: sync::Mutex\n[`Option`]: option::Option\n[`Rc`]: rc::Rc\n[`RefCell`]: cell::RefCell\n[`Result`]: result::Result\n[`Vec`]: vec::Vec\n[`atomic`]: sync::atomic\n[`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for\n[`str`]: prim@str\n[`mpsc`]: sync::mpsc\n[`std::cmp`]: cmp\n[`std::slice`]: mod@slice\n[`use std::env`]: env/index.html\n[`use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html\n[crates.io]: https://crates.io\n[deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods\n[files]: fs::File\n[multithreading]: thread\n[other]: #what-is-in-the-standard-library-documentation\n[primitive types]: ../book/ch03-02-data-types.html\n[rust-discord]: https://discord.gg/rust-lang\n[array]: prim@array\n[slice]: prim@slice"},"deprecated":false,"sortText":"ffffffef","filterText":"std","textEdit":{"newText":"std","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"alloc","kind":9,"documentation":{"kind":"markdown","value":"# The Rust core allocation and collections library\n\nThis library provides smart pointers and collections for managing\nheap-allocated values.\n\nThis library, like core, normally doesn’t need to be used directly\nsince its contents are re-exported in the [`std` crate](../std/index.html).\nCrates that use the `#![no_std]` attribute however will typically\nnot depend on `std`, so they’d use this crate instead.\n\n## Boxed values\n\nThe [`Box`] type is a smart pointer type. There can only be one owner of a\n[`Box`], and the owner can decide to mutate the contents, which live on the\nheap.\n\nThis type can be sent among threads efficiently as the size of a `Box` value\nis the same as that of a pointer. Tree-like data structures are often built\nwith boxes because each node often has only one owner, the parent.\n\n## Reference counted pointers\n\nThe [`Rc`] type is a non-threadsafe reference-counted pointer type intended\nfor sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and\nonly allows access to `&T`, a shared reference.\n\nThis type is useful when inherited mutability (such as using [`Box`]) is too\nconstraining for an application, and is often paired with the [`Cell`] or\n[`RefCell`] types in order to allow mutation.\n\n## Atomically reference counted pointers\n\nThe [`Arc`] type is the threadsafe equivalent of the [`Rc`] type. It\nprovides all the same functionality of [`Rc`], except it requires that the\ncontained type `T` is shareable. Additionally, [`Arc`][`Arc`] is itself\nsendable while [`Rc`][`Rc`] is not.\n\nThis type allows for shared access to the contained data, and is often\npaired with synchronization primitives such as mutexes to allow mutation of\nshared resources.\n\n## Collections\n\nImplementations of the most common general purpose data structures are\ndefined in this library. They are re-exported through the\n[standard collections library](../std/collections/index.html).\n\n## Heap interfaces\n\nThe [`alloc`](alloc/index.html) module defines the low-level interface to the\ndefault global allocator. It is not compatible with the libc allocator API.\n\n[`Arc`]: sync\n[`Box`]: boxed\n[`Cell`]: core::cell\n[`Rc`]: rc\n[`RefCell`]: core::cell"},"deprecated":false,"sortText":"ffffffef","filterText":"alloc","textEdit":{"newText":"alloc","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"core","kind":9,"documentation":{"kind":"markdown","value":"# The Rust Core Library\n\nThe Rust Core Library is the dependency-free[^free] foundation of [The\nRust Standard Library](../std/index.html). It is the portable glue\nbetween the language and its libraries, defining the intrinsic and\nprimitive building blocks of all Rust code. It links to no\nupstream libraries, no system libraries, and no libc.\n\n[^free]: Strictly speaking, there are some symbols which are needed but\n they aren't always necessary.\n\nThe core library is *minimal*: it isn't even aware of heap allocation,\nnor does it provide concurrency or I/O. These things require\nplatform integration, and this library is platform-agnostic.\n\n# How to use the core library\n\nPlease note that all of these details are currently not considered stable.\n\nThis library is built on the assumption of a few existing symbols:\n\n* `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines\n which are generated by Rust codegen backends. Additionally, this library can make explicit\n calls to `strlen`. Their signatures are the same as found in C, but there are extra\n assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if\n the `n` parameter is 0, the function is assumed to not be UB, even if the pointers are NULL or\n dangling. (Note that making extra assumptions about these functions is common among compilers:\n [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)\n These functions are often provided by the system libc, but can also be provided by the\n [compiler-builtins crate](https://crates.io/crates/compiler_builtins).\n Note that the library does not guarantee that it will always make these assumptions, so Rust\n user code directly calling the C functions should follow the C specification! The advice for\n Rust user code is to call the functions provided by this library instead (such as\n `ptr::copy`).\n\n* `rust_begin_panic` - This function takes four arguments, a\n `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments\n dictate the panic message, the file at which panic was invoked, and the\n line and column inside the file. It is up to consumers of this core\n library to define this panic function; it is only required to never\n return. This requires a `lang` attribute named `panic_impl`.\n\n* `rust_eh_personality` - is used by the failure mechanisms of the\n compiler. This is often mapped to GCC's personality function, but crates\n which do not trigger a panic can be assured that this function is never\n called. The `lang` attribute is called `eh_personality`."},"deprecated":false,"sortText":"ffffffef","filterText":"core","textEdit":{"newText":"core","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"u32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u32","textEdit":{"newText":"u32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"bool","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"bool","textEdit":{"newText":"bool","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"u8","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u8","textEdit":{"newText":"u8","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"isize","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"isize","textEdit":{"newText":"isize","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"u16","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u16","textEdit":{"newText":"u16","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"u64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u64","textEdit":{"newText":"u64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"u128","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u128","textEdit":{"newText":"u128","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"f32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"f32","textEdit":{"newText":"f32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"i128","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i128","textEdit":{"newText":"i128","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"i16","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i16","textEdit":{"newText":"i16","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"str","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"str","textEdit":{"newText":"str","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"i64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i64","textEdit":{"newText":"i64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"char","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"char","textEdit":{"newText":"char","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"f64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"f64","textEdit":{"newText":"f64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"i32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i32","textEdit":{"newText":"i32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"i8","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i8","textEdit":{"newText":"i8","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"usize","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"usize","textEdit":{"newText":"usize","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"AsMut","kind":8,"documentation":{"kind":"markdown","value":"Used to do a cheap mutable-to-mutable reference conversion.\n\nThis trait is similar to [`AsRef`] but used for converting between mutable\nreferences. If you need to do a costly conversion it is better to\nimplement [`From`] with type `&mut T` or write a custom function.\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsMut` auto-dereferences if the inner type is a mutable reference\n(e.g.: `foo.as_mut()` will work the same if `foo` has type `&mut Foo` or `&mut &mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[mutably dereferenceable types], e.g. `foo.as_mut()` will *not* work the same as\n`Box::new(foo).as_mut()`. Instead, many smart pointers provide an `as_mut` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsMut::as_mut`] should not be\nused for the sole purpose of mutable dereferencing; instead ['`Deref` coercion'] can be used:\n\n[mutably dereferenceable types]: core::ops::DerefMut\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::DerefMut#mutable-deref-coercion\n\n```rust\nlet mut x = Box::new(5i32);\n// Avoid this:\n// let y: &mut i32 = x.as_mut();\n// Better just write:\nlet y: &mut i32 = &mut x;\n```\n\nTypes which implement [`DerefMut`] should consider to add an implementation of `AsMut` as\nfollows:\n\n[`DerefMut`]: core::ops::DerefMut\n\n```rust\nimpl AsMut for SomeType\nwhere\n ::Target: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.deref_mut().as_mut()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsMut` would be reflexive, i.e. there would be an `impl AsMut for T`\nwith [`as_mut`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&mut T where T: AsMut` which allows `AsMut` to auto-dereference, see \"Generic\nImplementations\" above).\n\n[`as_mut`]: AsMut::as_mut\n\nA trivial implementation of `AsMut for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nUsing `AsMut` as trait bound for a generic function, we can accept all mutable references that\ncan be converted to type `&mut T`. Unlike [dereference], which has a single [target type],\nthere can be multiple implementations of `AsMut` for a type. In particular, `Vec` implements\nboth `AsMut>` and `AsMut<[T]>`.\n\nIn the following, the example functions `caesar` and `null_terminate` provide a generic\ninterface which work with any type that can be converted by cheap mutable-to-mutable conversion\ninto a byte slice (`[u8]`) or byte vector (`Vec`), respectively.\n\n[dereference]: core::ops::DerefMut\n[target type]: core::ops::Deref::Target\n\n```rust\nstruct Document {\n info: String,\n content: Vec,\n}\n\nimpl AsMut for Document\nwhere\n Vec: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.content.as_mut()\n }\n}\n\nfn caesar>(data: &mut T, key: u8) {\n for byte in data.as_mut() {\n *byte = byte.wrapping_add(key);\n }\n}\n\nfn null_terminate>>(data: &mut T) {\n // Using a non-generic inner function, which contains most of the\n // functionality, helps to minimize monomorphization overhead.\n fn doit(data: &mut Vec) {\n let len = data.len();\n if len == 0 || data[len-1] != 0 {\n data.push(0);\n }\n }\n doit(data.as_mut());\n}\n\nfn main() {\n let mut v: Vec = vec![1, 2, 3];\n caesar(&mut v, 5);\n assert_eq!(v, [6, 7, 8]);\n null_terminate(&mut v);\n assert_eq!(v, [6, 7, 8, 0]);\n let mut doc = Document {\n info: String::from(\"Example\"),\n content: vec![17, 19, 8],\n };\n caesar(&mut doc, 1);\n assert_eq!(doc.content, [18, 20, 9]);\n null_terminate(&mut doc);\n assert_eq!(doc.content, [18, 20, 9, 0]);\n}\n```\n\nNote, however, that APIs don't need to be generic. In many cases taking a `&mut [u8]` or\n`&mut Vec`, for example, is the better choice (callers need to pass the correct type then)."},"deprecated":false,"sortText":"ffffffef","filterText":"AsMut","textEdit":{"newText":"AsMut","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"AsRef","kind":8,"documentation":{"kind":"markdown","value":"Used to do a cheap reference-to-reference conversion.\n\nThis trait is similar to [`AsMut`] which is used for converting between mutable references.\nIf you need to do a costly conversion it is better to implement [`From`] with type\n`&T` or write a custom function.\n\n# Relation to `Borrow`\n\n`AsRef` has the same signature as [`Borrow`], but [`Borrow`] is different in a few aspects:\n\n- Unlike `AsRef`, [`Borrow`] has a blanket impl for any `T`, and can be used to accept either\n a reference or a value. (See also note on `AsRef`'s reflexibility below.)\n- [`Borrow`] also requires that [`Hash`], [`Eq`] and [`Ord`] for a borrowed value are\n equivalent to those of the owned value. For this reason, if you want to\n borrow only a single field of a struct you can implement `AsRef`, but not [`Borrow`].\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsRef` auto-dereferences if the inner type is a reference or a mutable reference\n(e.g.: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[dereferenceable types], e.g. `foo.as_ref()` will *not* work the same as\n`Box::new(foo).as_ref()`. Instead, many smart pointers provide an `as_ref` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsRef::as_ref`] should not be\nused for the sole purpose of dereferencing; instead ['`Deref` coercion'] can be used:\n\n[dereferenceable types]: core::ops::Deref\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::Deref#deref-coercion\n\n```rust\nlet x = Box::new(5i32);\n// Avoid this:\n// let y: &i32 = x.as_ref();\n// Better just write:\nlet y: &i32 = &x;\n```\n\nTypes which implement [`Deref`] should consider implementing `AsRef` as follows:\n\n[`Deref`]: core::ops::Deref\n\n```rust\nimpl AsRef for SomeType\nwhere\n T: ?Sized,\n ::Target: AsRef,\n{\n fn as_ref(&self) -> &T {\n self.deref().as_ref()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsRef` would be reflexive, i.e. there would be an `impl AsRef for T`\nwith [`as_ref`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&T where T: AsRef` which allows `AsRef` to auto-dereference, see \"Generic Implementations\"\nabove).\n\n[`as_ref`]: AsRef::as_ref\n\nA trivial implementation of `AsRef for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nBy using trait bounds we can accept arguments of different types as long as they can be\nconverted to the specified type `T`.\n\nFor example: By creating a generic function that takes an `AsRef` we express that we\nwant to accept all references that can be converted to [`&str`] as an argument.\nSince both [`String`] and [`&str`] implement `AsRef` we can accept both as input argument.\n\n[`&str`]: primitive@str\n[`Borrow`]: crate::borrow::Borrow\n[`Eq`]: crate::cmp::Eq\n[`Ord`]: crate::cmp::Ord\n[`String`]: ../../std/string/struct.String.html\n\n```rust\nfn is_hello>(s: T) {\n assert_eq!(\"hello\", s.as_ref());\n}\n\nlet s = \"hello\";\nis_hello(s);\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"AsRef","textEdit":{"newText":"AsRef","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Box","kind":22,"documentation":{"kind":"markdown","value":"A pointer type that uniquely owns a heap allocation of type `T`.\n\nSee the [module-level documentation](../../std/boxed/index.html) for more."},"deprecated":false,"sortText":"ffffffef","filterText":"Box","textEdit":{"newText":"Box","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Clone","kind":8,"documentation":{"kind":"markdown","value":"A common trait for the ability to explicitly duplicate an object.\n\nDiffers from [`Copy`] in that [`Copy`] is implicit and an inexpensive bit-wise copy, while\n`Clone` is always explicit and may or may not be expensive. In order to enforce\nthese characteristics, Rust does not allow you to reimplement [`Copy`], but you\nmay reimplement `Clone` and run arbitrary code.\n\nSince `Clone` is more general than [`Copy`], you can automatically make anything\n[`Copy`] be `Clone` as well.\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d\nimplementation of [`Clone`] calls [`clone`] on each field.\n\n[`clone`]: Clone::clone\n\nFor a generic struct, `#[derive]` implements `Clone` conditionally by adding bound `Clone` on\ngeneric parameters.\n\n```rust\n// `derive` implements Clone for Reading when T is Clone.\n#[derive(Clone)]\nstruct Reading {\n frequency: T,\n}\n```\n\n## How can I implement `Clone`?\n\nTypes that are [`Copy`] should have a trivial implementation of `Clone`. More formally:\nif `T: Copy`, `x: T`, and `y: &T`, then `let x = y.clone();` is equivalent to `let x = *y;`.\nManual implementations should be careful to uphold this invariant; however, unsafe code\nmust not rely on it to ensure memory safety.\n\nAn example is a generic struct holding a function pointer. In this case, the\nimplementation of `Clone` cannot be `derive`d, but can be implemented as:\n\n```rust\nstruct Generate(fn() -> T);\n\nimpl Copy for Generate {}\n\nimpl Clone for Generate {\n fn clone(&self) -> Self {\n *self\n }\n}\n```\n\nIf we `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n```\n\nthe auto-derived implementations will have unnecessary `T: Copy` and `T: Clone` bounds:\n\n```rust\n\n// Automatically derived\nimpl Copy for Generate { }\n\n// Automatically derived\nimpl Clone for Generate {\n fn clone(&self) -> Generate {\n Generate(Clone::clone(&self.0))\n }\n}\n```\n\nThe bounds are unnecessary because clearly the function itself should be\ncopy- and cloneable even if its return type is not:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n\nstruct NotCloneable;\n\nfn generate_not_cloneable() -> NotCloneable {\n NotCloneable\n}\n\nGenerate(generate_not_cloneable).clone(); // error: trait bounds were not satisfied\n// Note: With the manual implementations the above line will compile.\n```\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Clone`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Clone` themselves.\n Note that variables captured by shared reference always implement `Clone`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Clone`.\n\n[impls]: #implementors"},"deprecated":false,"sortText":"ffffffef","filterText":"Clone","textEdit":{"newText":"Clone","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Copy","kind":8,"documentation":{"kind":"markdown","value":"Types whose values can be duplicated simply by copying bits.\n\nBy default, variable bindings have 'move semantics.' In other\nwords:\n\n```rust\n#[derive(Debug)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `x` has moved into `y`, and so cannot be used\n\n// println!(\"{x:?}\"); // error: use of moved value\n```\n\nHowever, if a type implements `Copy`, it instead has 'copy semantics':\n\n```rust\n// We can derive a `Copy` implementation. `Clone` is also required, as it's\n// a supertrait of `Copy`.\n#[derive(Debug, Copy, Clone)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `y` is a copy of `x`\n\nprintln!(\"{x:?}\"); // A-OK!\n```\n\nIt's important to note that in these two examples, the only difference is whether you\nare allowed to access `x` after the assignment. Under the hood, both a copy and a move\ncan result in bits being copied in memory, although this is sometimes optimized away.\n\n## How can I implement `Copy`?\n\nThere are two ways to implement `Copy` on your type. The simplest is to use `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct MyStruct;\n```\n\nYou can also implement `Copy` and `Clone` manually:\n\n```rust\nstruct MyStruct;\n\nimpl Copy for MyStruct { }\n\nimpl Clone for MyStruct {\n fn clone(&self) -> MyStruct {\n *self\n }\n}\n```\n\nThere is a small difference between the two: the `derive` strategy will also place a `Copy`\nbound on type parameters, which isn't always desired.\n\n## What's the difference between `Copy` and `Clone`?\n\nCopies happen implicitly, for example as part of an assignment `y = x`. The behavior of\n`Copy` is not overloadable; it is always a simple bit-wise copy.\n\nCloning is an explicit action, `x.clone()`. The implementation of [`Clone`] can\nprovide any type-specific behavior necessary to duplicate values safely. For example,\nthe implementation of [`Clone`] for [`String`] needs to copy the pointed-to string\nbuffer in the heap. A simple bitwise copy of [`String`] values would merely copy the\npointer, leading to a double free down the line. For this reason, [`String`] is [`Clone`]\nbut not `Copy`.\n\n[`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement\n[`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`\n(see the example above).\n\n## When can my type be `Copy`?\n\nA type can implement `Copy` if all of its components implement `Copy`. For example, this\nstruct can be `Copy`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Point {\n x: i32,\n y: i32,\n}\n```\n\nA struct can be `Copy`, and [`i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.\nBy contrast, consider\n\n```rust\nstruct PointList {\n points: Vec,\n}\n```\n\nThe struct `PointList` cannot implement `Copy`, because [`Vec`] is not `Copy`. If we\nattempt to derive a `Copy` implementation, we'll get an error:\n\n```text\nthe trait `Copy` cannot be implemented for this type; field `points` does not implement `Copy`\n```\n\nShared references (`&T`) are also `Copy`, so a type can be `Copy`, even when it holds\nshared references of types `T` that are *not* `Copy`. Consider the following struct,\nwhich can implement `Copy`, because it only holds a *shared reference* to our non-`Copy`\ntype `PointList` from above:\n\n```rust\n#[derive(Copy, Clone)]\nstruct PointListWrapper<'a> {\n point_list_ref: &'a PointList,\n}\n```\n\n## When *can't* my type be `Copy`?\n\nSome types can't be copied safely. For example, copying `&mut T` would create an aliased\nmutable reference. Copying [`String`] would duplicate responsibility for managing the\n[`String`]'s buffer, leading to a double free.\n\nGeneralizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's\nmanaging some resource besides its own [`size_of::`] bytes.\n\nIf you try to implement `Copy` on a struct or enum containing non-`Copy` data, you will get\nthe error [E0204].\n\n[E0204]: ../../error_codes/E0204.html\n\n## When *should* my type be `Copy`?\n\nGenerally speaking, if your type _can_ implement `Copy`, it should. Keep in mind, though,\nthat implementing `Copy` is part of the public API of your type. If the type might become\nnon-`Copy` in the future, it could be prudent to omit the `Copy` implementation now, to\navoid a breaking API change.\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Copy`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Copy` themselves.\n Note that variables captured by shared reference always implement `Copy`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Copy`.\n\n[`Vec`]: ../../std/vec/struct.Vec.html\n[`String`]: ../../std/string/struct.String.html\n[`size_of::`]: crate::mem::size_of\n[impls]: #implementors"},"deprecated":false,"sortText":"ffffffef","filterText":"Copy","textEdit":{"newText":"Copy","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Default","kind":8,"documentation":{"kind":"markdown","value":"A trait for giving a type a useful default value.\n\nSometimes, you want to fall back to some kind of default value, and\ndon't particularly care what it is. This comes up often with `struct`s\nthat define a set of options:\n\n```rust\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```\n\nHow can we define some default values? You can use `Default`:\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n\nfn main() {\n let options: SomeOptions = Default::default();\n}\n```\n\nNow, you get all of the default values. Rust implements `Default` for various primitives types.\n\nIf you want to override a particular option, but still retain the other defaults:\n\n```rust\nfn main() {\n let options = SomeOptions { foo: 42, ..Default::default() };\n}\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all of the type's fields implement\n`Default`. When `derive`d, it will use the default value for each field's type.\n\n### `enum`s\n\nWhen using `#[derive(Default)]` on an `enum`, you need to choose which unit variant will be\ndefault. You do this by placing the `#[default]` attribute on the variant.\n\n```rust\n#[derive(Default)]\nenum Kind {\n #[default]\n A,\n B,\n C,\n}\n```\n\nYou cannot use the `#[default]` attribute on non-unit or non-exhaustive variants.\n\n## How can I implement `Default`?\n\nProvide an implementation for the `default()` method that returns the value of\nyour type that should be the default:\n\n```rust\nenum Kind {\n A,\n B,\n C,\n}\n\nimpl Default for Kind {\n fn default() -> Self { Kind::A }\n}\n```\n\n# Examples\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Default","textEdit":{"newText":"Default","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"DoubleEndedIterator","kind":8,"documentation":{"kind":"markdown","value":"An iterator able to yield elements from both ends.\n\nSomething that implements `DoubleEndedIterator` has one extra capability\nover something that implements [`Iterator`]: the ability to also take\n`Item`s from the back, as well as the front.\n\nIt is important to note that both back and forth work on the same range,\nand do not cross: iteration is over when they meet in the middle.\n\nIn a similar fashion to the [`Iterator`] protocol, once a\n`DoubleEndedIterator` returns [`None`] from a [`next_back()`], calling it\nagain may or may not ever return [`Some`] again. [`next()`] and\n[`next_back()`] are interchangeable for this purpose.\n\n[`next_back()`]: DoubleEndedIterator::next_back\n[`next()`]: Iterator::next\n\n# Examples\n\nBasic usage:\n\n```rust\nlet numbers = vec![1, 2, 3, 4, 5, 6];\n\nlet mut iter = numbers.iter();\n\nassert_eq!(Some(&1), iter.next());\nassert_eq!(Some(&6), iter.next_back());\nassert_eq!(Some(&5), iter.next_back());\nassert_eq!(Some(&2), iter.next());\nassert_eq!(Some(&3), iter.next());\nassert_eq!(Some(&4), iter.next());\nassert_eq!(None, iter.next());\nassert_eq!(None, iter.next_back());\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"DoubleEndedIterator","textEdit":{"newText":"DoubleEndedIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Drop","kind":8,"documentation":{"kind":"markdown","value":"Custom code within the destructor.\n\nWhen a value is no longer needed, Rust will run a \"destructor\" on that value.\nThe most common way that a value is no longer needed is when it goes out of\nscope. Destructors may still run in other circumstances, but we're going to\nfocus on scope for the examples here. To learn about some of those other cases,\nplease see [the reference] section on destructors.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\nThis destructor consists of two components:\n- A call to `Drop::drop` for that value, if this special `Drop` trait is implemented for its type.\n- The automatically generated \"drop glue\" which recursively calls the destructors\n of all the fields of this value.\n\nAs Rust automatically calls the destructors of all contained fields,\nyou don't have to implement `Drop` in most cases. But there are some cases where\nit is useful, for example for types which directly manage a resource.\nThat resource may be memory, it may be a file descriptor, it may be a network socket.\nOnce a value of that type is no longer going to be used, it should \"clean up\" its\nresource by freeing the memory or closing the file or socket. This is\nthe job of a destructor, and therefore the job of `Drop::drop`.\n\n## Examples\n\nTo see destructors in action, let's take a look at the following program:\n\n```rust\nstruct HasDrop;\n\nimpl Drop for HasDrop {\n fn drop(&mut self) {\n println!(\"Dropping HasDrop!\");\n }\n}\n\nstruct HasTwoDrops {\n one: HasDrop,\n two: HasDrop,\n}\n\nimpl Drop for HasTwoDrops {\n fn drop(&mut self) {\n println!(\"Dropping HasTwoDrops!\");\n }\n}\n\nfn main() {\n let _x = HasTwoDrops { one: HasDrop, two: HasDrop };\n println!(\"Running!\");\n}\n```\n\nRust will first call `Drop::drop` for `_x` and then for both `_x.one` and `_x.two`,\nmeaning that running this will print\n\n```text\nRunning!\nDropping HasTwoDrops!\nDropping HasDrop!\nDropping HasDrop!\n```\n\nEven if we remove the implementation of `Drop` for `HasTwoDrop`, the destructors of its fields are still called.\nThis would result in\n\n```test\nRunning!\nDropping HasDrop!\nDropping HasDrop!\n```\n\n## You cannot call `Drop::drop` yourself\n\nBecause `Drop::drop` is used to clean up a value, it may be dangerous to use this value after\nthe method has been called. As `Drop::drop` does not take ownership of its input,\nRust prevents misuse by not allowing you to call `Drop::drop` directly.\n\nIn other words, if you tried to explicitly call `Drop::drop` in the above example, you'd get a compiler error.\n\nIf you'd like to explicitly call the destructor of a value, [`mem::drop`] can be used instead.\n\n[`mem::drop`]: drop\n\n## Drop order\n\nWhich of our two `HasDrop` drops first, though? For structs, it's the same\norder that they're declared: first `one`, then `two`. If you'd like to try\nthis yourself, you can modify `HasDrop` above to contain some data, like an\ninteger, and then use it in the `println!` inside of `Drop`. This behavior is\nguaranteed by the language.\n\nUnlike for structs, local variables are dropped in reverse order:\n\n```rust\nstruct Foo;\n\nimpl Drop for Foo {\n fn drop(&mut self) {\n println!(\"Dropping Foo!\")\n }\n}\n\nstruct Bar;\n\nimpl Drop for Bar {\n fn drop(&mut self) {\n println!(\"Dropping Bar!\")\n }\n}\n\nfn main() {\n let _foo = Foo;\n let _bar = Bar;\n}\n```\n\nThis will print\n\n```text\nDropping Bar!\nDropping Foo!\n```\n\nPlease see [the reference] for the full rules.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\n## `Copy` and `Drop` are exclusive\n\nYou cannot implement both [`Copy`] and `Drop` on the same type. Types that\nare `Copy` get implicitly duplicated by the compiler, making it very\nhard to predict when, and how often destructors will be executed. As such,\nthese types cannot have destructors.\n\n## Drop check\n\nDropping interacts with the borrow checker in subtle ways: when a type `T` is being implicitly\ndropped as some variable of this type goes out of scope, the borrow checker needs to ensure that\ncalling `T`'s destructor at this moment is safe. In particular, it also needs to be safe to\nrecursively drop all the fields of `T`. For example, it is crucial that code like the following\nis being rejected:\n\n```rust\nuse std::cell::Cell;\n\nstruct S<'a>(Cell>>, Box);\nimpl Drop for S<'_> {\n fn drop(&mut self) {\n if let Some(r) = self.0.get() {\n // Print the contents of the `Box` in `r`.\n println!(\"{}\", r.1);\n }\n }\n}\n\nfn main() {\n // Set up two `S` that point to each other.\n let s1 = S(Cell::new(None), Box::new(42));\n let s2 = S(Cell::new(Some(&s1)), Box::new(42));\n s1.0.set(Some(&s2));\n // Now they both get dropped. But whichever is the 2nd one\n // to be dropped will access the `Box` in the first one,\n // which is a use-after-free!\n}\n```\n\nThe Nomicon discusses the need for [drop check in more detail][drop check].\n\nTo reject such code, the \"drop check\" analysis determines which types and lifetimes need to\nstill be live when `T` gets dropped. The exact details of this analysis are not yet\nstably guaranteed and **subject to change**. Currently, the analysis works as follows:\n- If `T` has no drop glue, then trivially nothing is required to be live. This is the case if\n neither `T` nor any of its (recursive) fields have a destructor (`impl Drop`). [`PhantomData`]\n and [`ManuallyDrop`] are considered to never have a destructor, no matter their field type.\n- If `T` has drop glue, then, for all types `U` that are *owned* by any field of `T`,\n recursively add the types and lifetimes that need to be live when `U` gets dropped. The set of\n owned types is determined by recursively traversing `T`:\n - Recursively descend through `PhantomData`, `Box`, tuples, and arrays (including arrays of\n length 0).\n - Stop at reference and raw pointer types as well as function pointers and function items;\n they do not own anything.\n - Stop at non-composite types (type parameters that remain generic in the current context and\n base types such as integers and `bool`); these types are owned.\n - When hitting an ADT with `impl Drop`, stop there; this type is owned.\n - When hitting an ADT without `impl Drop`, recursively descend to its fields. (For an `enum`,\n consider all fields of all variants.)\n- Furthermore, if `T` implements `Drop`, then all generic (lifetime and type) parameters of `T`\n must be live.\n\nIn the above example, the last clause implies that `'a` must be live when `S<'a>` is dropped,\nand hence the example is rejected. If we remove the `impl Drop`, the liveness requirement\ndisappears and the example is accepted.\n\nThere exists an unstable way for a type to opt-out of the last clause; this is called \"drop\ncheck eyepatch\" or `may_dangle`. For more details on this nightly-only feature, see the\n[discussion in the Nomicon][nomicon].\n\n[`ManuallyDrop`]: crate::mem::ManuallyDrop\n[`PhantomData`]: crate::marker::PhantomData\n[drop check]: ../../nomicon/dropck.html\n[nomicon]: ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standard-library-and-its-unstable-may_dangle"},"deprecated":false,"sortText":"ffffffef","filterText":"Drop","textEdit":{"newText":"Drop","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Eq (alias ==, !=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for comparisons corresponding to [equivalence relations](\nhttps://en.wikipedia.org/wiki/Equivalence_relation).\n\nThis means, that in addition to `a == b` and `a != b` being strict inverses,\nthe relation must be (for all `a`, `b` and `c`):\n\n- reflexive: `a == a`;\n- symmetric: `a == b` implies `b == a` (required by `PartialEq` as well); and\n- transitive: `a == b` and `b == c` implies `a == c` (required by `PartialEq` as well).\n\nThis property cannot be checked by the compiler, and therefore `Eq` implies\n[`PartialEq`], and has no extra methods.\n\nViolating this property is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\nImplement `Eq` in addition to `PartialEq` if it's guaranteed that\n`PartialEq::eq(a, a)` always returns `true` (reflexivity), in addition to\nthe symmetric and transitive properties already required by `PartialEq`.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d, because `Eq` has\nno extra methods, it is only informing the compiler that this is an\nequivalence relation rather than a partial equivalence relation. Note that\nthe `derive` strategy requires all fields are `Eq`, which isn't\nalways desired.\n\n## How can I implement `Eq`?\n\nIf you cannot use the `derive` strategy, specify that your type implements\n`Eq`, which has no methods:\n\n```rust\nenum BookFormat { Paperback, Hardback, Ebook }\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\nimpl Eq for Book {}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Eq","textEdit":{"newText":"Eq","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Err(…)","kind":20,"detail":"Err(E)","documentation":{"kind":"markdown","value":"Contains the error value"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Err()","insertTextFormat":2,"textEdit":{"newText":"Err(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"ExactSizeIterator","kind":8,"documentation":{"kind":"markdown","value":"An iterator that knows its exact length.\n\nMany [`Iterator`]s don't know how many times they will iterate, but some do.\nIf an iterator knows how many times it can iterate, providing access to\nthat information can be useful. For example, if you want to iterate\nbackwards, a good start is to know where the end is.\n\nWhen implementing an `ExactSizeIterator`, you must also implement\n[`Iterator`]. When doing so, the implementation of [`Iterator::size_hint`]\n*must* return the exact size of the iterator.\n\nThe [`len`] method has a default implementation, so you usually shouldn't\nimplement it. However, you may be able to provide a more performant\nimplementation than the default, so overriding it in this case makes sense.\n\nNote that this trait is a safe trait and as such does *not* and *cannot*\nguarantee that the returned length is correct. This means that `unsafe`\ncode **must not** rely on the correctness of [`Iterator::size_hint`]. The\nunstable and unsafe [`TrustedLen`](super::marker::TrustedLen) trait gives\nthis additional guarantee.\n\n[`len`]: ExactSizeIterator::len\n\n# When *shouldn't* an adapter be `ExactSizeIterator`?\n\nIf an adapter makes an iterator *longer*, then it's usually incorrect for\nthat adapter to implement `ExactSizeIterator`. The inner exact-sized\niterator might already be `usize::MAX`-long, and thus the length of the\nlonger adapted iterator would no longer be exactly representable in `usize`.\n\nThis is why [`Chain`](crate::iter::Chain) isn't `ExactSizeIterator`,\neven when `A` and `B` are both `ExactSizeIterator`.\n\n# Examples\n\nBasic usage:\n\n```rust\n// a finite range knows exactly how many times it will iterate\nlet five = 0..5;\n\nassert_eq!(5, five.len());\n```\n\nIn the [module-level docs], we implemented an [`Iterator`], `Counter`.\nLet's implement `ExactSizeIterator` for it as well:\n\n[module-level docs]: crate::iter\n\n```rust\nimpl ExactSizeIterator for Counter {\n // We can easily calculate the remaining number of iterations.\n fn len(&self) -> usize {\n 5 - self.count\n }\n}\n\n// And now we can use it!\n\nlet mut counter = Counter::new();\n\nassert_eq!(5, counter.len());\nlet _ = counter.next();\nassert_eq!(4, counter.len());\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"ExactSizeIterator","textEdit":{"newText":"ExactSizeIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Extend","kind":8,"documentation":{"kind":"markdown","value":"Extend a collection with the contents of an iterator.\n\nIterators produce a series of values, and collections can also be thought\nof as a series of values. The `Extend` trait bridges this gap, allowing you\nto extend a collection by including the contents of that iterator. When\nextending a collection with an already existing key, that entry is updated\nor, in the case of collections that permit multiple entries with equal\nkeys, that entry is inserted.\n\n# Examples\n\nBasic usage:\n\n```rust\n// You can extend a String with some chars:\nlet mut message = String::from(\"The first three letters are: \");\n\nmessage.extend(&['a', 'b', 'c']);\n\nassert_eq!(\"abc\", &message[29..32]);\n```\n\nImplementing `Extend`:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// since MyCollection has a list of i32s, we implement Extend for i32\nimpl Extend for MyCollection {\n\n // This is a bit simpler with the concrete type signature: we can call\n // extend on anything which can be turned into an Iterator which gives\n // us i32s. Because we need i32s to put into MyCollection.\n fn extend>(&mut self, iter: T) {\n\n // The implementation is very straightforward: loop through the\n // iterator, and add() each element to ourselves.\n for elem in iter {\n self.add(elem);\n }\n }\n}\n\nlet mut c = MyCollection::new();\n\nc.add(5);\nc.add(6);\nc.add(7);\n\n// let's extend our collection with three more numbers\nc.extend(vec![1, 2, 3]);\n\n// we've added these elements onto the end\nassert_eq!(\"MyCollection([5, 6, 7, 1, 2, 3])\", format!(\"{c:?}\"));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Extend","textEdit":{"newText":"Extend","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Fn","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes an immutable receiver.\n\nInstances of `Fn` can be called repeatedly without mutating state.\n\n*This trait (`Fn`) is not to be confused with [function pointers]\n(`fn`).*\n\n`Fn` is implemented automatically by closures which only take immutable\nreferences to captured variables or don't capture anything at all, as well\nas (safe) [function pointers] (with some caveats, see their documentation\nfor more details). Additionally, for any type `F` that implements `Fn`, `&F`\nimplements `Fn`, too.\n\nSince both [`FnMut`] and [`FnOnce`] are supertraits of `Fn`, any\ninstance of `Fn` can be used as a parameter where a [`FnMut`] or [`FnOnce`]\nis expected.\n\nUse `Fn` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly and without mutating state (e.g., when\ncalling it concurrently). If you do not need such strict requirements, use\n[`FnMut`] or [`FnOnce`] as bounds.\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a closure\n\n```rust\nlet square = |x| x * x;\nassert_eq!(square(5), 25);\n```\n\n## Using a `Fn` parameter\n\n```rust\nfn call_with_one(func: F) -> usize\n where F: Fn(usize) -> usize {\n func(1)\n}\n\nlet double = |x| x * 2;\nassert_eq!(call_with_one(double), 2);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Fn","textEdit":{"newText":"Fn","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"FnMut","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a mutable receiver.\n\nInstances of `FnMut` can be called repeatedly and may mutate state.\n\n`FnMut` is implemented automatically by closures which take mutable\nreferences to captured variables, as well as all types that implement\n[`Fn`], e.g., (safe) [function pointers] (since `FnMut` is a supertrait of\n[`Fn`]). Additionally, for any type `F` that implements `FnMut`, `&mut F`\nimplements `FnMut`, too.\n\nSince [`FnOnce`] is a supertrait of `FnMut`, any instance of `FnMut` can be\nused where a [`FnOnce`] is expected, and since [`Fn`] is a subtrait of\n`FnMut`, any instance of [`Fn`] can be used where `FnMut` is expected.\n\nUse `FnMut` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly, while allowing it to mutate state.\nIf you don't want the parameter to mutate state, use [`Fn`] as a\nbound; if you don't need to call it repeatedly, use [`FnOnce`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a mutably capturing closure\n\n```rust\nlet mut x = 5;\n{\n let mut square_x = || x *= x;\n square_x();\n}\nassert_eq!(x, 25);\n```\n\n## Using a `FnMut` parameter\n\n```rust\nfn do_twice(mut func: F)\n where F: FnMut()\n{\n func();\n func();\n}\n\nlet mut x: usize = 1;\n{\n let add_two_to_x = || x += 2;\n do_twice(add_two_to_x);\n}\n\nassert_eq!(x, 5);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FnMut","textEdit":{"newText":"FnMut","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"FnOnce","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a by-value receiver.\n\nInstances of `FnOnce` can be called, but might not be callable multiple\ntimes. Because of this, if the only thing known about a type is that it\nimplements `FnOnce`, it can only be called once.\n\n`FnOnce` is implemented automatically by closures that might consume captured\nvariables, as well as all types that implement [`FnMut`], e.g., (safe)\n[function pointers] (since `FnOnce` is a supertrait of [`FnMut`]).\n\nSince both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of\n[`Fn`] or [`FnMut`] can be used where a `FnOnce` is expected.\n\nUse `FnOnce` as a bound when you want to accept a parameter of function-like\ntype and only need to call it once. If you need to call the parameter\nrepeatedly, use [`FnMut`] as a bound; if you also need it to not mutate\nstate, use [`Fn`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Using a `FnOnce` parameter\n\n```rust\nfn consume_with_relish(func: F)\n where F: FnOnce() -> String\n{\n // `func` consumes its captured variables, so it cannot be run more\n // than once.\n println!(\"Consumed: {}\", func());\n\n println!(\"Delicious!\");\n\n // Attempting to invoke `func()` again will throw a `use of moved\n // value` error for `func`.\n}\n\nlet x = String::from(\"x\");\nlet consume_and_return_x = move || x;\nconsume_with_relish(consume_and_return_x);\n\n// `consume_and_return_x` can no longer be invoked at this point\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FnOnce","textEdit":{"newText":"FnOnce","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"From","kind":8,"documentation":{"kind":"markdown","value":"Used to do value-to-value conversions while consuming the input value. It is the reciprocal of\n[`Into`].\n\nOne should always prefer implementing `From` over [`Into`]\nbecause implementing `From` automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nOnly implement [`Into`] when targeting a version prior to Rust 1.41 and converting to a type\noutside the current crate.\n`From` was not able to do these types of conversions in earlier versions because of Rust's\norphaning rules.\nSee [`Into`] for more details.\n\nPrefer using [`Into`] over using `From` when specifying trait bounds on a generic function.\nThis way, types that directly implement [`Into`] can be used as arguments as well.\n\nThe `From` is also very useful when performing error handling. When constructing a function\nthat is capable of failing, the return type will generally be of the form `Result`.\nThe `From` trait simplifies error handling by allowing a function to return a single error type\nthat encapsulate multiple error types. See the \"Examples\" section and [the book][book] for more\ndetails.\n\n**Note: This trait must not fail**. The `From` trait is intended for perfect conversions.\nIf the conversion can fail or is not perfect, use [`TryFrom`].\n\n# Generic Implementations\n\n- `From for U` implies [`Into`]` for T`\n- `From` is reflexive, which means that `From for T` is implemented\n\n# When to implement `From`\n\nWhile there's no technical restrictions on which conversions can be done using\na `From` implementation, the general expectation is that the conversions\nshould typically be restricted as follows:\n\n* The conversion is *infallible*: if the conversion can fail, use [`TryFrom`]\n instead; don't provide a `From` impl that panics.\n\n* The conversion is *lossless*: semantically, it should not lose or discard\n information. For example, `i32: From` exists, where the original\n value can be recovered using `u16: TryFrom`. And `String: From<&str>`\n exists, where you can get something equivalent to the original value via\n `Deref`. But `From` cannot be used to convert from `u32` to `u16`, since\n that cannot succeed in a lossless way. (There's some wiggle room here for\n information not considered semantically relevant. For example,\n `Box<[T]>: From>` exists even though it might not preserve capacity,\n like how two vectors can be equal despite differing capacities.)\n\n* The conversion is *value-preserving*: the conceptual kind and meaning of\n the resulting value is the same, even though the Rust type and technical\n representation might be different. For example `-1_i8 as u8` is *lossless*,\n since `as` casting back can recover the original value, but that conversion\n is *not* available via `From` because `-1` and `255` are different conceptual\n values (despite being identical bit patterns technically). But\n `f32: From` *is* available because `1_i16` and `1.0_f32` are conceptually\n the same real number (despite having very different bit patterns technically).\n `String: From` is available because they're both *text*, but\n `String: From` is *not* available, since `1` (a number) and `\"1\"`\n (text) are too different. (Converting values to text is instead covered\n by the [`Display`](crate::fmt::Display) trait.)\n\n* The conversion is *obvious*: it's the only reasonable conversion between\n the two types. Otherwise it's better to have it be a named method or\n constructor, like how [`str::as_bytes`] is a method and how integers have\n methods like [`u32::from_ne_bytes`], [`u32::from_le_bytes`], and\n [`u32::from_be_bytes`], none of which are `From` implementations. Whereas\n there's only one reasonable way to wrap an [`Ipv6Addr`](crate::net::Ipv6Addr)\n into an [`IpAddr`](crate::net::IpAddr), thus `IpAddr: From` exists.\n\n# Examples\n\n[`String`] implements `From<&str>`:\n\nAn explicit conversion from a `&str` to a String is done as follows:\n\n```rust\nlet string = \"hello\".to_string();\nlet other_string = String::from(\"hello\");\n\nassert_eq!(string, other_string);\n```\n\nWhile performing error handling it is often useful to implement `From` for your own error type.\nBy converting underlying error types to our own custom error type that encapsulates the\nunderlying error type, we can return a single error type without losing information on the\nunderlying cause. The '?' operator automatically converts the underlying error type to our\ncustom error type with `From::from`.\n\n```rust\nuse std::fs;\nuse std::io;\nuse std::num;\n\nenum CliError {\n IoError(io::Error),\n ParseError(num::ParseIntError),\n}\n\nimpl From for CliError {\n fn from(error: io::Error) -> Self {\n CliError::IoError(error)\n }\n}\n\nimpl From for CliError {\n fn from(error: num::ParseIntError) -> Self {\n CliError::ParseError(error)\n }\n}\n\nfn open_and_parse_file(file_name: &str) -> Result {\n let mut contents = fs::read_to_string(&file_name)?;\n let num: i32 = contents.trim().parse()?;\n Ok(num)\n}\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`from`]: From::from\n[book]: ../../book/ch09-00-error-handling.html"},"deprecated":false,"sortText":"ffffffef","filterText":"From","textEdit":{"newText":"From","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"FromIterator","kind":8,"documentation":{"kind":"markdown","value":"Conversion from an [`Iterator`].\n\nBy implementing `FromIterator` for a type, you define how it will be\ncreated from an iterator. This is common for types which describe a\ncollection of some kind.\n\nIf you want to create a collection from the contents of an iterator, the\n[`Iterator::collect()`] method is preferred. However, when you need to\nspecify the container type, [`FromIterator::from_iter()`] can be more\nreadable than using a turbofish (e.g. `::>()`). See the\n[`Iterator::collect()`] documentation for more examples of its use.\n\nSee also: [`IntoIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v = Vec::from_iter(five_fives);\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`Iterator::collect()`] to implicitly use `FromIterator`:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v: Vec = five_fives.collect();\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`FromIterator::from_iter()`] as a more readable alternative to\n[`Iterator::collect()`]:\n\n```rust\nuse std::collections::VecDeque;\nlet first = (0..10).collect::>();\nlet second = VecDeque::from_iter(0..10);\n\nassert_eq!(first, second);\n```\n\nImplementing `FromIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement FromIterator\nimpl FromIterator for MyCollection {\n fn from_iter>(iter: I) -> Self {\n let mut c = MyCollection::new();\n\n for i in iter {\n c.add(i);\n }\n\n c\n }\n}\n\n// Now we can make a new iterator...\nlet iter = (0..5).into_iter();\n\n// ... and make a MyCollection out of it\nlet c = MyCollection::from_iter(iter);\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n\n// collect works too!\n\nlet iter = (0..5).into_iter();\nlet c: MyCollection = iter.collect();\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FromIterator","textEdit":{"newText":"FromIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Into","kind":8,"documentation":{"kind":"markdown","value":"A value-to-value conversion that consumes the input value. The\nopposite of [`From`].\n\nOne should avoid implementing [`Into`] and implement [`From`] instead.\nImplementing [`From`] automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nPrefer using [`Into`] over [`From`] when specifying trait bounds on a generic function\nto ensure that types that only implement [`Into`] can be used as well.\n\n**Note: This trait must not fail**. If the conversion can fail, use [`TryInto`].\n\n# Generic Implementations\n\n- [`From`]` for U` implies `Into for T`\n- [`Into`] is reflexive, which means that `Into for T` is implemented\n\n# Implementing [`Into`] for conversions to external types in old versions of Rust\n\nPrior to Rust 1.41, if the destination type was not part of the current crate\nthen you couldn't implement [`From`] directly.\nFor example, take this code:\n\n```rust\nstruct Wrapper(Vec);\nimpl From> for Vec {\n fn from(w: Wrapper) -> Vec {\n w.0\n }\n}\n```\nThis will fail to compile in older versions of the language because Rust's orphaning rules\nused to be a little bit more strict. To bypass this, you could implement [`Into`] directly:\n\n```rust\nstruct Wrapper(Vec);\nimpl Into> for Wrapper {\n fn into(self) -> Vec {\n self.0\n }\n}\n```\n\nIt is important to understand that [`Into`] does not provide a [`From`] implementation\n(as [`From`] does with [`Into`]). Therefore, you should always try to implement [`From`]\nand then fall back to [`Into`] if [`From`] can't be implemented.\n\n# Examples\n\n[`String`] implements [`Into`]`<`[`Vec`]`<`[`u8`]`>>`:\n\nIn order to express that we want a generic function to take all arguments that can be\nconverted to a specified type `T`, we can use a trait bound of [`Into`]``.\nFor example: The function `is_hello` takes all arguments that can be converted into a\n[`Vec`]`<`[`u8`]`>`.\n\n```rust\nfn is_hello>>(s: T) {\n let bytes = b\"hello\".to_vec();\n assert_eq!(bytes, s.into());\n}\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`Vec`]: ../../std/vec/struct.Vec.html"},"deprecated":false,"sortText":"ffffffef","filterText":"Into","textEdit":{"newText":"Into","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"IntoIterator","kind":8,"documentation":{"kind":"markdown","value":"Conversion into an [`Iterator`].\n\nBy implementing `IntoIterator` for a type, you define how it will be\nconverted to an iterator. This is common for types which describe a\ncollection of some kind.\n\nOne benefit of implementing `IntoIterator` is that your type will [work\nwith Rust's `for` loop syntax](crate::iter#for-loops-and-intoiterator).\n\nSee also: [`FromIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = [1, 2, 3];\nlet mut iter = v.into_iter();\n\nassert_eq!(Some(1), iter.next());\nassert_eq!(Some(2), iter.next());\nassert_eq!(Some(3), iter.next());\nassert_eq!(None, iter.next());\n```\nImplementing `IntoIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement IntoIterator\nimpl IntoIterator for MyCollection {\n type Item = i32;\n type IntoIter = std::vec::IntoIter;\n\n fn into_iter(self) -> Self::IntoIter {\n self.0.into_iter()\n }\n}\n\n// Now we can make a new collection...\nlet mut c = MyCollection::new();\n\n// ... add some stuff to it ...\nc.add(0);\nc.add(1);\nc.add(2);\n\n// ... and then turn it into an Iterator:\nfor (i, n) in c.into_iter().enumerate() {\n assert_eq!(i as i32, n);\n}\n```\n\nIt is common to use `IntoIterator` as a trait bound. This allows\nthe input collection type to change, so long as it is still an\niterator. Additional bounds can be specified by restricting on\n`Item`:\n\n```rust\nfn collect_as_strings(collection: T) -> Vec\nwhere\n T: IntoIterator,\n T::Item: std::fmt::Debug,\n{\n collection\n .into_iter()\n .map(|item| format!(\"{item:?}\"))\n .collect()\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"IntoIterator","textEdit":{"newText":"IntoIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Iterator","kind":8,"documentation":{"kind":"markdown","value":"A trait for dealing with iterators.\n\nThis is the main iterator trait. For more about the concept of iterators\ngenerally, please see the [module-level documentation]. In particular, you\nmay want to know how to [implement `Iterator`][impl].\n\n[module-level documentation]: crate::iter\n[impl]: crate::iter#implementing-iterator"},"deprecated":false,"sortText":"ffffffef","filterText":"Iterator","textEdit":{"newText":"Iterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"None","kind":20,"detail":"None","documentation":{"kind":"markdown","value":"No value."},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"None","insertTextFormat":2,"textEdit":{"newText":"None$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"Ok(…)","kind":20,"detail":"Ok(T)","documentation":{"kind":"markdown","value":"Contains the success value"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Ok()","insertTextFormat":2,"textEdit":{"newText":"Ok(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"Option","kind":13,"documentation":{"kind":"markdown","value":"The `Option` type. See [the module level documentation](self) for more."},"deprecated":false,"sortText":"ffffffef","filterText":"Option","textEdit":{"newText":"Option","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Ord (alias <, >, <=, >=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for types that form a [total order](https://en.wikipedia.org/wiki/Total_order).\n\nImplementations must be consistent with the [`PartialOrd`] implementation, and ensure\n`max`, `min`, and `clamp` are consistent with `cmp`:\n\n- `partial_cmp(a, b) == Some(cmp(a, b))`.\n- `max(a, b) == max_by(a, b, cmp)` (ensured by the default implementation).\n- `min(a, b) == min_by(a, b, cmp)` (ensured by the default implementation).\n- For `a.clamp(min, max)`, see the [method docs](#method.clamp)\n (ensured by the default implementation).\n\nIt's easy to accidentally make `cmp` and `partial_cmp` disagree by\nderiving some of the traits and manually implementing others.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nFrom the above and the requirements of `PartialOrd`, it follows that for\nall `a`, `b` and `c`:\n\n- exactly one of `a < b`, `a == b` or `a > b` is true; and\n- `<` is transitive: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n\nMathematically speaking, the `<` operator defines a strict [weak order]. In\ncases where `==` conforms to mathematical equality, it also defines a\nstrict [total order].\n\n[weak order]: https://en.wikipedia.org/wiki/Weak_ordering\n[total order]: https://en.wikipedia.org/wiki/Total_order\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## Lexicographical comparison\n\nLexicographical comparison is an operation with the following properties:\n - Two sequences are compared element by element.\n - The first mismatching element defines which sequence is lexicographically less or greater than the other.\n - If one sequence is a prefix of another, the shorter sequence is lexicographically less than the other.\n - If two sequences have equivalent elements and are of the same length, then the sequences are lexicographically equal.\n - An empty sequence is lexicographically less than any non-empty sequence.\n - Two empty sequences are lexicographically equal.\n\n## How can I implement `Ord`?\n\n`Ord` requires that the type also be [`PartialOrd`] and [`Eq`] (which requires [`PartialEq`]).\n\nThen you must define an implementation for [`cmp`]. You may find it useful to use\n[`cmp`] on your type's fields.\n\nHere's an example where you want to sort people by height only, disregarding `id`\nand `name`:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n[`cmp`]: Ord::cmp"},"deprecated":false,"sortText":"ffffffef","filterText":"Ord","textEdit":{"newText":"Ord","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"PartialEq (alias ==, !=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for comparisons using the equality operator.\n\nImplementing this trait for types provides the `==` and `!=` operators for\nthose types.\n\n`x.eq(y)` can also be written `x == y`, and `x.ne(y)` can be written `x != y`.\nWe use the easier-to-read infix notation in the remainder of this documentation.\n\nThis trait allows for comparisons using the equality operator, for types\nthat do not have a full equivalence relation. For example, in floating point\nnumbers `NaN != NaN`, so floating point types implement `PartialEq` but not\n[`trait@Eq`]. Formally speaking, when `Rhs == Self`, this trait corresponds\nto a [partial equivalence relation].\n\n[partial equivalence relation]: https://en.wikipedia.org/wiki/Partial_equivalence_relation\n\nImplementations must ensure that `eq` and `ne` are consistent with each other:\n\n- `a != b` if and only if `!(a == b)`.\n\nThe default implementation of `ne` provides this consistency and is almost\nalways sufficient. It should not be overridden without very good reason.\n\nIf [`PartialOrd`] or [`Ord`] are also implemented for `Self` and `Rhs`, their methods must also\nbe consistent with `PartialEq` (see the documentation of those traits for the exact\nrequirements). It's easy to accidentally make them disagree by deriving some of the traits and\nmanually implementing others.\n\nThe equality relation `==` must satisfy the following conditions\n(for all `a`, `b`, `c` of type `A`, `B`, `C`):\n\n- **Symmetric**: if `A: PartialEq` and `B: PartialEq`, then **`a == b`\n implies `b == a`**; and\n\n- **Transitive**: if `A: PartialEq` and `B: PartialEq` and `A:\n PartialEq`, then **`a == b` and `b == c` implies `a == c`**.\n\nNote that the `B: PartialEq` (symmetric) and `A: PartialEq`\n(transitive) impls are not forced to exist, but these requirements apply\nwhenever they do exist.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d on structs, two\ninstances are equal if all fields are equal, and not equal if any fields\nare not equal. When `derive`d on enums, two instances are equal if they\nare the same variant and all fields are equal.\n\n## How can I implement `PartialEq`?\n\nAn example implementation for a domain in which two books are considered\nthe same book if their ISBN matches, even if the formats differ:\n\n```rust\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\nlet b2 = Book { isbn: 3, format: BookFormat::Ebook };\nlet b3 = Book { isbn: 10, format: BookFormat::Paperback };\n\nassert!(b1 == b2);\nassert!(b1 != b3);\n```\n\n## How can I compare two different types?\n\nThe type you can compare with is controlled by `PartialEq`'s type parameter.\nFor example, let's tweak our previous code a bit:\n\n```rust\n// The derive implements == comparisons\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\n// Implement == comparisons\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\n// Implement == comparisons\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\n\nassert!(b1 == BookFormat::Paperback);\nassert!(BookFormat::Ebook != b1);\n```\n\nBy changing `impl PartialEq for Book` to `impl PartialEq for Book`,\nwe allow `BookFormat`s to be compared with `Book`s.\n\nA comparison like the one above, which ignores some fields of the struct,\ncan be dangerous. It can easily lead to an unintended violation of the\nrequirements for a partial equivalence relation. For example, if we kept\nthe above implementation of `PartialEq` for `BookFormat` and added an\nimplementation of `PartialEq` for `Book` (either via a `#[derive]` or\nvia the manual implementation from the first example) then the result would\nviolate transitivity:\n\n```rust\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\n#[derive(PartialEq)]\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nfn main() {\n let b1 = Book { isbn: 1, format: BookFormat::Paperback };\n let b2 = Book { isbn: 2, format: BookFormat::Paperback };\n\n assert!(b1 == BookFormat::Paperback);\n assert!(BookFormat::Paperback == b2);\n\n // The following should hold by transitivity but doesn't.\n assert!(b1 == b2); // <-- PANICS\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x == y, false);\nassert_eq!(x.eq(&y), false);\n```\n\n[`eq`]: PartialEq::eq\n[`ne`]: PartialEq::ne"},"deprecated":false,"sortText":"ffffffef","filterText":"PartialEq","textEdit":{"newText":"PartialEq","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"PartialOrd (alias >, <, <=, >=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for types that form a [partial order](https://en.wikipedia.org/wiki/Partial_order).\n\nThe `lt`, `le`, `gt`, and `ge` methods of this trait can be called using\nthe `<`, `<=`, `>`, and `>=` operators, respectively.\n\nThe methods of this trait must be consistent with each other and with those of [`PartialEq`].\nThe following conditions must hold:\n\n1. `a == b` if and only if `partial_cmp(a, b) == Some(Equal)`.\n2. `a < b` if and only if `partial_cmp(a, b) == Some(Less)`\n3. `a > b` if and only if `partial_cmp(a, b) == Some(Greater)`\n4. `a <= b` if and only if `a < b || a == b`\n5. `a >= b` if and only if `a > b || a == b`\n6. `a != b` if and only if `!(a == b)`.\n\nConditions 2–5 above are ensured by the default implementation.\nCondition 6 is already ensured by [`PartialEq`].\n\nIf [`Ord`] is also implemented for `Self` and `Rhs`, it must also be consistent with\n`partial_cmp` (see the documentation of that trait for the exact requirements). It's\neasy to accidentally make them disagree by deriving some of the traits and manually\nimplementing others.\n\nThe comparison must satisfy, for all `a`, `b` and `c`:\n\n- transitivity: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n- duality: `a < b` if and only if `b > a`.\n\nNote that these requirements mean that the trait itself must be implemented symmetrically and\ntransitively: if `T: PartialOrd` and `U: PartialOrd` then `U: PartialOrd` and `T:\nPartialOrd`.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nThe following corollaries follow from the above requirements:\n\n- irreflexivity of `<` and `>`: `!(a < a)`, `!(a > a)`\n- transitivity of `>`: if `a > b` and `b > c` then `a > c`\n- duality of `partial_cmp`: `partial_cmp(a, b) == partial_cmp(b, a).map(Ordering::reverse)`\n\n## Strict and non-strict partial orders\n\nThe `<` and `>` operators behave according to a *strict* partial order.\nHowever, `<=` and `>=` do **not** behave according to a *non-strict*\npartial order.\nThat is because mathematically, a non-strict partial order would require\nreflexivity, i.e. `a <= a` would need to be true for every `a`. This isn't\nalways the case for types that implement `PartialOrd`, for example:\n\n```rust\nlet a = f64::sqrt(-1.0);\nassert_eq!(a <= a, false);\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## How can I implement `PartialOrd`?\n\n`PartialOrd` only requires implementation of the [`partial_cmp`] method, with the others\ngenerated from default implementations.\n\nHowever it remains possible to implement the others separately for types which do not have a\ntotal order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==\nfalse` (cf. IEEE 754-2008 section 5.11).\n\n`PartialOrd` requires your type to be [`PartialEq`].\n\nIf your type is [`Ord`], you can implement [`partial_cmp`] by using [`cmp`]:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\nYou may also find it useful to use [`partial_cmp`] on your type's fields. Here\nis an example of `Person` types who have a floating-point `height` field that\nis the only field to be used for sorting:\n\n```rust\nuse std::cmp::Ordering;\n\nstruct Person {\n id: u32,\n name: String,\n height: f64,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n self.height.partial_cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x < y, true);\nassert_eq!(x.lt(&y), true);\n```\n\n[`partial_cmp`]: PartialOrd::partial_cmp\n[`cmp`]: Ord::cmp"},"deprecated":false,"sortText":"ffffffef","filterText":"PartialOrd","textEdit":{"newText":"PartialOrd","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Result","kind":13,"documentation":{"kind":"markdown","value":"`Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).\n\nSee the [module documentation](self) for details."},"deprecated":false,"sortText":"ffffffef","filterText":"Result","textEdit":{"newText":"Result","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"RustcDecodable","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"RustcDecodable","textEdit":{"newText":"RustcDecodable","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"RustcEncodable","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"RustcEncodable","textEdit":{"newText":"RustcEncodable","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Some(…)","kind":20,"detail":"Some(T)","documentation":{"kind":"markdown","value":"Some value of type `T`."},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Some()","insertTextFormat":2,"textEdit":{"newText":"Some(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"String","kind":22,"documentation":{"kind":"markdown","value":"A UTF-8–encoded, growable string.\n\nThe `String` type is the most common string type that has ownership over the\ncontents of the string. It has a close relationship with its borrowed\ncounterpart, the primitive [`str`].\n\n# Examples\n\nYou can create a `String` from [a literal string][`&str`] with [`String::from`]:\n\n[`String::from`]: From::from\n\n```rust\nlet hello = String::from(\"Hello, world!\");\n```\n\nYou can append a [`char`] to a `String` with the [`push`] method, and\nappend a [`&str`] with the [`push_str`] method:\n\n```rust\nlet mut hello = String::from(\"Hello, \");\n\nhello.push('w');\nhello.push_str(\"orld!\");\n```\n\n[`push`]: String::push\n[`push_str`]: String::push_str\n\nIf you have a vector of UTF-8 bytes, you can create a `String` from it with\nthe [`from_utf8`] method:\n\n```rust\n// some bytes, in a vector\nlet sparkle_heart = vec![240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `unwrap()`.\nlet sparkle_heart = String::from_utf8(sparkle_heart).unwrap();\n\nassert_eq!(\"💖\", sparkle_heart);\n```\n\n[`from_utf8`]: String::from_utf8\n\n# UTF-8\n\n`String`s are always valid UTF-8. If you need a non-UTF-8 string, consider\n[`OsString`]. It is similar, but without the UTF-8 constraint. Because UTF-8\nis a variable width encoding, `String`s are typically smaller than an array of\nthe same `chars`:\n\n```rust\nuse std::mem;\n\n// `s` is ASCII which represents each `char` as one byte\nlet s = \"hello\";\nassert_eq!(s.len(), 5);\n\n// A `char` array with the same contents would be longer because\n// every `char` is four bytes\nlet s = ['h', 'e', 'l', 'l', 'o'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n\n// However, for non-ASCII strings, the difference will be smaller\n// and sometimes they are the same\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.len(), 20);\n\nlet s = ['💖', '💖', '💖', '💖', '💖'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n```\n\nThis raises interesting questions as to how `s[i]` should work.\nWhat should `i` be here? Several options include byte indices and\n`char` indices but, because of UTF-8 encoding, only byte indices\nwould provide constant time indexing. Getting the `i`th `char`, for\nexample, is available using [`chars`]:\n\n```rust\nlet s = \"hello\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('l'));\n\nlet s = \"💖💖💖💖💖\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('💖'));\n```\n\nNext, what should `s[i]` return? Because indexing returns a reference\nto underlying data it could be `&u8`, `&[u8]`, or something else similar.\nSince we're only providing one index, `&u8` makes the most sense but that\nmight not be what the user expects and can be explicitly achieved with\n[`as_bytes()`]:\n\n```rust\n// The first byte is 104 - the byte value of `'h'`\nlet s = \"hello\";\nassert_eq!(s.as_bytes()[0], 104);\n// or\nassert_eq!(s.as_bytes()[0], b'h');\n\n// The first byte is 240 which isn't obviously useful\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.as_bytes()[0], 240);\n```\n\nDue to these ambiguities/restrictions, indexing with a `usize` is simply\nforbidden:\n\n```rust\nlet s = \"hello\";\n\n// The following will not compile!\nprintln!(\"The first letter of s is {}\", s[0]);\n```\n\nIt is more clear, however, how `&s[i..j]` should work (that is,\nindexing with a range). It should accept byte indices (to be constant-time)\nand return a `&str` which is UTF-8 encoded. This is also called \"string slicing\".\nNote this will panic if the byte indices provided are not character\nboundaries - see [`is_char_boundary`] for more details. See the implementations\nfor [`SliceIndex`] for more details on string slicing. For a non-panicking\nversion of string slicing, see [`get`].\n\n[`OsString`]: ../../std/ffi/struct.OsString.html \"ffi::OsString\"\n[`SliceIndex`]: core::slice::SliceIndex\n[`as_bytes()`]: str::as_bytes\n[`get`]: str::get\n[`is_char_boundary`]: str::is_char_boundary\n\nThe [`bytes`] and [`chars`] methods return iterators over the bytes and\ncodepoints of the string, respectively. To iterate over codepoints along\nwith byte indices, use [`char_indices`].\n\n[`bytes`]: str::bytes\n[`chars`]: str::chars\n[`char_indices`]: str::char_indices\n\n# Deref\n\n`String` implements [Deref], and so inherits all of [`str`]'s\nmethods. In addition, this means that you can pass a `String` to a\nfunction which takes a [`&str`] by using an ampersand (`&`):\n\n```rust\nfn takes_str(s: &str) { }\n\nlet s = String::from(\"Hello\");\n\ntakes_str(&s);\n```\n\nThis will create a [`&str`] from the `String` and pass it in. This\nconversion is very inexpensive, and so generally, functions will accept\n[`&str`]s as arguments unless they need a `String` for some specific\nreason.\n\nIn certain cases Rust doesn't have enough information to make this\nconversion, known as [`Deref`] coercion. In the following example a string\nslice [`&'a str`][`&str`] implements the trait `TraitExample`, and the function\n`example_func` takes anything that implements the trait. In this case Rust\nwould need to make two implicit conversions, which Rust doesn't have the\nmeans to do. For that reason, the following example will not compile.\n\n```rust\ntrait TraitExample {}\n\nimpl<'a> TraitExample for &'a str {}\n\nfn example_func(example_arg: A) {}\n\nlet example_string = String::from(\"example_string\");\nexample_func(&example_string);\n```\n\nThere are two options that would work instead. The first would be to\nchange the line `example_func(&example_string);` to\n`example_func(example_string.as_str());`, using the method [`as_str()`]\nto explicitly extract the string slice containing the string. The second\nway changes `example_func(&example_string);` to\n`example_func(&*example_string);`. In this case we are dereferencing a\n`String` to a [`str`], then referencing the [`str`] back to\n[`&str`]. The second way is more idiomatic, however both work to do the\nconversion explicitly rather than relying on the implicit conversion.\n\n# Representation\n\nA `String` is made up of three components: a pointer to some bytes, a\nlength, and a capacity. The pointer points to an internal buffer `String`\nuses to store its data. The length is the number of bytes currently stored\nin the buffer, and the capacity is the size of the buffer in bytes. As such,\nthe length will always be less than or equal to the capacity.\n\nThis buffer is always stored on the heap.\n\nYou can look at these with the [`as_ptr`], [`len`], and [`capacity`]\nmethods:\n\n```rust\nuse std::mem;\n\nlet story = String::from(\"Once upon a time...\");\n\n// Prevent automatically dropping the String's data\nlet mut story = mem::ManuallyDrop::new(story);\n\nlet ptr = story.as_mut_ptr();\nlet len = story.len();\nlet capacity = story.capacity();\n\n// story has nineteen bytes\nassert_eq!(19, len);\n\n// We can re-build a String out of ptr, len, and capacity. This is all\n// unsafe because we are responsible for making sure the components are\n// valid:\nlet s = unsafe { String::from_raw_parts(ptr, len, capacity) } ;\n\nassert_eq!(String::from(\"Once upon a time...\"), s);\n```\n\n[`as_ptr`]: str::as_ptr\n[`len`]: String::len\n[`capacity`]: String::capacity\n\nIf a `String` has enough capacity, adding elements to it will not\nre-allocate. For example, consider this program:\n\n```rust\nlet mut s = String::new();\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\nThis will output the following:\n\n```text\n0\n8\n16\n16\n32\n32\n```\n\nAt first, we have no memory allocated at all, but as we append to the\nstring, it increases its capacity appropriately. If we instead use the\n[`with_capacity`] method to allocate the correct capacity initially:\n\n```rust\nlet mut s = String::with_capacity(25);\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\n[`with_capacity`]: String::with_capacity\n\nWe end up with a different output:\n\n```text\n25\n25\n25\n25\n25\n25\n```\n\nHere, there's no need to allocate more memory inside the loop.\n\n[str]: prim@str \"str\"\n[`str`]: prim@str \"str\"\n[`&str`]: prim@str \"&str\"\n[Deref]: core::ops::Deref \"ops::Deref\"\n[`Deref`]: core::ops::Deref \"ops::Deref\"\n[`as_str()`]: String::as_str"},"deprecated":false,"sortText":"ffffffef","filterText":"String","textEdit":{"newText":"String","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"ToOwned","kind":8,"documentation":{"kind":"markdown","value":"A generalization of `Clone` to borrowed data.\n\nSome types make it possible to go from borrowed to owned, usually by\nimplementing the `Clone` trait. But `Clone` works only for going from `&T`\nto `T`. The `ToOwned` trait generalizes `Clone` to construct owned data\nfrom any borrow of a given type."},"deprecated":false,"sortText":"ffffffef","filterText":"ToOwned","textEdit":{"newText":"ToOwned","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"ToString","kind":8,"documentation":{"kind":"markdown","value":"A trait for converting a value to a `String`.\n\nThis trait is automatically implemented for any type which implements the\n[`Display`] trait. As such, `ToString` shouldn't be implemented directly:\n[`Display`] should be implemented instead, and you get the `ToString`\nimplementation for free.\n\n[`Display`]: fmt::Display"},"deprecated":false,"sortText":"ffffffef","filterText":"ToString","textEdit":{"newText":"ToString","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"TryFrom","kind":8,"documentation":{"kind":"markdown","value":"Simple and safe type conversions that may fail in a controlled\nway under some circumstances. It is the reciprocal of [`TryInto`].\n\nThis is useful when you are doing a type conversion that may\ntrivially succeed but may also need special handling.\nFor example, there is no way to convert an [`i64`] into an [`i32`]\nusing the [`From`] trait, because an [`i64`] may contain a value\nthat an [`i32`] cannot represent and so the conversion would lose data.\nThis might be handled by truncating the [`i64`] to an [`i32`] or by\nsimply returning [`i32::MAX`], or by some other method. The [`From`]\ntrait is intended for perfect conversions, so the `TryFrom` trait\ninforms the programmer when a type conversion could go bad and lets\nthem decide how to handle it.\n\n# Generic Implementations\n\n- `TryFrom for U` implies [`TryInto`]` for T`\n- [`try_from`] is reflexive, which means that `TryFrom for T`\nis implemented and cannot fail -- the associated `Error` type for\ncalling `T::try_from()` on a value of type `T` is [`Infallible`].\nWhen the [`!`] type is stabilized [`Infallible`] and [`!`] will be\nequivalent.\n\n`TryFrom` can be implemented as follows:\n\n```rust\nstruct GreaterThanZero(i32);\n\nimpl TryFrom for GreaterThanZero {\n type Error = &'static str;\n\n fn try_from(value: i32) -> Result {\n if value <= 0 {\n Err(\"GreaterThanZero only accepts values greater than zero!\")\n } else {\n Ok(GreaterThanZero(value))\n }\n }\n}\n```\n\n# Examples\n\nAs described, [`i32`] implements `TryFrom<`[`i64`]`>`:\n\n```rust\nlet big_number = 1_000_000_000_000i64;\n// Silently truncates `big_number`, requires detecting\n// and handling the truncation after the fact.\nlet smaller_number = big_number as i32;\nassert_eq!(smaller_number, -727379968);\n\n// Returns an error because `big_number` is too big to\n// fit in an `i32`.\nlet try_smaller_number = i32::try_from(big_number);\nassert!(try_smaller_number.is_err());\n\n// Returns `Ok(3)`.\nlet try_successful_smaller_number = i32::try_from(3);\nassert!(try_successful_smaller_number.is_ok());\n```\n\n[`try_from`]: TryFrom::try_from"},"deprecated":false,"sortText":"ffffffef","filterText":"TryFrom","textEdit":{"newText":"TryFrom","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"TryInto","kind":8,"documentation":{"kind":"markdown","value":"An attempted conversion that consumes `self`, which may or may not be\nexpensive.\n\nLibrary authors should usually not directly implement this trait,\nbut should prefer implementing the [`TryFrom`] trait, which offers\ngreater flexibility and provides an equivalent `TryInto`\nimplementation for free, thanks to a blanket implementation in the\nstandard library. For more information on this, see the\ndocumentation for [`Into`].\n\n# Implementing `TryInto`\n\nThis suffers the same restrictions and reasoning as implementing\n[`Into`], see there for details."},"deprecated":false,"sortText":"ffffffef","filterText":"TryInto","textEdit":{"newText":"TryInto","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"Vec","kind":22,"documentation":{"kind":"markdown","value":"A contiguous growable array type, written as `Vec`, short for 'vector'.\n\n# Examples\n\n```rust\nlet mut vec = Vec::new();\nvec.push(1);\nvec.push(2);\n\nassert_eq!(vec.len(), 2);\nassert_eq!(vec[0], 1);\n\nassert_eq!(vec.pop(), Some(2));\nassert_eq!(vec.len(), 1);\n\nvec[0] = 7;\nassert_eq!(vec[0], 7);\n\nvec.extend([1, 2, 3]);\n\nfor x in &vec {\n println!(\"{x}\");\n}\nassert_eq!(vec, [7, 1, 2, 3]);\n```\n\nThe [`vec!`] macro is provided for convenient initialization:\n\n```rust\nlet mut vec1 = vec![1, 2, 3];\nvec1.push(4);\nlet vec2 = Vec::from([1, 2, 3, 4]);\nassert_eq!(vec1, vec2);\n```\n\nIt can also initialize each element of a `Vec` with a given value.\nThis may be more efficient than performing allocation and initialization\nin separate steps, especially when initializing a vector of zeros:\n\n```rust\nlet vec = vec![0; 5];\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n\n// The following is equivalent, but potentially slower:\nlet mut vec = Vec::with_capacity(5);\nvec.resize(5, 0);\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n```\n\nFor more information, see\n[Capacity and Reallocation](#capacity-and-reallocation).\n\nUse a `Vec` as an efficient stack:\n\n```rust\nlet mut stack = Vec::new();\n\nstack.push(1);\nstack.push(2);\nstack.push(3);\n\nwhile let Some(top) = stack.pop() {\n // Prints 3, 2, 1\n println!(\"{top}\");\n}\n```\n\n# Indexing\n\nThe `Vec` type allows access to values by index, because it implements the\n[`Index`] trait. An example will be more explicit:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[1]); // it will display '2'\n```\n\nHowever be careful: if you try to access an index which isn't in the `Vec`,\nyour software will panic! You cannot do this:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[6]); // it will panic!\n```\n\nUse [`get`] and [`get_mut`] if you want to check whether the index is in\nthe `Vec`.\n\n# Slicing\n\nA `Vec` can be mutable. On the other hand, slices are read-only objects.\nTo get a [slice][prim@slice], use [`&`]. Example:\n\n```rust\nfn read_slice(slice: &[usize]) {\n // ...\n}\n\nlet v = vec![0, 1];\nread_slice(&v);\n\n// ... and that's all!\n// you can also do it like this:\nlet u: &[usize] = &v;\n// or like this:\nlet u: &[_] = &v;\n```\n\nIn Rust, it's more common to pass slices as arguments rather than vectors\nwhen you just want to provide read access. The same goes for [`String`] and\n[`&str`].\n\n# Capacity and reallocation\n\nThe capacity of a vector is the amount of space allocated for any future\nelements that will be added onto the vector. This is not to be confused with\nthe *length* of a vector, which specifies the number of actual elements\nwithin the vector. If a vector's length exceeds its capacity, its capacity\nwill automatically be increased, but its elements will have to be\nreallocated.\n\nFor example, a vector with capacity 10 and length 0 would be an empty vector\nwith space for 10 more elements. Pushing 10 or fewer elements onto the\nvector will not change its capacity or cause reallocation to occur. However,\nif the vector's length is increased to 11, it will have to reallocate, which\ncan be slow. For this reason, it is recommended to use [`Vec::with_capacity`]\nwhenever possible to specify how big the vector is expected to get.\n\n# Guarantees\n\nDue to its incredibly fundamental nature, `Vec` makes a lot of guarantees\nabout its design. This ensures that it's as low-overhead as possible in\nthe general case, and can be correctly manipulated in primitive ways\nby unsafe code. Note that these guarantees refer to an unqualified `Vec`.\nIf additional type parameters are added (e.g., to support custom allocators),\noverriding their defaults may change the behavior.\n\nMost fundamentally, `Vec` is and always will be a (pointer, capacity, length)\ntriplet. No more, no less. The order of these fields is completely\nunspecified, and you should use the appropriate methods to modify these.\nThe pointer will never be null, so this type is null-pointer-optimized.\n\nHowever, the pointer might not actually point to allocated memory. In particular,\nif you construct a `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],\n[`Vec::with_capacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]\non an empty Vec, it will not allocate memory. Similarly, if you store zero-sized\ntypes inside a `Vec`, it will not allocate space for them. *Note that in this case\nthe `Vec` might not report a [`capacity`] of 0*. `Vec` will allocate if and only\nif [mem::size_of::\\]\\() * [capacity]\\() > 0. In general, `Vec`'s allocation\ndetails are very subtle --- if you intend to allocate memory using a `Vec`\nand use it for something else (either to pass to unsafe code, or to build your\nown memory-backed collection), be sure to deallocate this memory by using\n`from_raw_parts` to recover the `Vec` and then dropping it.\n\nIf a `Vec` *has* allocated memory, then the memory it points to is on the heap\n(as defined by the allocator Rust is configured to use by default), and its\npointer points to [`len`] initialized, contiguous elements in order (what\nyou would see if you coerced it to a slice), followed by [capacity] - [len]\nlogically uninitialized, contiguous elements.\n\nA vector containing the elements `'a'` and `'b'` with capacity 4 can be\nvisualized as below. The top part is the `Vec` struct, it contains a\npointer to the head of the allocation in the heap, length and capacity.\nThe bottom part is the allocation on the heap, a contiguous memory block.\n\n```text\n ptr len capacity\n +--------+--------+--------+\n | 0x0123 | 2 | 4 |\n +--------+--------+--------+\n |\n v\nHeap +--------+--------+--------+--------+\n | 'a' | 'b' | uninit | uninit |\n +--------+--------+--------+--------+\n```\n\n- **uninit** represents memory that is not initialized, see [`MaybeUninit`].\n- Note: the ABI is not stable and `Vec` makes no guarantees about its memory\n layout (including the order of fields).\n\n`Vec` will never perform a \"small optimization\" where elements are actually\nstored on the stack for two reasons:\n\n* It would make it more difficult for unsafe code to correctly manipulate\n a `Vec`. The contents of a `Vec` wouldn't have a stable address if it were\n only moved, and it would be more difficult to determine if a `Vec` had\n actually allocated memory.\n\n* It would penalize the general case, incurring an additional branch\n on every access.\n\n`Vec` will never automatically shrink itself, even if completely empty. This\nensures no unnecessary allocations or deallocations occur. Emptying a `Vec`\nand then filling it back up to the same [`len`] should incur no calls to\nthe allocator. If you wish to free up unused memory, use\n[`shrink_to_fit`] or [`shrink_to`].\n\n[`push`] and [`insert`] will never (re)allocate if the reported capacity is\nsufficient. [`push`] and [`insert`] *will* (re)allocate if\n[len] == [capacity]. That is, the reported capacity is completely\naccurate, and can be relied on. It can even be used to manually free the memory\nallocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even\nwhen not necessary.\n\n`Vec` does not guarantee any particular growth strategy when reallocating\nwhen full, nor when [`reserve`] is called. The current strategy is basic\nand it may prove desirable to use a non-constant growth factor. Whatever\nstrategy is used will of course guarantee *O*(1) amortized [`push`].\n\n`vec![x; n]`, `vec![a, b, c, d]`, and\n[`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`\nwith exactly the requested capacity. If [len] == [capacity],\n(as is the case for the [`vec!`] macro), then a `Vec` can be converted to\nand from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.\n\n`Vec` will not specifically overwrite any data that is removed from it,\nbut also won't specifically preserve it. Its uninitialized memory is\nscratch space that it may use however it wants. It will generally just do\nwhatever is most efficient or otherwise easy to implement. Do not rely on\nremoved data to be erased for security purposes. Even if you drop a `Vec`, its\nbuffer may simply be reused by another allocation. Even if you zero a `Vec`'s memory\nfirst, that might not actually happen because the optimizer does not consider\nthis a side-effect that must be preserved. There is one case which we will\nnot break, however: using `unsafe` code to write to the excess capacity,\nand then increasing the length to match, is always valid.\n\nCurrently, `Vec` does not guarantee the order in which elements are dropped.\nThe order has changed in the past and may change again.\n\n[`get`]: slice::get\n[`get_mut`]: slice::get_mut\n[`String`]: crate::string::String\n[`&str`]: type@str\n[`shrink_to_fit`]: Vec::shrink_to_fit\n[`shrink_to`]: Vec::shrink_to\n[capacity]: Vec::capacity\n[`capacity`]: Vec::capacity\n[mem::size_of::\\]: core::mem::size_of\n[len]: Vec::len\n[`len`]: Vec::len\n[`push`]: Vec::push\n[`insert`]: Vec::insert\n[`reserve`]: Vec::reserve\n[`MaybeUninit`]: core::mem::MaybeUninit\n[owned slice]: Box"},"deprecated":false,"sortText":"ffffffef","filterText":"Vec","textEdit":{"newText":"Vec","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"alloc_error_handler","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"alloc_error_handler","textEdit":{"newText":"alloc_error_handler","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"drop(…)","kind":3,"detail":"fn(T)","documentation":{"kind":"markdown","value":"Disposes of a value.\n\nThis does so by calling the argument's implementation of [`Drop`][drop].\n\nThis effectively does nothing for types which implement `Copy`, e.g.\nintegers. Such values are copied and _then_ moved into the function, so the\nvalue persists after this function call.\n\nThis function is not magic; it is literally defined as\n\n```rust\npub fn drop(_x: T) {}\n```\n\nBecause `_x` is moved into the function, it is automatically dropped before\nthe function returns.\n\n[drop]: Drop\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = vec![1, 2, 3];\n\ndrop(v); // explicitly drop the vector\n```\n\nSince [`RefCell`] enforces the borrow rules at runtime, `drop` can\nrelease a [`RefCell`] borrow:\n\n```rust\nuse std::cell::RefCell;\n\nlet x = RefCell::new(1);\n\nlet mut mutable_borrow = x.borrow_mut();\n*mutable_borrow = 1;\n\ndrop(mutable_borrow); // relinquish the mutable borrow on this slot\n\nlet borrow = x.borrow();\nprintln!(\"{}\", *borrow);\n```\n\nIntegers and other types implementing [`Copy`] are unaffected by `drop`.\n\n```rust\n#[derive(Copy, Clone)]\nstruct Foo(u8);\n\nlet x = 1;\nlet y = Foo(2);\ndrop(x); // a copy of `x` is moved and dropped\ndrop(y); // a copy of `y` is moved and dropped\n\nprintln!(\"x: {}, y: {}\", x, y.0); // still available\n```\n\n[`RefCell`]: crate::cell::RefCell"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"drop","insertTextFormat":2,"textEdit":{"newText":"drop(${1:x})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"type_ascribe","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"type_ascribe","textEdit":{"newText":"type_ascribe","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"unsafe","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"unsafe","insertTextFormat":2,"textEdit":{"newText":"unsafe {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"match","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"match","insertTextFormat":2,"textEdit":{"newText":"match $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"while","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"while","insertTextFormat":2,"textEdit":{"newText":"while $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"while let","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"while let","insertTextFormat":2,"textEdit":{"newText":"while let $1 = $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"loop","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"loop","insertTextFormat":2,"textEdit":{"newText":"loop {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"if","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"if","insertTextFormat":2,"textEdit":{"newText":"if $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"if let","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"if let","insertTextFormat":2,"textEdit":{"newText":"if let $1 = $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"for","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"for","insertTextFormat":2,"textEdit":{"newText":"for $1 in $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"true","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"true","insertTextFormat":2,"textEdit":{"newText":"true","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"false","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"false","insertTextFormat":2,"textEdit":{"newText":"false","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]},{"label":"return","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"return","insertTextFormat":2,"textEdit":{"newText":"return","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":24}}},"additionalTextEdits":[]}]}} 2023-12-27T20:29:11.949 helix_lsp::transport [INFO] rust-analyzer <- {"isIncomplete":true,"items":[{"additionalTextEdits":[],"deprecated":false,"filterText":"self::","kind":14,"label":"self::","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"self::","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"crate::","kind":14,"label":"crate::","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"crate::","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"fn()","filterText":"main","insertTextFormat":2,"kind":3,"label":"main()","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"main()$0","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! panic","filterText":"panic!","insertTextFormat":2,"kind":3,"label":"panic!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"panic!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! println","documentation":{"kind":"markdown","value":"Prints to the standard output, with a newline.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`)).\n\nThis macro uses the same syntax as [`format!`], but writes to the standard output instead.\nSee [`std::fmt`] for more information.\n\nThe `println!` macro will lock the standard output on each call. If you call\n`println!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwriteln!(lock, \"hello world\").unwrap();\n```\n\nUse `println!` only for the primary output of your program. Use\n[`eprintln!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`std::fmt`]: crate::fmt\n[`eprintln!`]: crate::eprintln\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to [`io::stdout`] fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n[`io::stdout`]: crate::io::stdout\n\n# Examples\n\n```rust\nprintln!(); // prints just a newline\nprintln!(\"hello there!\");\nprintln!(\"format {} arguments\", \"some\");\nlet local_variable = \"some\";\nprintln!(\"format {local_variable} arguments\");\n```"},"filterText":"println!","insertTextFormat":2,"kind":3,"label":"println!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"println!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_eq!`], `debug_assert_eq!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_eq!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_eq!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_eq!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\ndebug_assert_eq!(a, b);\n```"},"filterText":"debug_assert_eq!","insertTextFormat":2,"kind":3,"label":"debug_assert_eq!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert_eq!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include_str","documentation":{"kind":"markdown","value":"Includes a UTF-8 encoded file as a string.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static str` which is the\ncontents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_str = include_str!(\"spanish.in\");\n assert_eq!(my_str, \"adiós\\n\");\n print!(\"{my_str}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"filterText":"include_str!","insertTextFormat":2,"kind":3,"label":"include_str!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"include_str!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat","documentation":{"kind":"markdown","value":"Concatenates literals into a static string slice.\n\nThis macro takes any number of comma-separated literals, yielding an\nexpression of type `&'static str` which represents all of the literals\nconcatenated left-to-right.\n\nInteger and floating point literals are [stringified](core::stringify) in order to be\nconcatenated.\n\n# Examples\n\n```rust\nlet s = concat!(\"test\", 10, 'b', true);\nassert_eq!(s, \"test10btrue\");\n```"},"filterText":"concat!","insertTextFormat":2,"kind":3,"label":"concat!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"concat!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format","documentation":{"kind":"markdown","value":"Creates a `String` using interpolation of runtime expressions.\n\nThe first argument `format!` receives is a format string. This must be a string\nliteral. The power of the formatting string is in the `{}`s contained.\nAdditional parameters passed to `format!` replace the `{}`s within the\nformatting string in the order given unless named or positional parameters\nare used.\n\nSee [the formatting syntax documentation in `std::fmt`](../std/fmt/index.html)\nfor details.\n\nA common use for `format!` is concatenation and interpolation of strings.\nThe same convention is used with [`print!`] and [`write!`] macros,\ndepending on the intended destination of the string; all these macros internally use [`format_args!`].\n\nTo convert a single value to a string, use the [`to_string`] method. This\nwill use the [`Display`] formatting trait.\n\nTo concatenate literals into a `&'static str`, use the [`concat!`] macro.\n\n[`print!`]: ../std/macro.print.html\n[`write!`]: core::write\n[`format_args!`]: core::format_args\n[`to_string`]: crate::string::ToString\n[`Display`]: core::fmt::Display\n[`concat!`]: core::concat\n\n# Panics\n\n`format!` panics if a formatting trait implementation returns an error.\nThis indicates an incorrect implementation\nsince `fmt::Write for String` never returns an error itself.\n\n# Examples\n\n```rust\nformat!(\"test\"); // => \"test\"\nformat!(\"hello {}\", \"world!\"); // => \"hello world!\"\nformat!(\"x = {}, y = {val}\", 10, val = 30); // => \"x = 10, y = 30\"\nlet (x, y) = (1, 2);\nformat!(\"{x} + {y} = 3\"); // => \"1 + 2 = 3\"\n```"},"filterText":"format!","insertTextFormat":2,"kind":3,"label":"format!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"format!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! log_syntax","documentation":{"kind":"markdown","value":"Prints passed tokens into the standard output."},"filterText":"log_syntax!","insertTextFormat":2,"kind":3,"label":"log_syntax!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"log_syntax!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! stringify","documentation":{"kind":"markdown","value":"Stringifies its arguments.\n\nThis macro will yield an expression of type `&'static str` which is the\nstringification of all the tokens passed to the macro. No restrictions\nare placed on the syntax of the macro invocation itself.\n\nNote that the expanded results of the input tokens may change in the\nfuture. You should be careful if you rely on the output.\n\n# Examples\n\n```rust\nlet one_plus_one = stringify!(1 + 1);\nassert_eq!(one_plus_one, \"1 + 1\");\n```"},"filterText":"stringify!","insertTextFormat":2,"kind":3,"label":"stringify!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"stringify!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\nassert_ne!(a, b);\n\nassert_ne!(a, b, \"we are testing that the values are not equal\");\n```"},"filterText":"assert_ne!","insertTextFormat":2,"kind":3,"label":"assert_ne!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"assert_ne!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! dbg","documentation":{"kind":"markdown","value":"Prints and returns the value of a given expression for quick and dirty\ndebugging.\n\nAn example:\n\n```rust\nlet a = 2;\nlet b = dbg!(a * 2) + 1;\n// ^-- prints: [src/main.rs:2] a * 2 = 4\nassert_eq!(b, 5);\n```\n\nThe macro works by using the `Debug` implementation of the type of\nthe given expression to print the value to [stderr] along with the\nsource location of the macro invocation as well as the source code\nof the expression.\n\nInvoking the macro on an expression moves and takes ownership of it\nbefore returning the evaluated expression unchanged. If the type\nof the expression does not implement `Copy` and you don't want\nto give up ownership, you can instead borrow with `dbg!(&expr)`\nfor some expression `expr`.\n\nThe `dbg!` macro works exactly the same in release builds.\nThis is useful when debugging issues that only occur in release\nbuilds or when debugging in release mode is significantly faster.\n\nNote that the macro is intended as a debugging tool and therefore you\nshould avoid having uses of it in version control for long periods\n(other than in tests and similar).\nDebug output from production code is better done with other facilities\nsuch as the [`debug!`] macro from the [`log`] crate.\n\n# Stability\n\nThe exact output printed by this macro should not be relied upon\nand is subject to future changes.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\n# Further examples\n\nWith a method call:\n\n```rust\nfn foo(n: usize) {\n if let Some(_) = dbg!(n.checked_sub(4)) {\n // ...\n }\n}\n\nfoo(3)\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:4] n.checked_sub(4) = None\n```\n\nNaive factorial implementation:\n\n```rust\nfn factorial(n: u32) -> u32 {\n if dbg!(n <= 1) {\n dbg!(1)\n } else {\n dbg!(n * factorial(n - 1))\n }\n}\n\ndbg!(factorial(4));\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = true\n[src/main.rs:4] 1 = 1\n[src/main.rs:5] n * factorial(n - 1) = 2\n[src/main.rs:5] n * factorial(n - 1) = 6\n[src/main.rs:5] n * factorial(n - 1) = 24\n[src/main.rs:11] factorial(4) = 24\n```\n\nThe `dbg!(..)` macro moves the input:\n\n```rust\n/// A wrapper around `usize` which importantly is not Copyable.\n#[derive(Debug)]\nstruct NoCopy(usize);\n\nlet a = NoCopy(42);\nlet _ = dbg!(a); // <-- `a` is moved here.\nlet _ = dbg!(a); // <-- `a` is moved again; error!\n```\n\nYou can also use `dbg!()` without a value to just print the\nfile and line whenever it's reached.\n\nFinally, if you want to `dbg!(..)` multiple values, it will treat them as\na tuple (and return it, too):\n\n```rust\nassert_eq!(dbg!(1usize, 2u32), (1, 2));\n```\n\nHowever, a single argument with a trailing comma will still not be treated\nas a tuple, following the convention of ignoring trailing commas in macro\ninvocations. You can use a 1-tuple directly if you need one:\n\n```rust\nassert_eq!(1, dbg!(1u32,)); // trailing comma ignored\nassert_eq!((1,), dbg!((1u32,))); // 1-tuple\n```\n\n[stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)\n[`debug!`]: https://docs.rs/log/*/log/macro.debug.html\n[`log`]: https://crates.io/crates/log"},"filterText":"dbg!","insertTextFormat":2,"kind":3,"label":"dbg!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"dbg!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! vec","documentation":{"kind":"markdown","value":"Creates a [`Vec`] containing the arguments.\n\n`vec!` allows `Vec`s to be defined with the same syntax as array expressions.\nThere are two forms of this macro:\n\n- Create a [`Vec`] containing a given list of elements:\n\n```rust\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```\n\n- Create a [`Vec`] from a given element and size:\n\n```rust\nlet v = vec![1; 3];\nassert_eq!(v, [1, 1, 1]);\n```\n\nNote that unlike array expressions this syntax supports all elements\nwhich implement [`Clone`] and the number of elements doesn't have to be\na constant.\n\nThis will use `clone` to duplicate an expression, so one should be careful\nusing this with types having a nonstandard `Clone` implementation. For\nexample, `vec![Rc::new(1); 5]` will create a vector of five references\nto the same boxed integer value, not five references pointing to independently\nboxed integers.\n\nAlso, note that `vec![expr; 0]` is allowed, and produces an empty vector.\nThis will still evaluate `expr`, however, and immediately drop the resulting value, so\nbe mindful of side effects.\n\n[`Vec`]: crate::vec::Vec"},"filterText":"vec!","insertTextFormat":2,"kind":3,"label":"vec![…]","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"vec![$0]","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include","documentation":{"kind":"markdown","value":"Parses a file as an expression or an item according to the context.\n\n**Warning**: For multi-file Rust projects, the `include!` macro is probably not what you\nare looking for. Usually, multi-file Rust projects use\n[modules](https://doc.rust-lang.org/reference/items/modules.html). Multi-file projects and\nmodules are explained in the Rust-by-Example book\n[here](https://doc.rust-lang.org/rust-by-example/mod/split.html) and the module system is\nexplained in the Rust Book\n[here](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html).\n\nThe included file is placed in the surrounding code\n[unhygienically](https://doc.rust-lang.org/reference/macros-by-example.html#hygiene). If\nthe included file is parsed as an expression and variables or functions share names across\nboth files, it could result in variables or functions being different from what the\nincluded file expected.\n\nThe included file is located relative to the current file (similarly to how modules are\nfound). The provided path is interpreted in a platform-specific way at compile time. So,\nfor instance, an invocation with a Windows path containing backslashes `\\` would not\ncompile correctly on Unix.\n\n# Uses\n\nThe `include!` macro is primarily used for two purposes. It is used to include\ndocumentation that is written in a separate file and it is used to include [build artifacts\nusually as a result from the `build.rs`\nscript](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script).\n\nWhen using the `include` macro to include stretches of documentation, remember that the\nincluded file still needs to be a valid rust syntax. It is also possible to\nuse the [`include_str`] macro as `#![doc = include_str!(\"...\")]` (at the module level) or\n`#[doc = include_str!(\"...\")]` (at the item level) to include documentation from a plain\ntext or markdown file.\n\n# Examples\n\nAssume there are two files in the same directory with the following contents:\n\nFile 'monkeys.in':\n\n```rust\n['🙈', '🙊', '🙉']\n .iter()\n .cycle()\n .take(6)\n .collect::()\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_string = include!(\"monkeys.in\");\n assert_eq!(\"🙈🙊🙉🙈🙊🙉\", my_string);\n println!(\"{my_string}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print\n\"🙈🙊🙉🙈🙊🙉\"."},"filterText":"include!","insertTextFormat":2,"kind":3,"label":"include!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"include!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! print","documentation":{"kind":"markdown","value":"Prints to the standard output.\n\nEquivalent to the [`println!`] macro except that a newline is not printed at\nthe end of the message.\n\nNote that stdout is frequently line-buffered by default so it may be\nnecessary to use [`io::stdout().flush()`][flush] to ensure the output is emitted\nimmediately.\n\nThe `print!` macro will lock the standard output on each call. If you call\n`print!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwrite!(lock, \"hello world\").unwrap();\n```\n\nUse `print!` only for the primary output of your program. Use\n[`eprint!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[flush]: crate::io::Write::flush\n[`println!`]: crate::println\n[`eprint!`]: crate::eprint\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to `io::stdout()` fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\nuse std::io::{self, Write};\n\nprint!(\"this \");\nprint!(\"will \");\nprint!(\"be \");\nprint!(\"on \");\nprint!(\"the \");\nprint!(\"same \");\nprint!(\"line \");\n\nio::stdout().flush().unwrap();\n\nprint!(\"this string has a newline, why not choose println! instead?\\n\");\n\nio::stdout().flush().unwrap();\n```"},"filterText":"print!","insertTextFormat":2,"kind":3,"label":"print!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"print!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro cfg_match","documentation":{"kind":"markdown","value":"A macro for defining `#[cfg]` match-like statements.\n\nIt is similar to the `if/elif` C preprocessor macro by allowing definition of a cascade of\n`#[cfg]` cases, emitting the implementation which matches first.\n\nThis allows you to conveniently provide a long list `#[cfg]`'d blocks of code\nwithout having to rewrite each clause multiple times.\n\nTrailing `_` wildcard match arms are **optional** and they indicate a fallback branch when\nall previous declarations do not evaluate to true.\n\n# Example\n\n```rust\n#![feature(cfg_match)]\n\ncfg_match! {\n cfg(unix) => {\n fn foo() { /* unix specific functionality */ }\n }\n cfg(target_pointer_width = \"32\") => {\n fn foo() { /* non-unix, 32-bit functionality */ }\n }\n _ => {\n fn foo() { /* fallback implementation */ }\n }\n}\n```"},"filterText":"cfg_match!","insertTextFormat":2,"kind":3,"label":"cfg_match! {…}","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"cfg_match! {$0}","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat_idents","documentation":{"kind":"markdown","value":"Concatenates identifiers into one identifier.\n\nThis macro takes any number of comma-separated identifiers, and\nconcatenates them all into one, yielding an expression which is a new\nidentifier. Note that hygiene makes it such that this macro cannot\ncapture local variables. Also, as a general rule, macros are only\nallowed in item, statement or expression position. That means while\nyou may use this macro for referring to existing variables, functions or\nmodules etc, you cannot define a new one with it.\n\n# Examples\n\n```rust\n#![feature(concat_idents)]\n\nfn foobar() -> u32 { 23 }\n\nlet f = concat_idents!(foo, bar);\nprintln!(\"{}\", f());\n\n// fn concat_idents!(new, fun, name) { } // not usable in this way!\n```"},"filterText":"concat_idents!","insertTextFormat":2,"kind":3,"label":"concat_idents!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"concat_idents!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! write","documentation":{"kind":"markdown","value":"Writes formatted data into a buffer.\n\nThis macro accepts a 'writer', a format string, and a list of arguments. Arguments will be\nformatted according to the specified format string and the result will be passed to the writer.\nThe writer may be any value with a `write_fmt` method; generally this comes from an\nimplementation of either the [`fmt::Write`] or the [`io::Write`] trait. The macro\nreturns whatever the `write_fmt` method returns; commonly a [`fmt::Result`], or an\n[`io::Result`].\n\nSee [`std::fmt`] for more information on the format string syntax.\n\n[`std::fmt`]: ../std/fmt/index.html\n[`fmt::Write`]: crate::fmt::Write\n[`io::Write`]: ../std/io/trait.Write.html\n[`fmt::Result`]: crate::fmt::Result\n[`io::Result`]: ../std/io/type.Result.html\n\n# Examples\n\n```rust\nuse std::io::Write;\n\nfn main() -> std::io::Result<()> {\n let mut w = Vec::new();\n write!(&mut w, \"test\")?;\n write!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(w, b\"testformatted arguments\");\n Ok(())\n}\n```\n\nA module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects\nimplementing either, as objects do not typically implement both. However, the module must\navoid conflict between the trait names, such as by importing them as `_` or otherwise renaming\nthem:\n\n```rust\nuse std::fmt::Write as _;\nuse std::io::Write as _;\n\nfn main() -> Result<(), Box> {\n let mut s = String::new();\n let mut v = Vec::new();\n\n write!(&mut s, \"{} {}\", \"abc\", 123)?; // uses fmt::Write::write_fmt\n write!(&mut v, \"s = {:?}\", s)?; // uses io::Write::write_fmt\n assert_eq!(v, b\"s = \\\"abc 123\\\"\");\n Ok(())\n}\n```\n\nIf you also need the trait names themselves, such as to implement one or both on your types,\nimport the containing module and then name them with a prefix:\n\n```rust\nuse std::fmt::{self, Write as _};\nuse std::io::{self, Write as _};\n\nstruct Example;\n\nimpl fmt::Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n```\n\nNote: This macro can be used in `no_std` setups as well.\nIn a `no_std` setup you are responsible for the implementation details of the components.\n\n```rust\nuse core::fmt::Write;\n\nstruct Example;\n\nimpl Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n\nlet mut m = Example{};\nwrite!(&mut m, \"Hello World\").expect(\"Not written\");\n```"},"filterText":"write!","insertTextFormat":2,"kind":3,"label":"write!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"write!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! line","documentation":{"kind":"markdown","value":"Expands to the line number on which it was invoked.\n\nWith [`column!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first line\nin each file evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned line is *not necessarily* the line of the `line!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `line!` macro.\n\n# Examples\n\n```rust\nlet current_line = line!();\nprintln!(\"defined on line: {current_line}\");\n```"},"filterText":"line!","insertTextFormat":2,"kind":3,"label":"line!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"line!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\nLike [`assert!`], this macro also has a second version, where a custom panic\nmessage can be provided.\n\n# Uses\n\nUnlike [`assert!`], `debug_assert!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert!` is always type checked.\n\nAn unchecked assertion allows a program in an inconsistent state to keep\nrunning, which might have unexpected consequences but does not introduce\nunsafety as long as this only happens in safe code. The performance cost\nof assertions, however, is not measurable in general. Replacing [`assert!`]\nwith `debug_assert!` is thus only encouraged after thorough profiling, and\nmore importantly, only in safe code!\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\ndebug_assert!(true);\n\nfn some_expensive_computation() -> bool { true } // a very simple function\ndebug_assert!(some_expensive_computation());\n\n// assert with a custom message\nlet x = true;\ndebug_assert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\ndebug_assert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"filterText":"debug_assert!","insertTextFormat":2,"kind":3,"label":"debug_assert!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include_bytes","documentation":{"kind":"markdown","value":"Includes a file as a reference to a byte array.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static [u8; N]` which is\nthe contents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let bytes = include_bytes!(\"spanish.in\");\n assert_eq!(bytes, b\"adi\\xc3\\xb3s\\n\");\n print!(\"{}\", String::from_utf8_lossy(bytes));\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"filterText":"include_bytes!","insertTextFormat":2,"kind":3,"label":"include_bytes!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"include_bytes!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! const_format_args","documentation":{"kind":"markdown","value":"Same as [`format_args`], but can be used in some const contexts.\n\nThis macro is used by the panic macros for the `const_panic` feature.\n\nThis macro will be removed once `format_args` is allowed in const contexts."},"filterText":"const_format_args!","insertTextFormat":2,"kind":3,"label":"const_format_args!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"const_format_args!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! env","documentation":{"kind":"markdown","value":"Inspects an environment variable at compile time.\n\nThis macro will expand to the value of the named environment variable at\ncompile time, yielding an expression of type `&'static str`. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nIf the environment variable is not defined, then a compilation error\nwill be emitted. To not emit a compile error, use the [`option_env!`]\nmacro instead.\n\n# Examples\n\n```rust\nlet path: &'static str = env!(\"PATH\");\nprintln!(\"the $PATH variable at the time of compiling was: {path}\");\n```\n\nYou can customize the error message by passing a string as the second\nparameter:\n\n```rust\nlet doc: &'static str = env!(\"documentation\", \"what's that?!\");\n```\n\nIf the `documentation` environment variable is not defined, you'll get\nthe following error:\n\n```text\nerror: what's that?!\n```"},"filterText":"env!","insertTextFormat":2,"kind":3,"label":"env!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"env!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":true,"detail":"macro_rules! r#try","documentation":{"kind":"markdown","value":"Unwraps a result or propagates its error.\n\nThe [`?` operator][propagating-errors] was added to replace `try!`\nand should be used instead. Furthermore, `try` is a reserved word\nin Rust 2018, so if you must use it, you will need to use the\n[raw-identifier syntax][ris]: `r#try`.\n\n[propagating-errors]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator\n[ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html\n\n`try!` matches the given [`Result`]. In case of the `Ok` variant, the\nexpression has the value of the wrapped value.\n\nIn case of the `Err` variant, it retrieves the inner error. `try!` then\nperforms conversion using `From`. This provides automatic conversion\nbetween specialized errors and more general ones. The resulting\nerror is then immediately returned.\n\nBecause of the early return, `try!` can only be used in functions that\nreturn [`Result`].\n\n# Examples\n\n```rust\nuse std::io;\nuse std::fs::File;\nuse std::io::prelude::*;\n\nenum MyError {\n FileWriteError\n}\n\nimpl From for MyError {\n fn from(e: io::Error) -> MyError {\n MyError::FileWriteError\n }\n}\n\n// The preferred method of quick returning Errors\nfn write_to_file_question() -> Result<(), MyError> {\n let mut file = File::create(\"my_best_friends.txt\")?;\n file.write_all(b\"This is a list of my best friends.\")?;\n Ok(())\n}\n\n// The previous method of quick returning Errors\nfn write_to_file_using_try() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n r#try!(file.write_all(b\"This is a list of my best friends.\"));\n Ok(())\n}\n\n// This is equivalent to:\nfn write_to_file_using_match() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n match file.write_all(b\"This is a list of my best friends.\") {\n Ok(v) => v,\n Err(e) => return Err(From::from(e)),\n }\n Ok(())\n}\n```"},"filterText":"try!","insertTextFormat":2,"kind":3,"label":"try!(…)","sortText":"ffffffef","tags":[1],"textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"r#try!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! file","documentation":{"kind":"markdown","value":"Expands to the file name in which it was invoked.\n\nWith [`line!`] and [`column!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `&'static str`, and the returned file\nis not the invocation of the `file!` macro itself, but rather the\nfirst macro invocation leading up to the invocation of the `file!`\nmacro.\n\n# Examples\n\n```rust\nlet this_file = file!();\nprintln!(\"defined in file: {this_file}\");\n```"},"filterText":"file!","insertTextFormat":2,"kind":3,"label":"file!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"file!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! thread_local","documentation":{"kind":"markdown","value":"Declare a new thread local storage key of type [`std::thread::LocalKey`].\n\n# Syntax\n\nThe macro wraps any number of static declarations and makes them thread local.\nPublicity and attributes for each static are allowed. Example:\n\n```rust\nuse std::cell::RefCell;\nthread_local! {\n pub static FOO: RefCell = RefCell::new(1);\n\n static BAR: RefCell = RefCell::new(1.0);\n}\n\nFOO.with(|foo| assert_eq!(*foo.borrow(), 1));\nBAR.with(|bar| assert_eq!(*bar.borrow(), 1.0));\n```\n\nThis macro supports a special `const {}` syntax that can be used\nwhen the initialization expression can be evaluated as a constant.\nThis can enable a more efficient thread local implementation that\ncan avoid lazy initialization. For types that do not\n[need to be dropped][crate::mem::needs_drop], this can enable an\neven more efficient implementation that does not need to\ntrack any additional state.\n\n```rust\nuse std::cell::Cell;\nthread_local! {\n pub static FOO: Cell = const { Cell::new(1) };\n}\n\nFOO.with(|foo| assert_eq!(foo.get(), 1));\n```\n\nSee [`LocalKey` documentation][`std::thread::LocalKey`] for more\ninformation.\n\n[`std::thread::LocalKey`]: crate::thread::LocalKey"},"filterText":"thread_local!","insertTextFormat":2,"kind":3,"label":"thread_local! {…}","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"thread_local! {$0}","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\n# Uses\n\nAssertions are always checked in both debug and release builds, and cannot\nbe disabled. See [`debug_assert!`] for assertions that are not enabled in\nrelease builds by default.\n\nUnsafe code may rely on `assert!` to enforce run-time invariants that, if\nviolated could lead to unsafety.\n\nOther use-cases of `assert!` include testing and enforcing run-time\ninvariants in safe code (whose violation cannot result in unsafety).\n\n# Custom Messages\n\nThis macro has a second form, where a custom panic message can\nbe provided with or without arguments for formatting. See [`std::fmt`]\nfor syntax for this form. Expressions used as format arguments will only\nbe evaluated if the assertion fails.\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\nassert!(true);\n\nfn some_computation() -> bool { true } // a very simple function\n\nassert!(some_computation());\n\n// assert with a custom message\nlet x = true;\nassert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\nassert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"filterText":"assert!","insertTextFormat":2,"kind":3,"label":"assert!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"assert!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! column","documentation":{"kind":"markdown","value":"Expands to the column number at which it was invoked.\n\nWith [`line!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first column\nin each line evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned column is *not necessarily* the line of the `column!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `column!` macro.\n\n# Examples\n\n```rust\nlet current_col = column!();\nprintln!(\"defined on column: {current_col}\");\n```\n\n`column!` counts Unicode code points, not bytes or graphemes. As a result, the first two\ninvocations return the same value, but the third does not.\n\n```rust\nlet a = (\"foobar\", column!()).1;\nlet b = (\"人之初性本善\", column!()).1;\nlet c = (\"f̅o̅o̅b̅a̅r̅\", column!()).1; // Uses combining overline (U+0305)\n\nassert_eq!(a, b);\nassert_ne!(b, c);\n```"},"filterText":"column!","insertTextFormat":2,"kind":3,"label":"column!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"column!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format_args_nl","documentation":{"kind":"markdown","value":"Same as [`format_args`], but adds a newline in the end."},"filterText":"format_args_nl!","insertTextFormat":2,"kind":3,"label":"format_args_nl!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"format_args_nl!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! unreachable","documentation":{"kind":"markdown","value":"Indicates unreachable code.\n\nThis is useful any time that the compiler can't determine that some code is unreachable. For\nexample:\n\n* Match arms with guard conditions.\n* Loops that dynamically terminate.\n* Iterators that dynamically terminate.\n\nIf the determination that the code is unreachable proves incorrect, the\nprogram immediately terminates with a [`panic!`].\n\nThe unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which\nwill cause undefined behavior if the code is reached.\n\n[`unreachable_unchecked`]: crate::hint::unreachable_unchecked\n\n# Panics\n\nThis will always [`panic!`] because `unreachable!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nMatch arms:\n\n```rust\nfn foo(x: Option) {\n match x {\n Some(n) if n >= 0 => println!(\"Some(Non-negative)\"),\n Some(n) if n < 0 => println!(\"Some(Negative)\"),\n Some(_) => unreachable!(), // compile error if commented out\n None => println!(\"None\")\n }\n}\n```\n\nIterators:\n\n```rust\nfn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3\n for i in 0.. {\n if 3*i < i { panic!(\"u32 overflow\"); }\n if x < 3*i { return i-1; }\n }\n unreachable!(\"The loop should always return\");\n}\n```"},"filterText":"unreachable!","insertTextFormat":2,"kind":3,"label":"unreachable!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"unreachable!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! eprintln","documentation":{"kind":"markdown","value":"Prints to the standard error, with a newline.\n\nEquivalent to the [`println!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`println!`] for\nexample usage.\n\nUse `eprintln!` only for error and progress messages. Use `println!`\ninstead for the primary output of your program.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n[`println!`]: crate::println\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprintln!(\"Error: Could not complete task\");\n```"},"filterText":"eprintln!","insertTextFormat":2,"kind":3,"label":"eprintln!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"eprintln!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! unimplemented","documentation":{"kind":"markdown","value":"Indicates unimplemented code by panicking with a message of \"not implemented\".\n\nThis allows your code to type-check, which is useful if you are prototyping or\nimplementing a trait that requires multiple methods which you don't plan to use all of.\n\nThe difference between `unimplemented!` and [`todo!`] is that while `todo!`\nconveys an intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `unimplemented!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n[`todo!`]: crate::todo\n\n# Examples\n\nSay we have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` for 'MyStruct', but for some reason it only makes sense\nto implement the `bar()` function. `baz()` and `qux()` will still need to be defined\nin our implementation of `Foo`, but we can use `unimplemented!` in their definitions\nto allow our code to compile.\n\nWe still want to have our program stop running if the unimplemented methods are\nreached.\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // It makes no sense to `baz` a `MyStruct`, so we have no logic here\n // at all.\n // This will display \"thread 'main' panicked at 'not implemented'\".\n unimplemented!();\n }\n\n fn qux(&self) -> Result {\n // We have some logic here,\n // We can add a message to unimplemented! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not implemented: MyStruct isn't quxable'\".\n unimplemented!(\"MyStruct isn't quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n}\n```"},"filterText":"unimplemented!","insertTextFormat":2,"kind":3,"label":"unimplemented!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"unimplemented!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! cfg","documentation":{"kind":"markdown","value":"Evaluates boolean combinations of configuration flags at compile-time.\n\nIn addition to the `#[cfg]` attribute, this macro is provided to allow\nboolean expression evaluation of configuration flags. This frequently\nleads to less duplicated code.\n\nThe syntax given to this macro is the same syntax as the [`cfg`]\nattribute.\n\n`cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For\nexample, all blocks in an if/else expression need to be valid when `cfg!` is used for\nthe condition, regardless of what `cfg!` is evaluating.\n\n[`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute\n\n# Examples\n\n```rust\nlet my_directory = if cfg!(windows) {\n \"windows-specific-directory\"\n} else {\n \"unix-directory\"\n};\n```"},"filterText":"cfg!","insertTextFormat":2,"kind":3,"label":"cfg!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"cfg!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! todo","documentation":{"kind":"markdown","value":"Indicates unfinished code.\n\nThis can be useful if you are prototyping and just\nwant a placeholder to let your code pass type analysis.\n\nThe difference between [`unimplemented!`] and `todo!` is that while `todo!` conveys\nan intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `todo!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nHere's an example of some in-progress code. We have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` on one of our types, but we also want to work on\njust `bar()` first. In order for our code to compile, we need to implement\n`baz()` and `qux()`, so we can use `todo!`:\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // Let's not worry about implementing baz() for now\n todo!();\n }\n\n fn qux(&self) -> Result {\n // We can add a message to todo! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not yet implemented: MyStruct is not yet quxable'\".\n todo!(\"MyStruct is not yet quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n\n // We aren't even using baz() or qux(), so this is fine.\n}\n```"},"filterText":"todo!","insertTextFormat":2,"kind":3,"label":"todo!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"todo!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! trace_macros","documentation":{"kind":"markdown","value":"Enables or disables tracing functionality used for debugging other macros."},"filterText":"trace_macros!","insertTextFormat":2,"kind":3,"label":"trace_macros!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"trace_macros!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! module_path","documentation":{"kind":"markdown","value":"Expands to a string that represents the current module path.\n\nThe current module path can be thought of as the hierarchy of modules\nleading back up to the crate root. The first component of the path\nreturned is the name of the crate currently being compiled.\n\n# Examples\n\n```rust\nmod test {\n pub fn foo() {\n assert!(module_path!().ends_with(\"test\"));\n }\n}\n\ntest::foo();\n```"},"filterText":"module_path!","insertTextFormat":2,"kind":3,"label":"module_path!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"module_path!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! option_env","documentation":{"kind":"markdown","value":"Optionally inspects an environment variable at compile time.\n\nIf the named environment variable is present at compile time, this will\nexpand into an expression of type `Option<&'static str>` whose value is\n`Some` of the value of the environment variable. If the environment\nvariable is not present, then this will expand to `None`. See\n[`Option`][Option] for more information on this type. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nA compile time error is never emitted when using this macro regardless\nof whether the environment variable is present or not.\nTo emit a compile error if the environment variable is not present,\nuse the [`env!`] macro instead.\n\n# Examples\n\n```rust\nlet key: Option<&'static str> = option_env!(\"SECRET_KEY\");\nprintln!(\"the secret key might be: {key:?}\");\n```"},"filterText":"option_env!","insertTextFormat":2,"kind":3,"label":"option_env!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"option_env!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! writeln","documentation":{"kind":"markdown","value":"Write formatted data into a buffer, with a newline appended.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`).\n\nFor more information, see [`write!`]. For information on the format string syntax, see\n[`std::fmt`].\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\nuse std::io::{Write, Result};\n\nfn main() -> Result<()> {\n let mut w = Vec::new();\n writeln!(&mut w)?;\n writeln!(&mut w, \"test\")?;\n writeln!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(&w[..], \"\\ntest\\nformatted arguments\\n\".as_bytes());\n Ok(())\n}\n```"},"filterText":"writeln!","insertTextFormat":2,"kind":3,"label":"writeln!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"writeln!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\nassert_eq!(a, b);\n\nassert_eq!(a, b, \"we are testing addition with {} and {}\", a, b);\n```"},"filterText":"assert_eq!","insertTextFormat":2,"kind":3,"label":"assert_eq!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"assert_eq!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! compile_error","documentation":{"kind":"markdown","value":"Causes compilation to fail with the given error message when encountered.\n\nThis macro should be used when a crate uses a conditional compilation strategy to provide\nbetter error messages for erroneous conditions. It's the compiler-level form of [`panic!`],\nbut emits an error during *compilation* rather than at *runtime*.\n\n# Examples\n\nTwo such examples are macros and `#[cfg]` environments.\n\nEmit a better compiler error if a macro is passed invalid values. Without the final branch,\nthe compiler would still emit an error, but the error's message would not mention the two\nvalid values.\n\n```rust\nmacro_rules! give_me_foo_or_bar {\n (foo) => {};\n (bar) => {};\n ($x:ident) => {\n compile_error!(\"This macro only accepts `foo` or `bar`\");\n }\n}\n\ngive_me_foo_or_bar!(neither);\n// ^ will fail at compile time with message \"This macro only accepts `foo` or `bar`\"\n```\n\nEmit a compiler error if one of a number of features isn't available.\n\n```rust\n#[cfg(not(any(feature = \"foo\", feature = \"bar\")))]\ncompile_error!(\"Either feature \\\"foo\\\" or \\\"bar\\\" must be enabled for this crate.\");\n```"},"filterText":"compile_error!","insertTextFormat":2,"kind":3,"label":"compile_error!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"compile_error!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! matches","documentation":{"kind":"markdown","value":"Returns whether the given expression matches any of the given patterns.\n\nLike in a `match` expression, the pattern can be optionally followed by `if`\nand a guard expression that has access to names bound by the pattern.\n\n# Examples\n\n```rust\nlet foo = 'f';\nassert!(matches!(foo, 'A'..='Z' | 'a'..='z'));\n\nlet bar = Some(4);\nassert!(matches!(bar, Some(x) if x > 2));\n```"},"filterText":"matches!","insertTextFormat":2,"kind":3,"label":"matches!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"matches!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format_args","documentation":{"kind":"markdown","value":"Constructs parameters for the other string-formatting macros.\n\nThis macro functions by taking a formatting string literal containing\n`{}` for each additional argument passed. `format_args!` prepares the\nadditional parameters to ensure the output can be interpreted as a string\nand canonicalizes the arguments into a single type. Any value that implements\nthe [`Display`] trait can be passed to `format_args!`, as can any\n[`Debug`] implementation be passed to a `{:?}` within the formatting string.\n\nThis macro produces a value of type [`fmt::Arguments`]. This value can be\npassed to the macros within [`std::fmt`] for performing useful redirection.\nAll other formatting macros ([`format!`], [`write!`], [`println!`], etc) are\nproxied through this one. `format_args!`, unlike its derived macros, avoids\nheap allocations.\n\nYou can use the [`fmt::Arguments`] value that `format_args!` returns\nin `Debug` and `Display` contexts as seen below. The example also shows\nthat `Debug` and `Display` format to the same thing: the interpolated\nformat string in `format_args!`.\n\n```rust\nlet debug = format!(\"{:?}\", format_args!(\"{} foo {:?}\", 1, 2));\nlet display = format!(\"{}\", format_args!(\"{} foo {:?}\", 1, 2));\nassert_eq!(\"1 foo 2\", display);\nassert_eq!(display, debug);\n```\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax, and further information.\n\n[`Display`]: crate::fmt::Display\n[`Debug`]: crate::fmt::Debug\n[`fmt::Arguments`]: crate::fmt::Arguments\n[`std::fmt`]: ../std/fmt/index.html\n[`format!`]: ../std/macro.format.html\n[`println!`]: ../std/macro.println.html\n\n# Examples\n\n```rust\nuse std::fmt;\n\nlet s = fmt::format(format_args!(\"hello {}\", \"world\"));\nassert_eq!(s, format!(\"hello {}\", \"world\"));\n```"},"filterText":"format_args!","insertTextFormat":2,"kind":3,"label":"format_args!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"format_args!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! is_x86_feature_detected","documentation":{"kind":"markdown","value":"A macro to test at *runtime* whether a CPU feature is available on\nx86/x86-64 platforms.\n\nThis macro is provided in the standard library and will detect at runtime\nwhether the specified CPU feature is detected. This does **not** resolve at\ncompile time unless the specified feature is already enabled for the entire\ncrate. Runtime detection currently relies mostly on the `cpuid` instruction.\n\nThis macro only takes one argument which is a string literal of the feature\nbeing tested for. The feature names supported are the lowercase versions of\nthe ones defined by Intel in [their documentation][docs].\n\n## Supported arguments\n\nThis macro supports the same names that `#[target_feature]` supports. Unlike\n`#[target_feature]`, however, this macro does not support names separated\nwith a comma. Instead testing for multiple features must be done through\nseparate macro invocations for now.\n\nSupported arguments are:\n\n* `\"aes\"`\n* `\"pclmulqdq\"`\n* `\"rdrand\"`\n* `\"rdseed\"`\n* `\"tsc\"`\n* `\"mmx\"`\n* `\"sse\"`\n* `\"sse2\"`\n* `\"sse3\"`\n* `\"ssse3\"`\n* `\"sse4.1\"`\n* `\"sse4.2\"`\n* `\"sse4a\"`\n* `\"sha\"`\n* `\"avx\"`\n* `\"avx2\"`\n* `\"avx512f\"`\n* `\"avx512cd\"`\n* `\"avx512er\"`\n* `\"avx512pf\"`\n* `\"avx512bw\"`\n* `\"avx512dq\"`\n* `\"avx512vl\"`\n* `\"avx512ifma\"`\n* `\"avx512vbmi\"`\n* `\"avx512vpopcntdq\"`\n* `\"avx512vbmi2\"`\n* `\"gfni\"`\n* `\"vaes\"`\n* `\"vpclmulqdq\"`\n* `\"avx512vnni\"`\n* `\"avx512bitalg\"`\n* `\"avx512bf16\"`\n* `\"avx512vp2intersect\"`\n* `\"f16c\"`\n* `\"fma\"`\n* `\"bmi1\"`\n* `\"bmi2\"`\n* `\"abm\"`\n* `\"lzcnt\"`\n* `\"tbm\"`\n* `\"popcnt\"`\n* `\"fxsr\"`\n* `\"xsave\"`\n* `\"xsaveopt\"`\n* `\"xsaves\"`\n* `\"xsavec\"`\n* `\"cmpxchg16b\"`\n* `\"adx\"`\n* `\"rtm\"`\n* `\"movbe\"`\n* `\"ermsb\"`\n\n[docs]: https://software.intel.com/sites/landingpage/IntrinsicsGuide"},"filterText":"is_x86_feature_detected!","insertTextFormat":2,"kind":3,"label":"is_x86_feature_detected!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"is_x86_feature_detected!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat_bytes","documentation":{"kind":"markdown","value":"Concatenates literals into a byte slice.\n\nThis macro takes any number of comma-separated literals, and concatenates them all into\none, yielding an expression of type `&[u8; _]`, which represents all of the literals\nconcatenated left-to-right. The literals passed can be any combination of:\n\n- byte literals (`b'r'`)\n- byte strings (`b\"Rust\"`)\n- arrays of bytes/numbers (`[b'A', 66, b'C']`)\n\n# Examples\n\n```rust\n#![feature(concat_bytes)]\n\nlet s: &[u8; 6] = concat_bytes!(b'A', b\"BC\", [68, b'E', 70]);\nassert_eq!(s, b\"ABCDEF\");\n```"},"filterText":"concat_bytes!","insertTextFormat":2,"kind":3,"label":"concat_bytes!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"concat_bytes!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! eprint","documentation":{"kind":"markdown","value":"Prints to the standard error.\n\nEquivalent to the [`print!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`print!`] for\nexample usage.\n\nUse `eprint!` only for error and progress messages. Use `print!`\ninstead for the primary output of your program.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprint!(\"Error: Could not complete task\");\n```"},"filterText":"eprint!","insertTextFormat":2,"kind":3,"label":"eprint!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"eprint!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_ne!`], `debug_assert_ne!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_ne!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_ne!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_ne!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\ndebug_assert_ne!(a, b);\n```"},"filterText":"debug_assert_ne!","insertTextFormat":2,"kind":3,"label":"debug_assert_ne!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert_ne!($0)","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust Standard Library\n\nThe Rust Standard Library is the foundation of portable Rust software, a\nset of minimal and battle-tested shared abstractions for the [broader Rust\necosystem][crates.io]. It offers core types, like [`Vec`] and\n[`Option`], library-defined [operations on language\nprimitives](#primitives), [standard macros](#macros), [I/O] and\n[multithreading], among [many other things][other].\n\n`std` is available to all Rust crates by default. Therefore, the\nstandard library can be accessed in [`use`] statements through the path\n`std`, as in [`use std::env`].\n\n# How to read this documentation\n\nIf you already know the name of what you are looking for, the fastest way to\nfind it is to use the search\nbar at the top of the page.\n\nOtherwise, you may want to jump to one of these useful sections:\n\n* [`std::*` modules](#modules)\n* [Primitive types](#primitives)\n* [Standard macros](#macros)\n* [The Rust Prelude]\n\nIf this is your first time, the documentation for the standard library is\nwritten to be casually perused. Clicking on interesting things should\ngenerally lead you to interesting places. Still, there are important bits\nyou don't want to miss, so read on for a tour of the standard library and\nits documentation!\n\nOnce you are familiar with the contents of the standard library you may\nbegin to find the verbosity of the prose distracting. At this stage in your\ndevelopment you may want to press the `[-]` button near the top of the\npage to collapse it into a more skimmable view.\n\nWhile you are looking at that `[-]` button also notice the `source`\nlink. Rust's API documentation comes with the source code and you are\nencouraged to read it. The standard library source is generally high\nquality and a peek behind the curtains is often enlightening.\n\n# What is in the standard library documentation?\n\nFirst of all, The Rust Standard Library is divided into a number of focused\nmodules, [all listed further down this page](#modules). These modules are\nthe bedrock upon which all of Rust is forged, and they have mighty names\nlike [`std::slice`] and [`std::cmp`]. Modules' documentation typically\nincludes an overview of the module along with examples, and are a smart\nplace to start familiarizing yourself with the library.\n\nSecond, implicit methods on [primitive types] are documented here. This can\nbe a source of confusion for two reasons:\n\n1. While primitives are implemented by the compiler, the standard library\n implements methods directly on the primitive types (and it is the only\n library that does so), which are [documented in the section on\n primitives](#primitives).\n2. The standard library exports many modules *with the same name as\n primitive types*. These define additional items related to the primitive\n type, but not the all-important methods.\n\nSo for example there is a [page for the primitive type\n`i32`](primitive::i32) that lists all the methods that can be called on\n32-bit integers (very useful), and there is a [page for the module\n`std::i32`] that documents the constant values [`MIN`] and [`MAX`] (rarely\nuseful).\n\nNote the documentation for the primitives [`str`] and [`[T]`][prim@slice] (also\ncalled 'slice'). Many method calls on [`String`] and [`Vec`] are actually\ncalls to methods on [`str`] and [`[T]`][prim@slice] respectively, via [deref\ncoercions][deref-coercions].\n\nThird, the standard library defines [The Rust Prelude], a small collection\nof items - mostly traits - that are imported into every module of every\ncrate. The traits in the prelude are pervasive, making the prelude\ndocumentation a good entry point to learning about the library.\n\nAnd finally, the standard library exports a number of standard macros, and\n[lists them on this page](#macros) (technically, not all of the standard\nmacros are defined by the standard library - some are defined by the\ncompiler - but they are documented here the same). Like the prelude, the\nstandard macros are imported by default into all crates.\n\n# Contributing changes to the documentation\n\nCheck out the rust contribution guidelines [here](\nhttps://rustc-dev-guide.rust-lang.org/contributing.html#writing-documentation).\nThe source for this documentation can be found on\n[GitHub](https://github.com/rust-lang/rust).\nTo contribute changes, make sure you read the guidelines first, then submit\npull-requests for your suggested changes.\n\nContributions are appreciated! If you see a part of the docs that can be\nimproved, submit a PR, or chat with us first on [Discord][rust-discord]\n#docs.\n\n# A Tour of The Rust Standard Library\n\nThe rest of this crate documentation is dedicated to pointing out notable\nfeatures of The Rust Standard Library.\n\n## Containers and collections\n\nThe [`option`] and [`result`] modules define optional and error-handling\ntypes, [`Option`] and [`Result`]. The [`iter`] module defines\nRust's iterator trait, [`Iterator`], which works with the [`for`] loop to\naccess collections.\n\nThe standard library exposes three common ways to deal with contiguous\nregions of memory:\n\n* [`Vec`] - A heap-allocated *vector* that is resizable at runtime.\n* [`[T; N]`][prim@array] - An inline *array* with a fixed size at compile time.\n* [`[T]`][prim@slice] - A dynamically sized *slice* into any other kind of contiguous\n storage, whether heap-allocated or not.\n\nSlices can only be handled through some kind of *pointer*, and as such come\nin many flavors such as:\n\n* `&[T]` - *shared slice*\n* `&mut [T]` - *mutable slice*\n* [`Box<[T]>`][owned slice] - *owned slice*\n\n[`str`], a UTF-8 string slice, is a primitive type, and the standard library\ndefines many methods for it. Rust [`str`]s are typically accessed as\nimmutable references: `&str`. Use the owned [`String`] for building and\nmutating strings.\n\nFor converting to strings use the [`format!`] macro, and for converting from\nstrings use the [`FromStr`] trait.\n\nData may be shared by placing it in a reference-counted box or the [`Rc`]\ntype, and if further contained in a [`Cell`] or [`RefCell`], may be mutated\nas well as shared. Likewise, in a concurrent setting it is common to pair an\natomically-reference-counted box, [`Arc`], with a [`Mutex`] to get the same\neffect.\n\nThe [`collections`] module defines maps, sets, linked lists and other\ntypical collection types, including the common [`HashMap`].\n\n## Platform abstractions and I/O\n\nBesides basic data types, the standard library is largely concerned with\nabstracting over differences in common platforms, most notably Windows and\nUnix derivatives.\n\nCommon types of I/O, including [files], [TCP], and [UDP], are defined in\nthe [`io`], [`fs`], and [`net`] modules.\n\nThe [`thread`] module contains Rust's threading abstractions. [`sync`]\ncontains further primitive shared memory types, including [`atomic`] and\n[`mpsc`], which contains the channel types for message passing.\n\n# Use before and after `main()`\n\nMany parts of the standard library are expected to work before and after `main()`;\nbut this is not guaranteed or ensured by tests. It is recommended that you write your own tests\nand run them on each platform you wish to support.\nThis means that use of `std` before/after main, especially of features that interact with the\nOS or global state, is exempted from stability and portability guarantees and instead only\nprovided on a best-effort basis. Nevertheless bug reports are appreciated.\n\nOn the other hand `core` and `alloc` are most likely to work in such environments with\nthe caveat that any hookable behavior such as panics, oom handling or allocators will also\ndepend on the compatibility of the hooks.\n\nSome features may also behave differently outside main, e.g. stdio could become unbuffered,\nsome panics might turn into aborts, backtraces might not get symbolicated or similar.\n\nNon-exhaustive list of known limitations:\n\n- after-main use of thread-locals, which also affects additional features:\n - [`thread::current()`]\n - [`thread::scope()`]\n - [`sync::mpsc`]\n- before-main stdio file descriptors are not guaranteed to be open on unix platforms\n\n\n[I/O]: io\n[`MIN`]: i32::MIN\n[`MAX`]: i32::MAX\n[page for the module `std::i32`]: crate::i32\n[TCP]: net::TcpStream\n[The Rust Prelude]: prelude\n[UDP]: net::UdpSocket\n[`Arc`]: sync::Arc\n[owned slice]: boxed\n[`Cell`]: cell::Cell\n[`FromStr`]: str::FromStr\n[`HashMap`]: collections::HashMap\n[`Mutex`]: sync::Mutex\n[`Option`]: option::Option\n[`Rc`]: rc::Rc\n[`RefCell`]: cell::RefCell\n[`Result`]: result::Result\n[`Vec`]: vec::Vec\n[`atomic`]: sync::atomic\n[`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for\n[`str`]: prim@str\n[`mpsc`]: sync::mpsc\n[`std::cmp`]: cmp\n[`std::slice`]: mod@slice\n[`use std::env`]: env/index.html\n[`use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html\n[crates.io]: https://crates.io\n[deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods\n[files]: fs::File\n[multithreading]: thread\n[other]: #what-is-in-the-standard-library-documentation\n[primitive types]: ../book/ch03-02-data-types.html\n[rust-discord]: https://discord.gg/rust-lang\n[array]: prim@array\n[slice]: prim@slice"},"filterText":"std","kind":9,"label":"std","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"std","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust core allocation and collections library\n\nThis library provides smart pointers and collections for managing\nheap-allocated values.\n\nThis library, like core, normally doesn’t need to be used directly\nsince its contents are re-exported in the [`std` crate](../std/index.html).\nCrates that use the `#![no_std]` attribute however will typically\nnot depend on `std`, so they’d use this crate instead.\n\n## Boxed values\n\nThe [`Box`] type is a smart pointer type. There can only be one owner of a\n[`Box`], and the owner can decide to mutate the contents, which live on the\nheap.\n\nThis type can be sent among threads efficiently as the size of a `Box` value\nis the same as that of a pointer. Tree-like data structures are often built\nwith boxes because each node often has only one owner, the parent.\n\n## Reference counted pointers\n\nThe [`Rc`] type is a non-threadsafe reference-counted pointer type intended\nfor sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and\nonly allows access to `&T`, a shared reference.\n\nThis type is useful when inherited mutability (such as using [`Box`]) is too\nconstraining for an application, and is often paired with the [`Cell`] or\n[`RefCell`] types in order to allow mutation.\n\n## Atomically reference counted pointers\n\nThe [`Arc`] type is the threadsafe equivalent of the [`Rc`] type. It\nprovides all the same functionality of [`Rc`], except it requires that the\ncontained type `T` is shareable. Additionally, [`Arc`][`Arc`] is itself\nsendable while [`Rc`][`Rc`] is not.\n\nThis type allows for shared access to the contained data, and is often\npaired with synchronization primitives such as mutexes to allow mutation of\nshared resources.\n\n## Collections\n\nImplementations of the most common general purpose data structures are\ndefined in this library. They are re-exported through the\n[standard collections library](../std/collections/index.html).\n\n## Heap interfaces\n\nThe [`alloc`](alloc/index.html) module defines the low-level interface to the\ndefault global allocator. It is not compatible with the libc allocator API.\n\n[`Arc`]: sync\n[`Box`]: boxed\n[`Cell`]: core::cell\n[`Rc`]: rc\n[`RefCell`]: core::cell"},"filterText":"alloc","kind":9,"label":"alloc","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"alloc","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust Core Library\n\nThe Rust Core Library is the dependency-free[^free] foundation of [The\nRust Standard Library](../std/index.html). It is the portable glue\nbetween the language and its libraries, defining the intrinsic and\nprimitive building blocks of all Rust code. It links to no\nupstream libraries, no system libraries, and no libc.\n\n[^free]: Strictly speaking, there are some symbols which are needed but\n they aren't always necessary.\n\nThe core library is *minimal*: it isn't even aware of heap allocation,\nnor does it provide concurrency or I/O. These things require\nplatform integration, and this library is platform-agnostic.\n\n# How to use the core library\n\nPlease note that all of these details are currently not considered stable.\n\nThis library is built on the assumption of a few existing symbols:\n\n* `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines\n which are generated by Rust codegen backends. Additionally, this library can make explicit\n calls to `strlen`. Their signatures are the same as found in C, but there are extra\n assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if\n the `n` parameter is 0, the function is assumed to not be UB, even if the pointers are NULL or\n dangling. (Note that making extra assumptions about these functions is common among compilers:\n [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)\n These functions are often provided by the system libc, but can also be provided by the\n [compiler-builtins crate](https://crates.io/crates/compiler_builtins).\n Note that the library does not guarantee that it will always make these assumptions, so Rust\n user code directly calling the C functions should follow the C specification! The advice for\n Rust user code is to call the functions provided by this library instead (such as\n `ptr::copy`).\n\n* `rust_begin_panic` - This function takes four arguments, a\n `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments\n dictate the panic message, the file at which panic was invoked, and the\n line and column inside the file. It is up to consumers of this core\n library to define this panic function; it is only required to never\n return. This requires a `lang` attribute named `panic_impl`.\n\n* `rust_eh_personality` - is used by the failure mechanisms of the\n compiler. This is often mapped to GCC's personality function, but crates\n which do not trigger a panic can be assured that this function is never\n called. The `lang` attribute is called `eh_personality`."},"filterText":"core","kind":9,"label":"core","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"core","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u32","kind":22,"label":"u32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"u32","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"bool","kind":22,"label":"bool","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"bool","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u8","kind":22,"label":"u8","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"u8","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"isize","kind":22,"label":"isize","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"isize","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u16","kind":22,"label":"u16","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"u16","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u64","kind":22,"label":"u64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"u64","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u128","kind":22,"label":"u128","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"u128","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"f32","kind":22,"label":"f32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"f32","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i128","kind":22,"label":"i128","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"i128","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i16","kind":22,"label":"i16","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"i16","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"str","kind":22,"label":"str","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"str","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i64","kind":22,"label":"i64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"i64","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"char","kind":22,"label":"char","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"char","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"f64","kind":22,"label":"f64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"f64","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i32","kind":22,"label":"i32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"i32","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i8","kind":22,"label":"i8","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"i8","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"usize","kind":22,"label":"usize","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"usize","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do a cheap mutable-to-mutable reference conversion.\n\nThis trait is similar to [`AsRef`] but used for converting between mutable\nreferences. If you need to do a costly conversion it is better to\nimplement [`From`] with type `&mut T` or write a custom function.\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsMut` auto-dereferences if the inner type is a mutable reference\n(e.g.: `foo.as_mut()` will work the same if `foo` has type `&mut Foo` or `&mut &mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[mutably dereferenceable types], e.g. `foo.as_mut()` will *not* work the same as\n`Box::new(foo).as_mut()`. Instead, many smart pointers provide an `as_mut` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsMut::as_mut`] should not be\nused for the sole purpose of mutable dereferencing; instead ['`Deref` coercion'] can be used:\n\n[mutably dereferenceable types]: core::ops::DerefMut\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::DerefMut#mutable-deref-coercion\n\n```rust\nlet mut x = Box::new(5i32);\n// Avoid this:\n// let y: &mut i32 = x.as_mut();\n// Better just write:\nlet y: &mut i32 = &mut x;\n```\n\nTypes which implement [`DerefMut`] should consider to add an implementation of `AsMut` as\nfollows:\n\n[`DerefMut`]: core::ops::DerefMut\n\n```rust\nimpl AsMut for SomeType\nwhere\n ::Target: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.deref_mut().as_mut()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsMut` would be reflexive, i.e. there would be an `impl AsMut for T`\nwith [`as_mut`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&mut T where T: AsMut` which allows `AsMut` to auto-dereference, see \"Generic\nImplementations\" above).\n\n[`as_mut`]: AsMut::as_mut\n\nA trivial implementation of `AsMut for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nUsing `AsMut` as trait bound for a generic function, we can accept all mutable references that\ncan be converted to type `&mut T`. Unlike [dereference], which has a single [target type],\nthere can be multiple implementations of `AsMut` for a type. In particular, `Vec` implements\nboth `AsMut>` and `AsMut<[T]>`.\n\nIn the following, the example functions `caesar` and `null_terminate` provide a generic\ninterface which work with any type that can be converted by cheap mutable-to-mutable conversion\ninto a byte slice (`[u8]`) or byte vector (`Vec`), respectively.\n\n[dereference]: core::ops::DerefMut\n[target type]: core::ops::Deref::Target\n\n```rust\nstruct Document {\n info: String,\n content: Vec,\n}\n\nimpl AsMut for Document\nwhere\n Vec: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.content.as_mut()\n }\n}\n\nfn caesar>(data: &mut T, key: u8) {\n for byte in data.as_mut() {\n *byte = byte.wrapping_add(key);\n }\n}\n\nfn null_terminate>>(data: &mut T) {\n // Using a non-generic inner function, which contains most of the\n // functionality, helps to minimize monomorphization overhead.\n fn doit(data: &mut Vec) {\n let len = data.len();\n if len == 0 || data[len-1] != 0 {\n data.push(0);\n }\n }\n doit(data.as_mut());\n}\n\nfn main() {\n let mut v: Vec = vec![1, 2, 3];\n caesar(&mut v, 5);\n assert_eq!(v, [6, 7, 8]);\n null_terminate(&mut v);\n assert_eq!(v, [6, 7, 8, 0]);\n let mut doc = Document {\n info: String::from(\"Example\"),\n content: vec![17, 19, 8],\n };\n caesar(&mut doc, 1);\n assert_eq!(doc.content, [18, 20, 9]);\n null_terminate(&mut doc);\n assert_eq!(doc.content, [18, 20, 9, 0]);\n}\n```\n\nNote, however, that APIs don't need to be generic. In many cases taking a `&mut [u8]` or\n`&mut Vec`, for example, is the better choice (callers need to pass the correct type then)."},"filterText":"AsMut","kind":8,"label":"AsMut","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"AsMut","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do a cheap reference-to-reference conversion.\n\nThis trait is similar to [`AsMut`] which is used for converting between mutable references.\nIf you need to do a costly conversion it is better to implement [`From`] with type\n`&T` or write a custom function.\n\n# Relation to `Borrow`\n\n`AsRef` has the same signature as [`Borrow`], but [`Borrow`] is different in a few aspects:\n\n- Unlike `AsRef`, [`Borrow`] has a blanket impl for any `T`, and can be used to accept either\n a reference or a value. (See also note on `AsRef`'s reflexibility below.)\n- [`Borrow`] also requires that [`Hash`], [`Eq`] and [`Ord`] for a borrowed value are\n equivalent to those of the owned value. For this reason, if you want to\n borrow only a single field of a struct you can implement `AsRef`, but not [`Borrow`].\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsRef` auto-dereferences if the inner type is a reference or a mutable reference\n(e.g.: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[dereferenceable types], e.g. `foo.as_ref()` will *not* work the same as\n`Box::new(foo).as_ref()`. Instead, many smart pointers provide an `as_ref` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsRef::as_ref`] should not be\nused for the sole purpose of dereferencing; instead ['`Deref` coercion'] can be used:\n\n[dereferenceable types]: core::ops::Deref\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::Deref#deref-coercion\n\n```rust\nlet x = Box::new(5i32);\n// Avoid this:\n// let y: &i32 = x.as_ref();\n// Better just write:\nlet y: &i32 = &x;\n```\n\nTypes which implement [`Deref`] should consider implementing `AsRef` as follows:\n\n[`Deref`]: core::ops::Deref\n\n```rust\nimpl AsRef for SomeType\nwhere\n T: ?Sized,\n ::Target: AsRef,\n{\n fn as_ref(&self) -> &T {\n self.deref().as_ref()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsRef` would be reflexive, i.e. there would be an `impl AsRef for T`\nwith [`as_ref`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&T where T: AsRef` which allows `AsRef` to auto-dereference, see \"Generic Implementations\"\nabove).\n\n[`as_ref`]: AsRef::as_ref\n\nA trivial implementation of `AsRef for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nBy using trait bounds we can accept arguments of different types as long as they can be\nconverted to the specified type `T`.\n\nFor example: By creating a generic function that takes an `AsRef` we express that we\nwant to accept all references that can be converted to [`&str`] as an argument.\nSince both [`String`] and [`&str`] implement `AsRef` we can accept both as input argument.\n\n[`&str`]: primitive@str\n[`Borrow`]: crate::borrow::Borrow\n[`Eq`]: crate::cmp::Eq\n[`Ord`]: crate::cmp::Ord\n[`String`]: ../../std/string/struct.String.html\n\n```rust\nfn is_hello>(s: T) {\n assert_eq!(\"hello\", s.as_ref());\n}\n\nlet s = \"hello\";\nis_hello(s);\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```"},"filterText":"AsRef","kind":8,"label":"AsRef","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"AsRef","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A pointer type that uniquely owns a heap allocation of type `T`.\n\nSee the [module-level documentation](../../std/boxed/index.html) for more."},"filterText":"Box","kind":22,"label":"Box","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Box","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A common trait for the ability to explicitly duplicate an object.\n\nDiffers from [`Copy`] in that [`Copy`] is implicit and an inexpensive bit-wise copy, while\n`Clone` is always explicit and may or may not be expensive. In order to enforce\nthese characteristics, Rust does not allow you to reimplement [`Copy`], but you\nmay reimplement `Clone` and run arbitrary code.\n\nSince `Clone` is more general than [`Copy`], you can automatically make anything\n[`Copy`] be `Clone` as well.\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d\nimplementation of [`Clone`] calls [`clone`] on each field.\n\n[`clone`]: Clone::clone\n\nFor a generic struct, `#[derive]` implements `Clone` conditionally by adding bound `Clone` on\ngeneric parameters.\n\n```rust\n// `derive` implements Clone for Reading when T is Clone.\n#[derive(Clone)]\nstruct Reading {\n frequency: T,\n}\n```\n\n## How can I implement `Clone`?\n\nTypes that are [`Copy`] should have a trivial implementation of `Clone`. More formally:\nif `T: Copy`, `x: T`, and `y: &T`, then `let x = y.clone();` is equivalent to `let x = *y;`.\nManual implementations should be careful to uphold this invariant; however, unsafe code\nmust not rely on it to ensure memory safety.\n\nAn example is a generic struct holding a function pointer. In this case, the\nimplementation of `Clone` cannot be `derive`d, but can be implemented as:\n\n```rust\nstruct Generate(fn() -> T);\n\nimpl Copy for Generate {}\n\nimpl Clone for Generate {\n fn clone(&self) -> Self {\n *self\n }\n}\n```\n\nIf we `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n```\n\nthe auto-derived implementations will have unnecessary `T: Copy` and `T: Clone` bounds:\n\n```rust\n\n// Automatically derived\nimpl Copy for Generate { }\n\n// Automatically derived\nimpl Clone for Generate {\n fn clone(&self) -> Generate {\n Generate(Clone::clone(&self.0))\n }\n}\n```\n\nThe bounds are unnecessary because clearly the function itself should be\ncopy- and cloneable even if its return type is not:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n\nstruct NotCloneable;\n\nfn generate_not_cloneable() -> NotCloneable {\n NotCloneable\n}\n\nGenerate(generate_not_cloneable).clone(); // error: trait bounds were not satisfied\n// Note: With the manual implementations the above line will compile.\n```\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Clone`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Clone` themselves.\n Note that variables captured by shared reference always implement `Clone`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Clone`.\n\n[impls]: #implementors"},"filterText":"Clone","kind":8,"label":"Clone","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Clone","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Types whose values can be duplicated simply by copying bits.\n\nBy default, variable bindings have 'move semantics.' In other\nwords:\n\n```rust\n#[derive(Debug)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `x` has moved into `y`, and so cannot be used\n\n// println!(\"{x:?}\"); // error: use of moved value\n```\n\nHowever, if a type implements `Copy`, it instead has 'copy semantics':\n\n```rust\n// We can derive a `Copy` implementation. `Clone` is also required, as it's\n// a supertrait of `Copy`.\n#[derive(Debug, Copy, Clone)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `y` is a copy of `x`\n\nprintln!(\"{x:?}\"); // A-OK!\n```\n\nIt's important to note that in these two examples, the only difference is whether you\nare allowed to access `x` after the assignment. Under the hood, both a copy and a move\ncan result in bits being copied in memory, although this is sometimes optimized away.\n\n## How can I implement `Copy`?\n\nThere are two ways to implement `Copy` on your type. The simplest is to use `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct MyStruct;\n```\n\nYou can also implement `Copy` and `Clone` manually:\n\n```rust\nstruct MyStruct;\n\nimpl Copy for MyStruct { }\n\nimpl Clone for MyStruct {\n fn clone(&self) -> MyStruct {\n *self\n }\n}\n```\n\nThere is a small difference between the two: the `derive` strategy will also place a `Copy`\nbound on type parameters, which isn't always desired.\n\n## What's the difference between `Copy` and `Clone`?\n\nCopies happen implicitly, for example as part of an assignment `y = x`. The behavior of\n`Copy` is not overloadable; it is always a simple bit-wise copy.\n\nCloning is an explicit action, `x.clone()`. The implementation of [`Clone`] can\nprovide any type-specific behavior necessary to duplicate values safely. For example,\nthe implementation of [`Clone`] for [`String`] needs to copy the pointed-to string\nbuffer in the heap. A simple bitwise copy of [`String`] values would merely copy the\npointer, leading to a double free down the line. For this reason, [`String`] is [`Clone`]\nbut not `Copy`.\n\n[`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement\n[`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`\n(see the example above).\n\n## When can my type be `Copy`?\n\nA type can implement `Copy` if all of its components implement `Copy`. For example, this\nstruct can be `Copy`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Point {\n x: i32,\n y: i32,\n}\n```\n\nA struct can be `Copy`, and [`i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.\nBy contrast, consider\n\n```rust\nstruct PointList {\n points: Vec,\n}\n```\n\nThe struct `PointList` cannot implement `Copy`, because [`Vec`] is not `Copy`. If we\nattempt to derive a `Copy` implementation, we'll get an error:\n\n```text\nthe trait `Copy` cannot be implemented for this type; field `points` does not implement `Copy`\n```\n\nShared references (`&T`) are also `Copy`, so a type can be `Copy`, even when it holds\nshared references of types `T` that are *not* `Copy`. Consider the following struct,\nwhich can implement `Copy`, because it only holds a *shared reference* to our non-`Copy`\ntype `PointList` from above:\n\n```rust\n#[derive(Copy, Clone)]\nstruct PointListWrapper<'a> {\n point_list_ref: &'a PointList,\n}\n```\n\n## When *can't* my type be `Copy`?\n\nSome types can't be copied safely. For example, copying `&mut T` would create an aliased\nmutable reference. Copying [`String`] would duplicate responsibility for managing the\n[`String`]'s buffer, leading to a double free.\n\nGeneralizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's\nmanaging some resource besides its own [`size_of::`] bytes.\n\nIf you try to implement `Copy` on a struct or enum containing non-`Copy` data, you will get\nthe error [E0204].\n\n[E0204]: ../../error_codes/E0204.html\n\n## When *should* my type be `Copy`?\n\nGenerally speaking, if your type _can_ implement `Copy`, it should. Keep in mind, though,\nthat implementing `Copy` is part of the public API of your type. If the type might become\nnon-`Copy` in the future, it could be prudent to omit the `Copy` implementation now, to\navoid a breaking API change.\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Copy`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Copy` themselves.\n Note that variables captured by shared reference always implement `Copy`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Copy`.\n\n[`Vec`]: ../../std/vec/struct.Vec.html\n[`String`]: ../../std/string/struct.String.html\n[`size_of::`]: crate::mem::size_of\n[impls]: #implementors"},"filterText":"Copy","kind":8,"label":"Copy","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Copy","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for giving a type a useful default value.\n\nSometimes, you want to fall back to some kind of default value, and\ndon't particularly care what it is. This comes up often with `struct`s\nthat define a set of options:\n\n```rust\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```\n\nHow can we define some default values? You can use `Default`:\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n\nfn main() {\n let options: SomeOptions = Default::default();\n}\n```\n\nNow, you get all of the default values. Rust implements `Default` for various primitives types.\n\nIf you want to override a particular option, but still retain the other defaults:\n\n```rust\nfn main() {\n let options = SomeOptions { foo: 42, ..Default::default() };\n}\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all of the type's fields implement\n`Default`. When `derive`d, it will use the default value for each field's type.\n\n### `enum`s\n\nWhen using `#[derive(Default)]` on an `enum`, you need to choose which unit variant will be\ndefault. You do this by placing the `#[default]` attribute on the variant.\n\n```rust\n#[derive(Default)]\nenum Kind {\n #[default]\n A,\n B,\n C,\n}\n```\n\nYou cannot use the `#[default]` attribute on non-unit or non-exhaustive variants.\n\n## How can I implement `Default`?\n\nProvide an implementation for the `default()` method that returns the value of\nyour type that should be the default:\n\n```rust\nenum Kind {\n A,\n B,\n C,\n}\n\nimpl Default for Kind {\n fn default() -> Self { Kind::A }\n}\n```\n\n# Examples\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```"},"filterText":"Default","kind":8,"label":"Default","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Default","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An iterator able to yield elements from both ends.\n\nSomething that implements `DoubleEndedIterator` has one extra capability\nover something that implements [`Iterator`]: the ability to also take\n`Item`s from the back, as well as the front.\n\nIt is important to note that both back and forth work on the same range,\nand do not cross: iteration is over when they meet in the middle.\n\nIn a similar fashion to the [`Iterator`] protocol, once a\n`DoubleEndedIterator` returns [`None`] from a [`next_back()`], calling it\nagain may or may not ever return [`Some`] again. [`next()`] and\n[`next_back()`] are interchangeable for this purpose.\n\n[`next_back()`]: DoubleEndedIterator::next_back\n[`next()`]: Iterator::next\n\n# Examples\n\nBasic usage:\n\n```rust\nlet numbers = vec![1, 2, 3, 4, 5, 6];\n\nlet mut iter = numbers.iter();\n\nassert_eq!(Some(&1), iter.next());\nassert_eq!(Some(&6), iter.next_back());\nassert_eq!(Some(&5), iter.next_back());\nassert_eq!(Some(&2), iter.next());\nassert_eq!(Some(&3), iter.next());\nassert_eq!(Some(&4), iter.next());\nassert_eq!(None, iter.next());\nassert_eq!(None, iter.next_back());\n```"},"filterText":"DoubleEndedIterator","kind":8,"label":"DoubleEndedIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"DoubleEndedIterator","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Custom code within the destructor.\n\nWhen a value is no longer needed, Rust will run a \"destructor\" on that value.\nThe most common way that a value is no longer needed is when it goes out of\nscope. Destructors may still run in other circumstances, but we're going to\nfocus on scope for the examples here. To learn about some of those other cases,\nplease see [the reference] section on destructors.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\nThis destructor consists of two components:\n- A call to `Drop::drop` for that value, if this special `Drop` trait is implemented for its type.\n- The automatically generated \"drop glue\" which recursively calls the destructors\n of all the fields of this value.\n\nAs Rust automatically calls the destructors of all contained fields,\nyou don't have to implement `Drop` in most cases. But there are some cases where\nit is useful, for example for types which directly manage a resource.\nThat resource may be memory, it may be a file descriptor, it may be a network socket.\nOnce a value of that type is no longer going to be used, it should \"clean up\" its\nresource by freeing the memory or closing the file or socket. This is\nthe job of a destructor, and therefore the job of `Drop::drop`.\n\n## Examples\n\nTo see destructors in action, let's take a look at the following program:\n\n```rust\nstruct HasDrop;\n\nimpl Drop for HasDrop {\n fn drop(&mut self) {\n println!(\"Dropping HasDrop!\");\n }\n}\n\nstruct HasTwoDrops {\n one: HasDrop,\n two: HasDrop,\n}\n\nimpl Drop for HasTwoDrops {\n fn drop(&mut self) {\n println!(\"Dropping HasTwoDrops!\");\n }\n}\n\nfn main() {\n let _x = HasTwoDrops { one: HasDrop, two: HasDrop };\n println!(\"Running!\");\n}\n```\n\nRust will first call `Drop::drop` for `_x` and then for both `_x.one` and `_x.two`,\nmeaning that running this will print\n\n```text\nRunning!\nDropping HasTwoDrops!\nDropping HasDrop!\nDropping HasDrop!\n```\n\nEven if we remove the implementation of `Drop` for `HasTwoDrop`, the destructors of its fields are still called.\nThis would result in\n\n```test\nRunning!\nDropping HasDrop!\nDropping HasDrop!\n```\n\n## You cannot call `Drop::drop` yourself\n\nBecause `Drop::drop` is used to clean up a value, it may be dangerous to use this value after\nthe method has been called. As `Drop::drop` does not take ownership of its input,\nRust prevents misuse by not allowing you to call `Drop::drop` directly.\n\nIn other words, if you tried to explicitly call `Drop::drop` in the above example, you'd get a compiler error.\n\nIf you'd like to explicitly call the destructor of a value, [`mem::drop`] can be used instead.\n\n[`mem::drop`]: drop\n\n## Drop order\n\nWhich of our two `HasDrop` drops first, though? For structs, it's the same\norder that they're declared: first `one`, then `two`. If you'd like to try\nthis yourself, you can modify `HasDrop` above to contain some data, like an\ninteger, and then use it in the `println!` inside of `Drop`. This behavior is\nguaranteed by the language.\n\nUnlike for structs, local variables are dropped in reverse order:\n\n```rust\nstruct Foo;\n\nimpl Drop for Foo {\n fn drop(&mut self) {\n println!(\"Dropping Foo!\")\n }\n}\n\nstruct Bar;\n\nimpl Drop for Bar {\n fn drop(&mut self) {\n println!(\"Dropping Bar!\")\n }\n}\n\nfn main() {\n let _foo = Foo;\n let _bar = Bar;\n}\n```\n\nThis will print\n\n```text\nDropping Bar!\nDropping Foo!\n```\n\nPlease see [the reference] for the full rules.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\n## `Copy` and `Drop` are exclusive\n\nYou cannot implement both [`Copy`] and `Drop` on the same type. Types that\nare `Copy` get implicitly duplicated by the compiler, making it very\nhard to predict when, and how often destructors will be executed. As such,\nthese types cannot have destructors.\n\n## Drop check\n\nDropping interacts with the borrow checker in subtle ways: when a type `T` is being implicitly\ndropped as some variable of this type goes out of scope, the borrow checker needs to ensure that\ncalling `T`'s destructor at this moment is safe. In particular, it also needs to be safe to\nrecursively drop all the fields of `T`. For example, it is crucial that code like the following\nis being rejected:\n\n```rust\nuse std::cell::Cell;\n\nstruct S<'a>(Cell>>, Box);\nimpl Drop for S<'_> {\n fn drop(&mut self) {\n if let Some(r) = self.0.get() {\n // Print the contents of the `Box` in `r`.\n println!(\"{}\", r.1);\n }\n }\n}\n\nfn main() {\n // Set up two `S` that point to each other.\n let s1 = S(Cell::new(None), Box::new(42));\n let s2 = S(Cell::new(Some(&s1)), Box::new(42));\n s1.0.set(Some(&s2));\n // Now they both get dropped. But whichever is the 2nd one\n // to be dropped will access the `Box` in the first one,\n // which is a use-after-free!\n}\n```\n\nThe Nomicon discusses the need for [drop check in more detail][drop check].\n\nTo reject such code, the \"drop check\" analysis determines which types and lifetimes need to\nstill be live when `T` gets dropped. The exact details of this analysis are not yet\nstably guaranteed and **subject to change**. Currently, the analysis works as follows:\n- If `T` has no drop glue, then trivially nothing is required to be live. This is the case if\n neither `T` nor any of its (recursive) fields have a destructor (`impl Drop`). [`PhantomData`]\n and [`ManuallyDrop`] are considered to never have a destructor, no matter their field type.\n- If `T` has drop glue, then, for all types `U` that are *owned* by any field of `T`,\n recursively add the types and lifetimes that need to be live when `U` gets dropped. The set of\n owned types is determined by recursively traversing `T`:\n - Recursively descend through `PhantomData`, `Box`, tuples, and arrays (including arrays of\n length 0).\n - Stop at reference and raw pointer types as well as function pointers and function items;\n they do not own anything.\n - Stop at non-composite types (type parameters that remain generic in the current context and\n base types such as integers and `bool`); these types are owned.\n - When hitting an ADT with `impl Drop`, stop there; this type is owned.\n - When hitting an ADT without `impl Drop`, recursively descend to its fields. (For an `enum`,\n consider all fields of all variants.)\n- Furthermore, if `T` implements `Drop`, then all generic (lifetime and type) parameters of `T`\n must be live.\n\nIn the above example, the last clause implies that `'a` must be live when `S<'a>` is dropped,\nand hence the example is rejected. If we remove the `impl Drop`, the liveness requirement\ndisappears and the example is accepted.\n\nThere exists an unstable way for a type to opt-out of the last clause; this is called \"drop\ncheck eyepatch\" or `may_dangle`. For more details on this nightly-only feature, see the\n[discussion in the Nomicon][nomicon].\n\n[`ManuallyDrop`]: crate::mem::ManuallyDrop\n[`PhantomData`]: crate::marker::PhantomData\n[drop check]: ../../nomicon/dropck.html\n[nomicon]: ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standard-library-and-its-unstable-may_dangle"},"filterText":"Drop","kind":8,"label":"Drop","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Drop","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for comparisons corresponding to [equivalence relations](\nhttps://en.wikipedia.org/wiki/Equivalence_relation).\n\nThis means, that in addition to `a == b` and `a != b` being strict inverses,\nthe relation must be (for all `a`, `b` and `c`):\n\n- reflexive: `a == a`;\n- symmetric: `a == b` implies `b == a` (required by `PartialEq` as well); and\n- transitive: `a == b` and `b == c` implies `a == c` (required by `PartialEq` as well).\n\nThis property cannot be checked by the compiler, and therefore `Eq` implies\n[`PartialEq`], and has no extra methods.\n\nViolating this property is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\nImplement `Eq` in addition to `PartialEq` if it's guaranteed that\n`PartialEq::eq(a, a)` always returns `true` (reflexivity), in addition to\nthe symmetric and transitive properties already required by `PartialEq`.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d, because `Eq` has\nno extra methods, it is only informing the compiler that this is an\nequivalence relation rather than a partial equivalence relation. Note that\nthe `derive` strategy requires all fields are `Eq`, which isn't\nalways desired.\n\n## How can I implement `Eq`?\n\nIf you cannot use the `derive` strategy, specify that your type implements\n`Eq`, which has no methods:\n\n```rust\nenum BookFormat { Paperback, Hardback, Ebook }\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\nimpl Eq for Book {}\n```"},"filterText":"Eq","kind":8,"label":"Eq (alias ==, !=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Eq","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Err(E)","documentation":{"kind":"markdown","value":"Contains the error value"},"filterText":"Err()","insertTextFormat":2,"kind":20,"label":"Err(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Err(${1:()})$0","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An iterator that knows its exact length.\n\nMany [`Iterator`]s don't know how many times they will iterate, but some do.\nIf an iterator knows how many times it can iterate, providing access to\nthat information can be useful. For example, if you want to iterate\nbackwards, a good start is to know where the end is.\n\nWhen implementing an `ExactSizeIterator`, you must also implement\n[`Iterator`]. When doing so, the implementation of [`Iterator::size_hint`]\n*must* return the exact size of the iterator.\n\nThe [`len`] method has a default implementation, so you usually shouldn't\nimplement it. However, you may be able to provide a more performant\nimplementation than the default, so overriding it in this case makes sense.\n\nNote that this trait is a safe trait and as such does *not* and *cannot*\nguarantee that the returned length is correct. This means that `unsafe`\ncode **must not** rely on the correctness of [`Iterator::size_hint`]. The\nunstable and unsafe [`TrustedLen`](super::marker::TrustedLen) trait gives\nthis additional guarantee.\n\n[`len`]: ExactSizeIterator::len\n\n# When *shouldn't* an adapter be `ExactSizeIterator`?\n\nIf an adapter makes an iterator *longer*, then it's usually incorrect for\nthat adapter to implement `ExactSizeIterator`. The inner exact-sized\niterator might already be `usize::MAX`-long, and thus the length of the\nlonger adapted iterator would no longer be exactly representable in `usize`.\n\nThis is why [`Chain`](crate::iter::Chain) isn't `ExactSizeIterator`,\neven when `A` and `B` are both `ExactSizeIterator`.\n\n# Examples\n\nBasic usage:\n\n```rust\n// a finite range knows exactly how many times it will iterate\nlet five = 0..5;\n\nassert_eq!(5, five.len());\n```\n\nIn the [module-level docs], we implemented an [`Iterator`], `Counter`.\nLet's implement `ExactSizeIterator` for it as well:\n\n[module-level docs]: crate::iter\n\n```rust\nimpl ExactSizeIterator for Counter {\n // We can easily calculate the remaining number of iterations.\n fn len(&self) -> usize {\n 5 - self.count\n }\n}\n\n// And now we can use it!\n\nlet mut counter = Counter::new();\n\nassert_eq!(5, counter.len());\nlet _ = counter.next();\nassert_eq!(4, counter.len());\n```"},"filterText":"ExactSizeIterator","kind":8,"label":"ExactSizeIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"ExactSizeIterator","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Extend a collection with the contents of an iterator.\n\nIterators produce a series of values, and collections can also be thought\nof as a series of values. The `Extend` trait bridges this gap, allowing you\nto extend a collection by including the contents of that iterator. When\nextending a collection with an already existing key, that entry is updated\nor, in the case of collections that permit multiple entries with equal\nkeys, that entry is inserted.\n\n# Examples\n\nBasic usage:\n\n```rust\n// You can extend a String with some chars:\nlet mut message = String::from(\"The first three letters are: \");\n\nmessage.extend(&['a', 'b', 'c']);\n\nassert_eq!(\"abc\", &message[29..32]);\n```\n\nImplementing `Extend`:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// since MyCollection has a list of i32s, we implement Extend for i32\nimpl Extend for MyCollection {\n\n // This is a bit simpler with the concrete type signature: we can call\n // extend on anything which can be turned into an Iterator which gives\n // us i32s. Because we need i32s to put into MyCollection.\n fn extend>(&mut self, iter: T) {\n\n // The implementation is very straightforward: loop through the\n // iterator, and add() each element to ourselves.\n for elem in iter {\n self.add(elem);\n }\n }\n}\n\nlet mut c = MyCollection::new();\n\nc.add(5);\nc.add(6);\nc.add(7);\n\n// let's extend our collection with three more numbers\nc.extend(vec![1, 2, 3]);\n\n// we've added these elements onto the end\nassert_eq!(\"MyCollection([5, 6, 7, 1, 2, 3])\", format!(\"{c:?}\"));\n```"},"filterText":"Extend","kind":8,"label":"Extend","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Extend","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes an immutable receiver.\n\nInstances of `Fn` can be called repeatedly without mutating state.\n\n*This trait (`Fn`) is not to be confused with [function pointers]\n(`fn`).*\n\n`Fn` is implemented automatically by closures which only take immutable\nreferences to captured variables or don't capture anything at all, as well\nas (safe) [function pointers] (with some caveats, see their documentation\nfor more details). Additionally, for any type `F` that implements `Fn`, `&F`\nimplements `Fn`, too.\n\nSince both [`FnMut`] and [`FnOnce`] are supertraits of `Fn`, any\ninstance of `Fn` can be used as a parameter where a [`FnMut`] or [`FnOnce`]\nis expected.\n\nUse `Fn` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly and without mutating state (e.g., when\ncalling it concurrently). If you do not need such strict requirements, use\n[`FnMut`] or [`FnOnce`] as bounds.\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a closure\n\n```rust\nlet square = |x| x * x;\nassert_eq!(square(5), 25);\n```\n\n## Using a `Fn` parameter\n\n```rust\nfn call_with_one(func: F) -> usize\n where F: Fn(usize) -> usize {\n func(1)\n}\n\nlet double = |x| x * 2;\nassert_eq!(call_with_one(double), 2);\n```"},"filterText":"Fn","kind":8,"label":"Fn","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Fn","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a mutable receiver.\n\nInstances of `FnMut` can be called repeatedly and may mutate state.\n\n`FnMut` is implemented automatically by closures which take mutable\nreferences to captured variables, as well as all types that implement\n[`Fn`], e.g., (safe) [function pointers] (since `FnMut` is a supertrait of\n[`Fn`]). Additionally, for any type `F` that implements `FnMut`, `&mut F`\nimplements `FnMut`, too.\n\nSince [`FnOnce`] is a supertrait of `FnMut`, any instance of `FnMut` can be\nused where a [`FnOnce`] is expected, and since [`Fn`] is a subtrait of\n`FnMut`, any instance of [`Fn`] can be used where `FnMut` is expected.\n\nUse `FnMut` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly, while allowing it to mutate state.\nIf you don't want the parameter to mutate state, use [`Fn`] as a\nbound; if you don't need to call it repeatedly, use [`FnOnce`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a mutably capturing closure\n\n```rust\nlet mut x = 5;\n{\n let mut square_x = || x *= x;\n square_x();\n}\nassert_eq!(x, 25);\n```\n\n## Using a `FnMut` parameter\n\n```rust\nfn do_twice(mut func: F)\n where F: FnMut()\n{\n func();\n func();\n}\n\nlet mut x: usize = 1;\n{\n let add_two_to_x = || x += 2;\n do_twice(add_two_to_x);\n}\n\nassert_eq!(x, 5);\n```"},"filterText":"FnMut","kind":8,"label":"FnMut","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"FnMut","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a by-value receiver.\n\nInstances of `FnOnce` can be called, but might not be callable multiple\ntimes. Because of this, if the only thing known about a type is that it\nimplements `FnOnce`, it can only be called once.\n\n`FnOnce` is implemented automatically by closures that might consume captured\nvariables, as well as all types that implement [`FnMut`], e.g., (safe)\n[function pointers] (since `FnOnce` is a supertrait of [`FnMut`]).\n\nSince both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of\n[`Fn`] or [`FnMut`] can be used where a `FnOnce` is expected.\n\nUse `FnOnce` as a bound when you want to accept a parameter of function-like\ntype and only need to call it once. If you need to call the parameter\nrepeatedly, use [`FnMut`] as a bound; if you also need it to not mutate\nstate, use [`Fn`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Using a `FnOnce` parameter\n\n```rust\nfn consume_with_relish(func: F)\n where F: FnOnce() -> String\n{\n // `func` consumes its captured variables, so it cannot be run more\n // than once.\n println!(\"Consumed: {}\", func());\n\n println!(\"Delicious!\");\n\n // Attempting to invoke `func()` again will throw a `use of moved\n // value` error for `func`.\n}\n\nlet x = String::from(\"x\");\nlet consume_and_return_x = move || x;\nconsume_with_relish(consume_and_return_x);\n\n// `consume_and_return_x` can no longer be invoked at this point\n```"},"filterText":"FnOnce","kind":8,"label":"FnOnce","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"FnOnce","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do value-to-value conversions while consuming the input value. It is the reciprocal of\n[`Into`].\n\nOne should always prefer implementing `From` over [`Into`]\nbecause implementing `From` automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nOnly implement [`Into`] when targeting a version prior to Rust 1.41 and converting to a type\noutside the current crate.\n`From` was not able to do these types of conversions in earlier versions because of Rust's\norphaning rules.\nSee [`Into`] for more details.\n\nPrefer using [`Into`] over using `From` when specifying trait bounds on a generic function.\nThis way, types that directly implement [`Into`] can be used as arguments as well.\n\nThe `From` is also very useful when performing error handling. When constructing a function\nthat is capable of failing, the return type will generally be of the form `Result`.\nThe `From` trait simplifies error handling by allowing a function to return a single error type\nthat encapsulate multiple error types. See the \"Examples\" section and [the book][book] for more\ndetails.\n\n**Note: This trait must not fail**. The `From` trait is intended for perfect conversions.\nIf the conversion can fail or is not perfect, use [`TryFrom`].\n\n# Generic Implementations\n\n- `From for U` implies [`Into`]` for T`\n- `From` is reflexive, which means that `From for T` is implemented\n\n# When to implement `From`\n\nWhile there's no technical restrictions on which conversions can be done using\na `From` implementation, the general expectation is that the conversions\nshould typically be restricted as follows:\n\n* The conversion is *infallible*: if the conversion can fail, use [`TryFrom`]\n instead; don't provide a `From` impl that panics.\n\n* The conversion is *lossless*: semantically, it should not lose or discard\n information. For example, `i32: From` exists, where the original\n value can be recovered using `u16: TryFrom`. And `String: From<&str>`\n exists, where you can get something equivalent to the original value via\n `Deref`. But `From` cannot be used to convert from `u32` to `u16`, since\n that cannot succeed in a lossless way. (There's some wiggle room here for\n information not considered semantically relevant. For example,\n `Box<[T]>: From>` exists even though it might not preserve capacity,\n like how two vectors can be equal despite differing capacities.)\n\n* The conversion is *value-preserving*: the conceptual kind and meaning of\n the resulting value is the same, even though the Rust type and technical\n representation might be different. For example `-1_i8 as u8` is *lossless*,\n since `as` casting back can recover the original value, but that conversion\n is *not* available via `From` because `-1` and `255` are different conceptual\n values (despite being identical bit patterns technically). But\n `f32: From` *is* available because `1_i16` and `1.0_f32` are conceptually\n the same real number (despite having very different bit patterns technically).\n `String: From` is available because they're both *text*, but\n `String: From` is *not* available, since `1` (a number) and `\"1\"`\n (text) are too different. (Converting values to text is instead covered\n by the [`Display`](crate::fmt::Display) trait.)\n\n* The conversion is *obvious*: it's the only reasonable conversion between\n the two types. Otherwise it's better to have it be a named method or\n constructor, like how [`str::as_bytes`] is a method and how integers have\n methods like [`u32::from_ne_bytes`], [`u32::from_le_bytes`], and\n [`u32::from_be_bytes`], none of which are `From` implementations. Whereas\n there's only one reasonable way to wrap an [`Ipv6Addr`](crate::net::Ipv6Addr)\n into an [`IpAddr`](crate::net::IpAddr), thus `IpAddr: From` exists.\n\n# Examples\n\n[`String`] implements `From<&str>`:\n\nAn explicit conversion from a `&str` to a String is done as follows:\n\n```rust\nlet string = \"hello\".to_string();\nlet other_string = String::from(\"hello\");\n\nassert_eq!(string, other_string);\n```\n\nWhile performing error handling it is often useful to implement `From` for your own error type.\nBy converting underlying error types to our own custom error type that encapsulates the\nunderlying error type, we can return a single error type without losing information on the\nunderlying cause. The '?' operator automatically converts the underlying error type to our\ncustom error type with `From::from`.\n\n```rust\nuse std::fs;\nuse std::io;\nuse std::num;\n\nenum CliError {\n IoError(io::Error),\n ParseError(num::ParseIntError),\n}\n\nimpl From for CliError {\n fn from(error: io::Error) -> Self {\n CliError::IoError(error)\n }\n}\n\nimpl From for CliError {\n fn from(error: num::ParseIntError) -> Self {\n CliError::ParseError(error)\n }\n}\n\nfn open_and_parse_file(file_name: &str) -> Result {\n let mut contents = fs::read_to_string(&file_name)?;\n let num: i32 = contents.trim().parse()?;\n Ok(num)\n}\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`from`]: From::from\n[book]: ../../book/ch09-00-error-handling.html"},"filterText":"From","kind":8,"label":"From","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"From","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Conversion from an [`Iterator`].\n\nBy implementing `FromIterator` for a type, you define how it will be\ncreated from an iterator. This is common for types which describe a\ncollection of some kind.\n\nIf you want to create a collection from the contents of an iterator, the\n[`Iterator::collect()`] method is preferred. However, when you need to\nspecify the container type, [`FromIterator::from_iter()`] can be more\nreadable than using a turbofish (e.g. `::>()`). See the\n[`Iterator::collect()`] documentation for more examples of its use.\n\nSee also: [`IntoIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v = Vec::from_iter(five_fives);\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`Iterator::collect()`] to implicitly use `FromIterator`:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v: Vec = five_fives.collect();\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`FromIterator::from_iter()`] as a more readable alternative to\n[`Iterator::collect()`]:\n\n```rust\nuse std::collections::VecDeque;\nlet first = (0..10).collect::>();\nlet second = VecDeque::from_iter(0..10);\n\nassert_eq!(first, second);\n```\n\nImplementing `FromIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement FromIterator\nimpl FromIterator for MyCollection {\n fn from_iter>(iter: I) -> Self {\n let mut c = MyCollection::new();\n\n for i in iter {\n c.add(i);\n }\n\n c\n }\n}\n\n// Now we can make a new iterator...\nlet iter = (0..5).into_iter();\n\n// ... and make a MyCollection out of it\nlet c = MyCollection::from_iter(iter);\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n\n// collect works too!\n\nlet iter = (0..5).into_iter();\nlet c: MyCollection = iter.collect();\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n```"},"filterText":"FromIterator","kind":8,"label":"FromIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"FromIterator","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A value-to-value conversion that consumes the input value. The\nopposite of [`From`].\n\nOne should avoid implementing [`Into`] and implement [`From`] instead.\nImplementing [`From`] automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nPrefer using [`Into`] over [`From`] when specifying trait bounds on a generic function\nto ensure that types that only implement [`Into`] can be used as well.\n\n**Note: This trait must not fail**. If the conversion can fail, use [`TryInto`].\n\n# Generic Implementations\n\n- [`From`]` for U` implies `Into for T`\n- [`Into`] is reflexive, which means that `Into for T` is implemented\n\n# Implementing [`Into`] for conversions to external types in old versions of Rust\n\nPrior to Rust 1.41, if the destination type was not part of the current crate\nthen you couldn't implement [`From`] directly.\nFor example, take this code:\n\n```rust\nstruct Wrapper(Vec);\nimpl From> for Vec {\n fn from(w: Wrapper) -> Vec {\n w.0\n }\n}\n```\nThis will fail to compile in older versions of the language because Rust's orphaning rules\nused to be a little bit more strict. To bypass this, you could implement [`Into`] directly:\n\n```rust\nstruct Wrapper(Vec);\nimpl Into> for Wrapper {\n fn into(self) -> Vec {\n self.0\n }\n}\n```\n\nIt is important to understand that [`Into`] does not provide a [`From`] implementation\n(as [`From`] does with [`Into`]). Therefore, you should always try to implement [`From`]\nand then fall back to [`Into`] if [`From`] can't be implemented.\n\n# Examples\n\n[`String`] implements [`Into`]`<`[`Vec`]`<`[`u8`]`>>`:\n\nIn order to express that we want a generic function to take all arguments that can be\nconverted to a specified type `T`, we can use a trait bound of [`Into`]``.\nFor example: The function `is_hello` takes all arguments that can be converted into a\n[`Vec`]`<`[`u8`]`>`.\n\n```rust\nfn is_hello>>(s: T) {\n let bytes = b\"hello\".to_vec();\n assert_eq!(bytes, s.into());\n}\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`Vec`]: ../../std/vec/struct.Vec.html"},"filterText":"Into","kind":8,"label":"Into","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Into","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Conversion into an [`Iterator`].\n\nBy implementing `IntoIterator` for a type, you define how it will be\nconverted to an iterator. This is common for types which describe a\ncollection of some kind.\n\nOne benefit of implementing `IntoIterator` is that your type will [work\nwith Rust's `for` loop syntax](crate::iter#for-loops-and-intoiterator).\n\nSee also: [`FromIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = [1, 2, 3];\nlet mut iter = v.into_iter();\n\nassert_eq!(Some(1), iter.next());\nassert_eq!(Some(2), iter.next());\nassert_eq!(Some(3), iter.next());\nassert_eq!(None, iter.next());\n```\nImplementing `IntoIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement IntoIterator\nimpl IntoIterator for MyCollection {\n type Item = i32;\n type IntoIter = std::vec::IntoIter;\n\n fn into_iter(self) -> Self::IntoIter {\n self.0.into_iter()\n }\n}\n\n// Now we can make a new collection...\nlet mut c = MyCollection::new();\n\n// ... add some stuff to it ...\nc.add(0);\nc.add(1);\nc.add(2);\n\n// ... and then turn it into an Iterator:\nfor (i, n) in c.into_iter().enumerate() {\n assert_eq!(i as i32, n);\n}\n```\n\nIt is common to use `IntoIterator` as a trait bound. This allows\nthe input collection type to change, so long as it is still an\niterator. Additional bounds can be specified by restricting on\n`Item`:\n\n```rust\nfn collect_as_strings(collection: T) -> Vec\nwhere\n T: IntoIterator,\n T::Item: std::fmt::Debug,\n{\n collection\n .into_iter()\n .map(|item| format!(\"{item:?}\"))\n .collect()\n}\n```"},"filterText":"IntoIterator","kind":8,"label":"IntoIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"IntoIterator","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for dealing with iterators.\n\nThis is the main iterator trait. For more about the concept of iterators\ngenerally, please see the [module-level documentation]. In particular, you\nmay want to know how to [implement `Iterator`][impl].\n\n[module-level documentation]: crate::iter\n[impl]: crate::iter#implementing-iterator"},"filterText":"Iterator","kind":8,"label":"Iterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Iterator","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"None","documentation":{"kind":"markdown","value":"No value."},"filterText":"None","insertTextFormat":2,"kind":20,"label":"None","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"None$0","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Ok(T)","documentation":{"kind":"markdown","value":"Contains the success value"},"filterText":"Ok()","insertTextFormat":2,"kind":20,"label":"Ok(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Ok(${1:()})$0","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The `Option` type. See [the module level documentation](self) for more."},"filterText":"Option","kind":13,"label":"Option","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Option","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for types that form a [total order](https://en.wikipedia.org/wiki/Total_order).\n\nImplementations must be consistent with the [`PartialOrd`] implementation, and ensure\n`max`, `min`, and `clamp` are consistent with `cmp`:\n\n- `partial_cmp(a, b) == Some(cmp(a, b))`.\n- `max(a, b) == max_by(a, b, cmp)` (ensured by the default implementation).\n- `min(a, b) == min_by(a, b, cmp)` (ensured by the default implementation).\n- For `a.clamp(min, max)`, see the [method docs](#method.clamp)\n (ensured by the default implementation).\n\nIt's easy to accidentally make `cmp` and `partial_cmp` disagree by\nderiving some of the traits and manually implementing others.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nFrom the above and the requirements of `PartialOrd`, it follows that for\nall `a`, `b` and `c`:\n\n- exactly one of `a < b`, `a == b` or `a > b` is true; and\n- `<` is transitive: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n\nMathematically speaking, the `<` operator defines a strict [weak order]. In\ncases where `==` conforms to mathematical equality, it also defines a\nstrict [total order].\n\n[weak order]: https://en.wikipedia.org/wiki/Weak_ordering\n[total order]: https://en.wikipedia.org/wiki/Total_order\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## Lexicographical comparison\n\nLexicographical comparison is an operation with the following properties:\n - Two sequences are compared element by element.\n - The first mismatching element defines which sequence is lexicographically less or greater than the other.\n - If one sequence is a prefix of another, the shorter sequence is lexicographically less than the other.\n - If two sequences have equivalent elements and are of the same length, then the sequences are lexicographically equal.\n - An empty sequence is lexicographically less than any non-empty sequence.\n - Two empty sequences are lexicographically equal.\n\n## How can I implement `Ord`?\n\n`Ord` requires that the type also be [`PartialOrd`] and [`Eq`] (which requires [`PartialEq`]).\n\nThen you must define an implementation for [`cmp`]. You may find it useful to use\n[`cmp`] on your type's fields.\n\nHere's an example where you want to sort people by height only, disregarding `id`\nand `name`:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n[`cmp`]: Ord::cmp"},"filterText":"Ord","kind":8,"label":"Ord (alias <, >, <=, >=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Ord","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for comparisons using the equality operator.\n\nImplementing this trait for types provides the `==` and `!=` operators for\nthose types.\n\n`x.eq(y)` can also be written `x == y`, and `x.ne(y)` can be written `x != y`.\nWe use the easier-to-read infix notation in the remainder of this documentation.\n\nThis trait allows for comparisons using the equality operator, for types\nthat do not have a full equivalence relation. For example, in floating point\nnumbers `NaN != NaN`, so floating point types implement `PartialEq` but not\n[`trait@Eq`]. Formally speaking, when `Rhs == Self`, this trait corresponds\nto a [partial equivalence relation].\n\n[partial equivalence relation]: https://en.wikipedia.org/wiki/Partial_equivalence_relation\n\nImplementations must ensure that `eq` and `ne` are consistent with each other:\n\n- `a != b` if and only if `!(a == b)`.\n\nThe default implementation of `ne` provides this consistency and is almost\nalways sufficient. It should not be overridden without very good reason.\n\nIf [`PartialOrd`] or [`Ord`] are also implemented for `Self` and `Rhs`, their methods must also\nbe consistent with `PartialEq` (see the documentation of those traits for the exact\nrequirements). It's easy to accidentally make them disagree by deriving some of the traits and\nmanually implementing others.\n\nThe equality relation `==` must satisfy the following conditions\n(for all `a`, `b`, `c` of type `A`, `B`, `C`):\n\n- **Symmetric**: if `A: PartialEq` and `B: PartialEq`, then **`a == b`\n implies `b == a`**; and\n\n- **Transitive**: if `A: PartialEq` and `B: PartialEq` and `A:\n PartialEq`, then **`a == b` and `b == c` implies `a == c`**.\n\nNote that the `B: PartialEq` (symmetric) and `A: PartialEq`\n(transitive) impls are not forced to exist, but these requirements apply\nwhenever they do exist.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d on structs, two\ninstances are equal if all fields are equal, and not equal if any fields\nare not equal. When `derive`d on enums, two instances are equal if they\nare the same variant and all fields are equal.\n\n## How can I implement `PartialEq`?\n\nAn example implementation for a domain in which two books are considered\nthe same book if their ISBN matches, even if the formats differ:\n\n```rust\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\nlet b2 = Book { isbn: 3, format: BookFormat::Ebook };\nlet b3 = Book { isbn: 10, format: BookFormat::Paperback };\n\nassert!(b1 == b2);\nassert!(b1 != b3);\n```\n\n## How can I compare two different types?\n\nThe type you can compare with is controlled by `PartialEq`'s type parameter.\nFor example, let's tweak our previous code a bit:\n\n```rust\n// The derive implements == comparisons\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\n// Implement == comparisons\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\n// Implement == comparisons\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\n\nassert!(b1 == BookFormat::Paperback);\nassert!(BookFormat::Ebook != b1);\n```\n\nBy changing `impl PartialEq for Book` to `impl PartialEq for Book`,\nwe allow `BookFormat`s to be compared with `Book`s.\n\nA comparison like the one above, which ignores some fields of the struct,\ncan be dangerous. It can easily lead to an unintended violation of the\nrequirements for a partial equivalence relation. For example, if we kept\nthe above implementation of `PartialEq` for `BookFormat` and added an\nimplementation of `PartialEq` for `Book` (either via a `#[derive]` or\nvia the manual implementation from the first example) then the result would\nviolate transitivity:\n\n```rust\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\n#[derive(PartialEq)]\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nfn main() {\n let b1 = Book { isbn: 1, format: BookFormat::Paperback };\n let b2 = Book { isbn: 2, format: BookFormat::Paperback };\n\n assert!(b1 == BookFormat::Paperback);\n assert!(BookFormat::Paperback == b2);\n\n // The following should hold by transitivity but doesn't.\n assert!(b1 == b2); // <-- PANICS\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x == y, false);\nassert_eq!(x.eq(&y), false);\n```\n\n[`eq`]: PartialEq::eq\n[`ne`]: PartialEq::ne"},"filterText":"PartialEq","kind":8,"label":"PartialEq (alias ==, !=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"PartialEq","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for types that form a [partial order](https://en.wikipedia.org/wiki/Partial_order).\n\nThe `lt`, `le`, `gt`, and `ge` methods of this trait can be called using\nthe `<`, `<=`, `>`, and `>=` operators, respectively.\n\nThe methods of this trait must be consistent with each other and with those of [`PartialEq`].\nThe following conditions must hold:\n\n1. `a == b` if and only if `partial_cmp(a, b) == Some(Equal)`.\n2. `a < b` if and only if `partial_cmp(a, b) == Some(Less)`\n3. `a > b` if and only if `partial_cmp(a, b) == Some(Greater)`\n4. `a <= b` if and only if `a < b || a == b`\n5. `a >= b` if and only if `a > b || a == b`\n6. `a != b` if and only if `!(a == b)`.\n\nConditions 2–5 above are ensured by the default implementation.\nCondition 6 is already ensured by [`PartialEq`].\n\nIf [`Ord`] is also implemented for `Self` and `Rhs`, it must also be consistent with\n`partial_cmp` (see the documentation of that trait for the exact requirements). It's\neasy to accidentally make them disagree by deriving some of the traits and manually\nimplementing others.\n\nThe comparison must satisfy, for all `a`, `b` and `c`:\n\n- transitivity: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n- duality: `a < b` if and only if `b > a`.\n\nNote that these requirements mean that the trait itself must be implemented symmetrically and\ntransitively: if `T: PartialOrd` and `U: PartialOrd` then `U: PartialOrd` and `T:\nPartialOrd`.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nThe following corollaries follow from the above requirements:\n\n- irreflexivity of `<` and `>`: `!(a < a)`, `!(a > a)`\n- transitivity of `>`: if `a > b` and `b > c` then `a > c`\n- duality of `partial_cmp`: `partial_cmp(a, b) == partial_cmp(b, a).map(Ordering::reverse)`\n\n## Strict and non-strict partial orders\n\nThe `<` and `>` operators behave according to a *strict* partial order.\nHowever, `<=` and `>=` do **not** behave according to a *non-strict*\npartial order.\nThat is because mathematically, a non-strict partial order would require\nreflexivity, i.e. `a <= a` would need to be true for every `a`. This isn't\nalways the case for types that implement `PartialOrd`, for example:\n\n```rust\nlet a = f64::sqrt(-1.0);\nassert_eq!(a <= a, false);\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## How can I implement `PartialOrd`?\n\n`PartialOrd` only requires implementation of the [`partial_cmp`] method, with the others\ngenerated from default implementations.\n\nHowever it remains possible to implement the others separately for types which do not have a\ntotal order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==\nfalse` (cf. IEEE 754-2008 section 5.11).\n\n`PartialOrd` requires your type to be [`PartialEq`].\n\nIf your type is [`Ord`], you can implement [`partial_cmp`] by using [`cmp`]:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\nYou may also find it useful to use [`partial_cmp`] on your type's fields. Here\nis an example of `Person` types who have a floating-point `height` field that\nis the only field to be used for sorting:\n\n```rust\nuse std::cmp::Ordering;\n\nstruct Person {\n id: u32,\n name: String,\n height: f64,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n self.height.partial_cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x < y, true);\nassert_eq!(x.lt(&y), true);\n```\n\n[`partial_cmp`]: PartialOrd::partial_cmp\n[`cmp`]: Ord::cmp"},"filterText":"PartialOrd","kind":8,"label":"PartialOrd (alias >, <, <=, >=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"PartialOrd","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"`Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).\n\nSee the [module documentation](self) for details."},"filterText":"Result","kind":13,"label":"Result","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Result","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"RustcDecodable","kind":18,"label":"RustcDecodable","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"RustcDecodable","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"RustcEncodable","kind":18,"label":"RustcEncodable","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"RustcEncodable","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Some(T)","documentation":{"kind":"markdown","value":"Some value of type `T`."},"filterText":"Some()","insertTextFormat":2,"kind":20,"label":"Some(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Some(${1:()})$0","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A UTF-8–encoded, growable string.\n\nThe `String` type is the most common string type that has ownership over the\ncontents of the string. It has a close relationship with its borrowed\ncounterpart, the primitive [`str`].\n\n# Examples\n\nYou can create a `String` from [a literal string][`&str`] with [`String::from`]:\n\n[`String::from`]: From::from\n\n```rust\nlet hello = String::from(\"Hello, world!\");\n```\n\nYou can append a [`char`] to a `String` with the [`push`] method, and\nappend a [`&str`] with the [`push_str`] method:\n\n```rust\nlet mut hello = String::from(\"Hello, \");\n\nhello.push('w');\nhello.push_str(\"orld!\");\n```\n\n[`push`]: String::push\n[`push_str`]: String::push_str\n\nIf you have a vector of UTF-8 bytes, you can create a `String` from it with\nthe [`from_utf8`] method:\n\n```rust\n// some bytes, in a vector\nlet sparkle_heart = vec![240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `unwrap()`.\nlet sparkle_heart = String::from_utf8(sparkle_heart).unwrap();\n\nassert_eq!(\"💖\", sparkle_heart);\n```\n\n[`from_utf8`]: String::from_utf8\n\n# UTF-8\n\n`String`s are always valid UTF-8. If you need a non-UTF-8 string, consider\n[`OsString`]. It is similar, but without the UTF-8 constraint. Because UTF-8\nis a variable width encoding, `String`s are typically smaller than an array of\nthe same `chars`:\n\n```rust\nuse std::mem;\n\n// `s` is ASCII which represents each `char` as one byte\nlet s = \"hello\";\nassert_eq!(s.len(), 5);\n\n// A `char` array with the same contents would be longer because\n// every `char` is four bytes\nlet s = ['h', 'e', 'l', 'l', 'o'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n\n// However, for non-ASCII strings, the difference will be smaller\n// and sometimes they are the same\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.len(), 20);\n\nlet s = ['💖', '💖', '💖', '💖', '💖'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n```\n\nThis raises interesting questions as to how `s[i]` should work.\nWhat should `i` be here? Several options include byte indices and\n`char` indices but, because of UTF-8 encoding, only byte indices\nwould provide constant time indexing. Getting the `i`th `char`, for\nexample, is available using [`chars`]:\n\n```rust\nlet s = \"hello\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('l'));\n\nlet s = \"💖💖💖💖💖\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('💖'));\n```\n\nNext, what should `s[i]` return? Because indexing returns a reference\nto underlying data it could be `&u8`, `&[u8]`, or something else similar.\nSince we're only providing one index, `&u8` makes the most sense but that\nmight not be what the user expects and can be explicitly achieved with\n[`as_bytes()`]:\n\n```rust\n// The first byte is 104 - the byte value of `'h'`\nlet s = \"hello\";\nassert_eq!(s.as_bytes()[0], 104);\n// or\nassert_eq!(s.as_bytes()[0], b'h');\n\n// The first byte is 240 which isn't obviously useful\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.as_bytes()[0], 240);\n```\n\nDue to these ambiguities/restrictions, indexing with a `usize` is simply\nforbidden:\n\n```rust\nlet s = \"hello\";\n\n// The following will not compile!\nprintln!(\"The first letter of s is {}\", s[0]);\n```\n\nIt is more clear, however, how `&s[i..j]` should work (that is,\nindexing with a range). It should accept byte indices (to be constant-time)\nand return a `&str` which is UTF-8 encoded. This is also called \"string slicing\".\nNote this will panic if the byte indices provided are not character\nboundaries - see [`is_char_boundary`] for more details. See the implementations\nfor [`SliceIndex`] for more details on string slicing. For a non-panicking\nversion of string slicing, see [`get`].\n\n[`OsString`]: ../../std/ffi/struct.OsString.html \"ffi::OsString\"\n[`SliceIndex`]: core::slice::SliceIndex\n[`as_bytes()`]: str::as_bytes\n[`get`]: str::get\n[`is_char_boundary`]: str::is_char_boundary\n\nThe [`bytes`] and [`chars`] methods return iterators over the bytes and\ncodepoints of the string, respectively. To iterate over codepoints along\nwith byte indices, use [`char_indices`].\n\n[`bytes`]: str::bytes\n[`chars`]: str::chars\n[`char_indices`]: str::char_indices\n\n# Deref\n\n`String` implements [Deref], and so inherits all of [`str`]'s\nmethods. In addition, this means that you can pass a `String` to a\nfunction which takes a [`&str`] by using an ampersand (`&`):\n\n```rust\nfn takes_str(s: &str) { }\n\nlet s = String::from(\"Hello\");\n\ntakes_str(&s);\n```\n\nThis will create a [`&str`] from the `String` and pass it in. This\nconversion is very inexpensive, and so generally, functions will accept\n[`&str`]s as arguments unless they need a `String` for some specific\nreason.\n\nIn certain cases Rust doesn't have enough information to make this\nconversion, known as [`Deref`] coercion. In the following example a string\nslice [`&'a str`][`&str`] implements the trait `TraitExample`, and the function\n`example_func` takes anything that implements the trait. In this case Rust\nwould need to make two implicit conversions, which Rust doesn't have the\nmeans to do. For that reason, the following example will not compile.\n\n```rust\ntrait TraitExample {}\n\nimpl<'a> TraitExample for &'a str {}\n\nfn example_func(example_arg: A) {}\n\nlet example_string = String::from(\"example_string\");\nexample_func(&example_string);\n```\n\nThere are two options that would work instead. The first would be to\nchange the line `example_func(&example_string);` to\n`example_func(example_string.as_str());`, using the method [`as_str()`]\nto explicitly extract the string slice containing the string. The second\nway changes `example_func(&example_string);` to\n`example_func(&*example_string);`. In this case we are dereferencing a\n`String` to a [`str`], then referencing the [`str`] back to\n[`&str`]. The second way is more idiomatic, however both work to do the\nconversion explicitly rather than relying on the implicit conversion.\n\n# Representation\n\nA `String` is made up of three components: a pointer to some bytes, a\nlength, and a capacity. The pointer points to an internal buffer `String`\nuses to store its data. The length is the number of bytes currently stored\nin the buffer, and the capacity is the size of the buffer in bytes. As such,\nthe length will always be less than or equal to the capacity.\n\nThis buffer is always stored on the heap.\n\nYou can look at these with the [`as_ptr`], [`len`], and [`capacity`]\nmethods:\n\n```rust\nuse std::mem;\n\nlet story = String::from(\"Once upon a time...\");\n\n// Prevent automatically dropping the String's data\nlet mut story = mem::ManuallyDrop::new(story);\n\nlet ptr = story.as_mut_ptr();\nlet len = story.len();\nlet capacity = story.capacity();\n\n// story has nineteen bytes\nassert_eq!(19, len);\n\n// We can re-build a String out of ptr, len, and capacity. This is all\n// unsafe because we are responsible for making sure the components are\n// valid:\nlet s = unsafe { String::from_raw_parts(ptr, len, capacity) } ;\n\nassert_eq!(String::from(\"Once upon a time...\"), s);\n```\n\n[`as_ptr`]: str::as_ptr\n[`len`]: String::len\n[`capacity`]: String::capacity\n\nIf a `String` has enough capacity, adding elements to it will not\nre-allocate. For example, consider this program:\n\n```rust\nlet mut s = String::new();\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\nThis will output the following:\n\n```text\n0\n8\n16\n16\n32\n32\n```\n\nAt first, we have no memory allocated at all, but as we append to the\nstring, it increases its capacity appropriately. If we instead use the\n[`with_capacity`] method to allocate the correct capacity initially:\n\n```rust\nlet mut s = String::with_capacity(25);\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\n[`with_capacity`]: String::with_capacity\n\nWe end up with a different output:\n\n```text\n25\n25\n25\n25\n25\n25\n```\n\nHere, there's no need to allocate more memory inside the loop.\n\n[str]: prim@str \"str\"\n[`str`]: prim@str \"str\"\n[`&str`]: prim@str \"&str\"\n[Deref]: core::ops::Deref \"ops::Deref\"\n[`Deref`]: core::ops::Deref \"ops::Deref\"\n[`as_str()`]: String::as_str"},"filterText":"String","kind":22,"label":"String","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"String","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A generalization of `Clone` to borrowed data.\n\nSome types make it possible to go from borrowed to owned, usually by\nimplementing the `Clone` trait. But `Clone` works only for going from `&T`\nto `T`. The `ToOwned` trait generalizes `Clone` to construct owned data\nfrom any borrow of a given type."},"filterText":"ToOwned","kind":8,"label":"ToOwned","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"ToOwned","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for converting a value to a `String`.\n\nThis trait is automatically implemented for any type which implements the\n[`Display`] trait. As such, `ToString` shouldn't be implemented directly:\n[`Display`] should be implemented instead, and you get the `ToString`\nimplementation for free.\n\n[`Display`]: fmt::Display"},"filterText":"ToString","kind":8,"label":"ToString","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"ToString","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Simple and safe type conversions that may fail in a controlled\nway under some circumstances. It is the reciprocal of [`TryInto`].\n\nThis is useful when you are doing a type conversion that may\ntrivially succeed but may also need special handling.\nFor example, there is no way to convert an [`i64`] into an [`i32`]\nusing the [`From`] trait, because an [`i64`] may contain a value\nthat an [`i32`] cannot represent and so the conversion would lose data.\nThis might be handled by truncating the [`i64`] to an [`i32`] or by\nsimply returning [`i32::MAX`], or by some other method. The [`From`]\ntrait is intended for perfect conversions, so the `TryFrom` trait\ninforms the programmer when a type conversion could go bad and lets\nthem decide how to handle it.\n\n# Generic Implementations\n\n- `TryFrom for U` implies [`TryInto`]` for T`\n- [`try_from`] is reflexive, which means that `TryFrom for T`\nis implemented and cannot fail -- the associated `Error` type for\ncalling `T::try_from()` on a value of type `T` is [`Infallible`].\nWhen the [`!`] type is stabilized [`Infallible`] and [`!`] will be\nequivalent.\n\n`TryFrom` can be implemented as follows:\n\n```rust\nstruct GreaterThanZero(i32);\n\nimpl TryFrom for GreaterThanZero {\n type Error = &'static str;\n\n fn try_from(value: i32) -> Result {\n if value <= 0 {\n Err(\"GreaterThanZero only accepts values greater than zero!\")\n } else {\n Ok(GreaterThanZero(value))\n }\n }\n}\n```\n\n# Examples\n\nAs described, [`i32`] implements `TryFrom<`[`i64`]`>`:\n\n```rust\nlet big_number = 1_000_000_000_000i64;\n// Silently truncates `big_number`, requires detecting\n// and handling the truncation after the fact.\nlet smaller_number = big_number as i32;\nassert_eq!(smaller_number, -727379968);\n\n// Returns an error because `big_number` is too big to\n// fit in an `i32`.\nlet try_smaller_number = i32::try_from(big_number);\nassert!(try_smaller_number.is_err());\n\n// Returns `Ok(3)`.\nlet try_successful_smaller_number = i32::try_from(3);\nassert!(try_successful_smaller_number.is_ok());\n```\n\n[`try_from`]: TryFrom::try_from"},"filterText":"TryFrom","kind":8,"label":"TryFrom","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"TryFrom","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An attempted conversion that consumes `self`, which may or may not be\nexpensive.\n\nLibrary authors should usually not directly implement this trait,\nbut should prefer implementing the [`TryFrom`] trait, which offers\ngreater flexibility and provides an equivalent `TryInto`\nimplementation for free, thanks to a blanket implementation in the\nstandard library. For more information on this, see the\ndocumentation for [`Into`].\n\n# Implementing `TryInto`\n\nThis suffers the same restrictions and reasoning as implementing\n[`Into`], see there for details."},"filterText":"TryInto","kind":8,"label":"TryInto","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"TryInto","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A contiguous growable array type, written as `Vec`, short for 'vector'.\n\n# Examples\n\n```rust\nlet mut vec = Vec::new();\nvec.push(1);\nvec.push(2);\n\nassert_eq!(vec.len(), 2);\nassert_eq!(vec[0], 1);\n\nassert_eq!(vec.pop(), Some(2));\nassert_eq!(vec.len(), 1);\n\nvec[0] = 7;\nassert_eq!(vec[0], 7);\n\nvec.extend([1, 2, 3]);\n\nfor x in &vec {\n println!(\"{x}\");\n}\nassert_eq!(vec, [7, 1, 2, 3]);\n```\n\nThe [`vec!`] macro is provided for convenient initialization:\n\n```rust\nlet mut vec1 = vec![1, 2, 3];\nvec1.push(4);\nlet vec2 = Vec::from([1, 2, 3, 4]);\nassert_eq!(vec1, vec2);\n```\n\nIt can also initialize each element of a `Vec` with a given value.\nThis may be more efficient than performing allocation and initialization\nin separate steps, especially when initializing a vector of zeros:\n\n```rust\nlet vec = vec![0; 5];\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n\n// The following is equivalent, but potentially slower:\nlet mut vec = Vec::with_capacity(5);\nvec.resize(5, 0);\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n```\n\nFor more information, see\n[Capacity and Reallocation](#capacity-and-reallocation).\n\nUse a `Vec` as an efficient stack:\n\n```rust\nlet mut stack = Vec::new();\n\nstack.push(1);\nstack.push(2);\nstack.push(3);\n\nwhile let Some(top) = stack.pop() {\n // Prints 3, 2, 1\n println!(\"{top}\");\n}\n```\n\n# Indexing\n\nThe `Vec` type allows access to values by index, because it implements the\n[`Index`] trait. An example will be more explicit:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[1]); // it will display '2'\n```\n\nHowever be careful: if you try to access an index which isn't in the `Vec`,\nyour software will panic! You cannot do this:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[6]); // it will panic!\n```\n\nUse [`get`] and [`get_mut`] if you want to check whether the index is in\nthe `Vec`.\n\n# Slicing\n\nA `Vec` can be mutable. On the other hand, slices are read-only objects.\nTo get a [slice][prim@slice], use [`&`]. Example:\n\n```rust\nfn read_slice(slice: &[usize]) {\n // ...\n}\n\nlet v = vec![0, 1];\nread_slice(&v);\n\n// ... and that's all!\n// you can also do it like this:\nlet u: &[usize] = &v;\n// or like this:\nlet u: &[_] = &v;\n```\n\nIn Rust, it's more common to pass slices as arguments rather than vectors\nwhen you just want to provide read access. The same goes for [`String`] and\n[`&str`].\n\n# Capacity and reallocation\n\nThe capacity of a vector is the amount of space allocated for any future\nelements that will be added onto the vector. This is not to be confused with\nthe *length* of a vector, which specifies the number of actual elements\nwithin the vector. If a vector's length exceeds its capacity, its capacity\nwill automatically be increased, but its elements will have to be\nreallocated.\n\nFor example, a vector with capacity 10 and length 0 would be an empty vector\nwith space for 10 more elements. Pushing 10 or fewer elements onto the\nvector will not change its capacity or cause reallocation to occur. However,\nif the vector's length is increased to 11, it will have to reallocate, which\ncan be slow. For this reason, it is recommended to use [`Vec::with_capacity`]\nwhenever possible to specify how big the vector is expected to get.\n\n# Guarantees\n\nDue to its incredibly fundamental nature, `Vec` makes a lot of guarantees\nabout its design. This ensures that it's as low-overhead as possible in\nthe general case, and can be correctly manipulated in primitive ways\nby unsafe code. Note that these guarantees refer to an unqualified `Vec`.\nIf additional type parameters are added (e.g., to support custom allocators),\noverriding their defaults may change the behavior.\n\nMost fundamentally, `Vec` is and always will be a (pointer, capacity, length)\ntriplet. No more, no less. The order of these fields is completely\nunspecified, and you should use the appropriate methods to modify these.\nThe pointer will never be null, so this type is null-pointer-optimized.\n\nHowever, the pointer might not actually point to allocated memory. In particular,\nif you construct a `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],\n[`Vec::with_capacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]\non an empty Vec, it will not allocate memory. Similarly, if you store zero-sized\ntypes inside a `Vec`, it will not allocate space for them. *Note that in this case\nthe `Vec` might not report a [`capacity`] of 0*. `Vec` will allocate if and only\nif [mem::size_of::\\]\\() * [capacity]\\() > 0. In general, `Vec`'s allocation\ndetails are very subtle --- if you intend to allocate memory using a `Vec`\nand use it for something else (either to pass to unsafe code, or to build your\nown memory-backed collection), be sure to deallocate this memory by using\n`from_raw_parts` to recover the `Vec` and then dropping it.\n\nIf a `Vec` *has* allocated memory, then the memory it points to is on the heap\n(as defined by the allocator Rust is configured to use by default), and its\npointer points to [`len`] initialized, contiguous elements in order (what\nyou would see if you coerced it to a slice), followed by [capacity] - [len]\nlogically uninitialized, contiguous elements.\n\nA vector containing the elements `'a'` and `'b'` with capacity 4 can be\nvisualized as below. The top part is the `Vec` struct, it contains a\npointer to the head of the allocation in the heap, length and capacity.\nThe bottom part is the allocation on the heap, a contiguous memory block.\n\n```text\n ptr len capacity\n +--------+--------+--------+\n | 0x0123 | 2 | 4 |\n +--------+--------+--------+\n |\n v\nHeap +--------+--------+--------+--------+\n | 'a' | 'b' | uninit | uninit |\n +--------+--------+--------+--------+\n```\n\n- **uninit** represents memory that is not initialized, see [`MaybeUninit`].\n- Note: the ABI is not stable and `Vec` makes no guarantees about its memory\n layout (including the order of fields).\n\n`Vec` will never perform a \"small optimization\" where elements are actually\nstored on the stack for two reasons:\n\n* It would make it more difficult for unsafe code to correctly manipulate\n a `Vec`. The contents of a `Vec` wouldn't have a stable address if it were\n only moved, and it would be more difficult to determine if a `Vec` had\n actually allocated memory.\n\n* It would penalize the general case, incurring an additional branch\n on every access.\n\n`Vec` will never automatically shrink itself, even if completely empty. This\nensures no unnecessary allocations or deallocations occur. Emptying a `Vec`\nand then filling it back up to the same [`len`] should incur no calls to\nthe allocator. If you wish to free up unused memory, use\n[`shrink_to_fit`] or [`shrink_to`].\n\n[`push`] and [`insert`] will never (re)allocate if the reported capacity is\nsufficient. [`push`] and [`insert`] *will* (re)allocate if\n[len] == [capacity]. That is, the reported capacity is completely\naccurate, and can be relied on. It can even be used to manually free the memory\nallocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even\nwhen not necessary.\n\n`Vec` does not guarantee any particular growth strategy when reallocating\nwhen full, nor when [`reserve`] is called. The current strategy is basic\nand it may prove desirable to use a non-constant growth factor. Whatever\nstrategy is used will of course guarantee *O*(1) amortized [`push`].\n\n`vec![x; n]`, `vec![a, b, c, d]`, and\n[`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`\nwith exactly the requested capacity. If [len] == [capacity],\n(as is the case for the [`vec!`] macro), then a `Vec` can be converted to\nand from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.\n\n`Vec` will not specifically overwrite any data that is removed from it,\nbut also won't specifically preserve it. Its uninitialized memory is\nscratch space that it may use however it wants. It will generally just do\nwhatever is most efficient or otherwise easy to implement. Do not rely on\nremoved data to be erased for security purposes. Even if you drop a `Vec`, its\nbuffer may simply be reused by another allocation. Even if you zero a `Vec`'s memory\nfirst, that might not actually happen because the optimizer does not consider\nthis a side-effect that must be preserved. There is one case which we will\nnot break, however: using `unsafe` code to write to the excess capacity,\nand then increasing the length to match, is always valid.\n\nCurrently, `Vec` does not guarantee the order in which elements are dropped.\nThe order has changed in the past and may change again.\n\n[`get`]: slice::get\n[`get_mut`]: slice::get_mut\n[`String`]: crate::string::String\n[`&str`]: type@str\n[`shrink_to_fit`]: Vec::shrink_to_fit\n[`shrink_to`]: Vec::shrink_to\n[capacity]: Vec::capacity\n[`capacity`]: Vec::capacity\n[mem::size_of::\\]: core::mem::size_of\n[len]: Vec::len\n[`len`]: Vec::len\n[`push`]: Vec::push\n[`insert`]: Vec::insert\n[`reserve`]: Vec::reserve\n[`MaybeUninit`]: core::mem::MaybeUninit\n[owned slice]: Box"},"filterText":"Vec","kind":22,"label":"Vec","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"Vec","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"alloc_error_handler","kind":18,"label":"alloc_error_handler","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"alloc_error_handler","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"fn(T)","documentation":{"kind":"markdown","value":"Disposes of a value.\n\nThis does so by calling the argument's implementation of [`Drop`][drop].\n\nThis effectively does nothing for types which implement `Copy`, e.g.\nintegers. Such values are copied and _then_ moved into the function, so the\nvalue persists after this function call.\n\nThis function is not magic; it is literally defined as\n\n```rust\npub fn drop(_x: T) {}\n```\n\nBecause `_x` is moved into the function, it is automatically dropped before\nthe function returns.\n\n[drop]: Drop\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = vec![1, 2, 3];\n\ndrop(v); // explicitly drop the vector\n```\n\nSince [`RefCell`] enforces the borrow rules at runtime, `drop` can\nrelease a [`RefCell`] borrow:\n\n```rust\nuse std::cell::RefCell;\n\nlet x = RefCell::new(1);\n\nlet mut mutable_borrow = x.borrow_mut();\n*mutable_borrow = 1;\n\ndrop(mutable_borrow); // relinquish the mutable borrow on this slot\n\nlet borrow = x.borrow();\nprintln!(\"{}\", *borrow);\n```\n\nIntegers and other types implementing [`Copy`] are unaffected by `drop`.\n\n```rust\n#[derive(Copy, Clone)]\nstruct Foo(u8);\n\nlet x = 1;\nlet y = Foo(2);\ndrop(x); // a copy of `x` is moved and dropped\ndrop(y); // a copy of `y` is moved and dropped\n\nprintln!(\"x: {}, y: {}\", x, y.0); // still available\n```\n\n[`RefCell`]: crate::cell::RefCell"},"filterText":"drop","insertTextFormat":2,"kind":3,"label":"drop(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"drop(${1:x})$0","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"type_ascribe","kind":18,"label":"type_ascribe","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"type_ascribe","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"unsafe","insertTextFormat":2,"kind":14,"label":"unsafe","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"unsafe {\n $0\n};","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"match","insertTextFormat":2,"kind":14,"label":"match","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"match $1 {\n $0\n};","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"while","insertTextFormat":2,"kind":14,"label":"while","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"while $1 {\n $0\n};","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"while let","insertTextFormat":2,"kind":14,"label":"while let","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"while let $1 = $2 {\n $0\n};","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"loop","insertTextFormat":2,"kind":14,"label":"loop","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"loop {\n $0\n};","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"if","insertTextFormat":2,"kind":14,"label":"if","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"if $1 {\n $0\n};","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"if let","insertTextFormat":2,"kind":14,"label":"if let","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"if let $1 = $2 {\n $0\n};","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"for","insertTextFormat":2,"kind":14,"label":"for","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"for $1 in $2 {\n $0\n};","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"true","insertTextFormat":2,"kind":14,"label":"true","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"true","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"false","insertTextFormat":2,"kind":14,"label":"false","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"false","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"return","insertTextFormat":2,"kind":14,"label":"return","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}},"newText":"return","replace":{"end":{"character":24,"line":1},"start":{"character":12,"line":1}}}}]} 2023-12-27T20:29:12.269 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"contentChanges":[{"range":{"end":{"character":24,"line":1},"start":{"character":24,"line":1}},"text":"a"}],"textDocument":{"uri":"file:///tmp/flicker/src/main.rs","version":12}}} 2023-12-27T20:29:12.270 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///tmp/flicker/src/main.rs","diagnostics":[{"range":{"start":{"line":1,"character":25},"end":{"line":1,"character":25}},"severity":1,"code":"syntax-error","codeDescription":{"href":"https://doc.rust-lang.org/stable/error_codes/syntax-error.html"},"source":"rust-analyzer","message":"Syntax Error: expected SEMICOLON"}],"version":12}} 2023-12-27T20:29:12.372 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"textDocument/completion","params":{"position":{"character":25,"line":1},"textDocument":{"uri":"file:///tmp/flicker/src/main.rs"}},"id":5} 2023-12-27T20:29:12.379 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":5,"result":{"isIncomplete":true,"items":[{"label":"self::","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"self::","textEdit":{"newText":"self::","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"crate::","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"crate::","textEdit":{"newText":"crate::","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"main()","kind":3,"detail":"fn()","deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"main","insertTextFormat":2,"textEdit":{"newText":"main()$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"panic!(…)","kind":3,"detail":"macro_rules! panic","deprecated":false,"sortText":"ffffffef","filterText":"panic!","insertTextFormat":2,"textEdit":{"newText":"panic!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"println!(…)","kind":3,"detail":"macro_rules! println","documentation":{"kind":"markdown","value":"Prints to the standard output, with a newline.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`)).\n\nThis macro uses the same syntax as [`format!`], but writes to the standard output instead.\nSee [`std::fmt`] for more information.\n\nThe `println!` macro will lock the standard output on each call. If you call\n`println!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwriteln!(lock, \"hello world\").unwrap();\n```\n\nUse `println!` only for the primary output of your program. Use\n[`eprintln!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`std::fmt`]: crate::fmt\n[`eprintln!`]: crate::eprintln\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to [`io::stdout`] fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n[`io::stdout`]: crate::io::stdout\n\n# Examples\n\n```rust\nprintln!(); // prints just a newline\nprintln!(\"hello there!\");\nprintln!(\"format {} arguments\", \"some\");\nlet local_variable = \"some\";\nprintln!(\"format {local_variable} arguments\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"println!","insertTextFormat":2,"textEdit":{"newText":"println!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"debug_assert_eq!(…)","kind":3,"detail":"macro_rules! debug_assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_eq!`], `debug_assert_eq!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_eq!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_eq!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_eq!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\ndebug_assert_eq!(a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert_eq!","insertTextFormat":2,"textEdit":{"newText":"debug_assert_eq!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"include_str!(…)","kind":3,"detail":"macro_rules! include_str","documentation":{"kind":"markdown","value":"Includes a UTF-8 encoded file as a string.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static str` which is the\ncontents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_str = include_str!(\"spanish.in\");\n assert_eq!(my_str, \"adiós\\n\");\n print!(\"{my_str}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include_str!","insertTextFormat":2,"textEdit":{"newText":"include_str!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"concat!(…)","kind":3,"detail":"macro_rules! concat","documentation":{"kind":"markdown","value":"Concatenates literals into a static string slice.\n\nThis macro takes any number of comma-separated literals, yielding an\nexpression of type `&'static str` which represents all of the literals\nconcatenated left-to-right.\n\nInteger and floating point literals are [stringified](core::stringify) in order to be\nconcatenated.\n\n# Examples\n\n```rust\nlet s = concat!(\"test\", 10, 'b', true);\nassert_eq!(s, \"test10btrue\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat!","insertTextFormat":2,"textEdit":{"newText":"concat!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"format!(…)","kind":3,"detail":"macro_rules! format","documentation":{"kind":"markdown","value":"Creates a `String` using interpolation of runtime expressions.\n\nThe first argument `format!` receives is a format string. This must be a string\nliteral. The power of the formatting string is in the `{}`s contained.\nAdditional parameters passed to `format!` replace the `{}`s within the\nformatting string in the order given unless named or positional parameters\nare used.\n\nSee [the formatting syntax documentation in `std::fmt`](../std/fmt/index.html)\nfor details.\n\nA common use for `format!` is concatenation and interpolation of strings.\nThe same convention is used with [`print!`] and [`write!`] macros,\ndepending on the intended destination of the string; all these macros internally use [`format_args!`].\n\nTo convert a single value to a string, use the [`to_string`] method. This\nwill use the [`Display`] formatting trait.\n\nTo concatenate literals into a `&'static str`, use the [`concat!`] macro.\n\n[`print!`]: ../std/macro.print.html\n[`write!`]: core::write\n[`format_args!`]: core::format_args\n[`to_string`]: crate::string::ToString\n[`Display`]: core::fmt::Display\n[`concat!`]: core::concat\n\n# Panics\n\n`format!` panics if a formatting trait implementation returns an error.\nThis indicates an incorrect implementation\nsince `fmt::Write for String` never returns an error itself.\n\n# Examples\n\n```rust\nformat!(\"test\"); // => \"test\"\nformat!(\"hello {}\", \"world!\"); // => \"hello world!\"\nformat!(\"x = {}, y = {val}\", 10, val = 30); // => \"x = 10, y = 30\"\nlet (x, y) = (1, 2);\nformat!(\"{x} + {y} = 3\"); // => \"1 + 2 = 3\"\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"format!","insertTextFormat":2,"textEdit":{"newText":"format!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"log_syntax!(…)","kind":3,"detail":"macro_rules! log_syntax","documentation":{"kind":"markdown","value":"Prints passed tokens into the standard output."},"deprecated":false,"sortText":"ffffffef","filterText":"log_syntax!","insertTextFormat":2,"textEdit":{"newText":"log_syntax!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"stringify!(…)","kind":3,"detail":"macro_rules! stringify","documentation":{"kind":"markdown","value":"Stringifies its arguments.\n\nThis macro will yield an expression of type `&'static str` which is the\nstringification of all the tokens passed to the macro. No restrictions\nare placed on the syntax of the macro invocation itself.\n\nNote that the expanded results of the input tokens may change in the\nfuture. You should be careful if you rely on the output.\n\n# Examples\n\n```rust\nlet one_plus_one = stringify!(1 + 1);\nassert_eq!(one_plus_one, \"1 + 1\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"stringify!","insertTextFormat":2,"textEdit":{"newText":"stringify!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"assert_ne!(…)","kind":3,"detail":"macro_rules! assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\nassert_ne!(a, b);\n\nassert_ne!(a, b, \"we are testing that the values are not equal\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert_ne!","insertTextFormat":2,"textEdit":{"newText":"assert_ne!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"dbg!(…)","kind":3,"detail":"macro_rules! dbg","documentation":{"kind":"markdown","value":"Prints and returns the value of a given expression for quick and dirty\ndebugging.\n\nAn example:\n\n```rust\nlet a = 2;\nlet b = dbg!(a * 2) + 1;\n// ^-- prints: [src/main.rs:2] a * 2 = 4\nassert_eq!(b, 5);\n```\n\nThe macro works by using the `Debug` implementation of the type of\nthe given expression to print the value to [stderr] along with the\nsource location of the macro invocation as well as the source code\nof the expression.\n\nInvoking the macro on an expression moves and takes ownership of it\nbefore returning the evaluated expression unchanged. If the type\nof the expression does not implement `Copy` and you don't want\nto give up ownership, you can instead borrow with `dbg!(&expr)`\nfor some expression `expr`.\n\nThe `dbg!` macro works exactly the same in release builds.\nThis is useful when debugging issues that only occur in release\nbuilds or when debugging in release mode is significantly faster.\n\nNote that the macro is intended as a debugging tool and therefore you\nshould avoid having uses of it in version control for long periods\n(other than in tests and similar).\nDebug output from production code is better done with other facilities\nsuch as the [`debug!`] macro from the [`log`] crate.\n\n# Stability\n\nThe exact output printed by this macro should not be relied upon\nand is subject to future changes.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\n# Further examples\n\nWith a method call:\n\n```rust\nfn foo(n: usize) {\n if let Some(_) = dbg!(n.checked_sub(4)) {\n // ...\n }\n}\n\nfoo(3)\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:4] n.checked_sub(4) = None\n```\n\nNaive factorial implementation:\n\n```rust\nfn factorial(n: u32) -> u32 {\n if dbg!(n <= 1) {\n dbg!(1)\n } else {\n dbg!(n * factorial(n - 1))\n }\n}\n\ndbg!(factorial(4));\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = true\n[src/main.rs:4] 1 = 1\n[src/main.rs:5] n * factorial(n - 1) = 2\n[src/main.rs:5] n * factorial(n - 1) = 6\n[src/main.rs:5] n * factorial(n - 1) = 24\n[src/main.rs:11] factorial(4) = 24\n```\n\nThe `dbg!(..)` macro moves the input:\n\n```rust\n/// A wrapper around `usize` which importantly is not Copyable.\n#[derive(Debug)]\nstruct NoCopy(usize);\n\nlet a = NoCopy(42);\nlet _ = dbg!(a); // <-- `a` is moved here.\nlet _ = dbg!(a); // <-- `a` is moved again; error!\n```\n\nYou can also use `dbg!()` without a value to just print the\nfile and line whenever it's reached.\n\nFinally, if you want to `dbg!(..)` multiple values, it will treat them as\na tuple (and return it, too):\n\n```rust\nassert_eq!(dbg!(1usize, 2u32), (1, 2));\n```\n\nHowever, a single argument with a trailing comma will still not be treated\nas a tuple, following the convention of ignoring trailing commas in macro\ninvocations. You can use a 1-tuple directly if you need one:\n\n```rust\nassert_eq!(1, dbg!(1u32,)); // trailing comma ignored\nassert_eq!((1,), dbg!((1u32,))); // 1-tuple\n```\n\n[stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)\n[`debug!`]: https://docs.rs/log/*/log/macro.debug.html\n[`log`]: https://crates.io/crates/log"},"deprecated":false,"sortText":"ffffffef","filterText":"dbg!","insertTextFormat":2,"textEdit":{"newText":"dbg!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"vec![…]","kind":3,"detail":"macro_rules! vec","documentation":{"kind":"markdown","value":"Creates a [`Vec`] containing the arguments.\n\n`vec!` allows `Vec`s to be defined with the same syntax as array expressions.\nThere are two forms of this macro:\n\n- Create a [`Vec`] containing a given list of elements:\n\n```rust\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```\n\n- Create a [`Vec`] from a given element and size:\n\n```rust\nlet v = vec![1; 3];\nassert_eq!(v, [1, 1, 1]);\n```\n\nNote that unlike array expressions this syntax supports all elements\nwhich implement [`Clone`] and the number of elements doesn't have to be\na constant.\n\nThis will use `clone` to duplicate an expression, so one should be careful\nusing this with types having a nonstandard `Clone` implementation. For\nexample, `vec![Rc::new(1); 5]` will create a vector of five references\nto the same boxed integer value, not five references pointing to independently\nboxed integers.\n\nAlso, note that `vec![expr; 0]` is allowed, and produces an empty vector.\nThis will still evaluate `expr`, however, and immediately drop the resulting value, so\nbe mindful of side effects.\n\n[`Vec`]: crate::vec::Vec"},"deprecated":false,"sortText":"ffffffef","filterText":"vec!","insertTextFormat":2,"textEdit":{"newText":"vec![$0]","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"include!(…)","kind":3,"detail":"macro_rules! include","documentation":{"kind":"markdown","value":"Parses a file as an expression or an item according to the context.\n\n**Warning**: For multi-file Rust projects, the `include!` macro is probably not what you\nare looking for. Usually, multi-file Rust projects use\n[modules](https://doc.rust-lang.org/reference/items/modules.html). Multi-file projects and\nmodules are explained in the Rust-by-Example book\n[here](https://doc.rust-lang.org/rust-by-example/mod/split.html) and the module system is\nexplained in the Rust Book\n[here](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html).\n\nThe included file is placed in the surrounding code\n[unhygienically](https://doc.rust-lang.org/reference/macros-by-example.html#hygiene). If\nthe included file is parsed as an expression and variables or functions share names across\nboth files, it could result in variables or functions being different from what the\nincluded file expected.\n\nThe included file is located relative to the current file (similarly to how modules are\nfound). The provided path is interpreted in a platform-specific way at compile time. So,\nfor instance, an invocation with a Windows path containing backslashes `\\` would not\ncompile correctly on Unix.\n\n# Uses\n\nThe `include!` macro is primarily used for two purposes. It is used to include\ndocumentation that is written in a separate file and it is used to include [build artifacts\nusually as a result from the `build.rs`\nscript](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script).\n\nWhen using the `include` macro to include stretches of documentation, remember that the\nincluded file still needs to be a valid rust syntax. It is also possible to\nuse the [`include_str`] macro as `#![doc = include_str!(\"...\")]` (at the module level) or\n`#[doc = include_str!(\"...\")]` (at the item level) to include documentation from a plain\ntext or markdown file.\n\n# Examples\n\nAssume there are two files in the same directory with the following contents:\n\nFile 'monkeys.in':\n\n```rust\n['🙈', '🙊', '🙉']\n .iter()\n .cycle()\n .take(6)\n .collect::()\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_string = include!(\"monkeys.in\");\n assert_eq!(\"🙈🙊🙉🙈🙊🙉\", my_string);\n println!(\"{my_string}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print\n\"🙈🙊🙉🙈🙊🙉\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include!","insertTextFormat":2,"textEdit":{"newText":"include!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"print!(…)","kind":3,"detail":"macro_rules! print","documentation":{"kind":"markdown","value":"Prints to the standard output.\n\nEquivalent to the [`println!`] macro except that a newline is not printed at\nthe end of the message.\n\nNote that stdout is frequently line-buffered by default so it may be\nnecessary to use [`io::stdout().flush()`][flush] to ensure the output is emitted\nimmediately.\n\nThe `print!` macro will lock the standard output on each call. If you call\n`print!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwrite!(lock, \"hello world\").unwrap();\n```\n\nUse `print!` only for the primary output of your program. Use\n[`eprint!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[flush]: crate::io::Write::flush\n[`println!`]: crate::println\n[`eprint!`]: crate::eprint\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to `io::stdout()` fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\nuse std::io::{self, Write};\n\nprint!(\"this \");\nprint!(\"will \");\nprint!(\"be \");\nprint!(\"on \");\nprint!(\"the \");\nprint!(\"same \");\nprint!(\"line \");\n\nio::stdout().flush().unwrap();\n\nprint!(\"this string has a newline, why not choose println! instead?\\n\");\n\nio::stdout().flush().unwrap();\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"print!","insertTextFormat":2,"textEdit":{"newText":"print!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"cfg_match! {…}","kind":3,"detail":"macro cfg_match","documentation":{"kind":"markdown","value":"A macro for defining `#[cfg]` match-like statements.\n\nIt is similar to the `if/elif` C preprocessor macro by allowing definition of a cascade of\n`#[cfg]` cases, emitting the implementation which matches first.\n\nThis allows you to conveniently provide a long list `#[cfg]`'d blocks of code\nwithout having to rewrite each clause multiple times.\n\nTrailing `_` wildcard match arms are **optional** and they indicate a fallback branch when\nall previous declarations do not evaluate to true.\n\n# Example\n\n```rust\n#![feature(cfg_match)]\n\ncfg_match! {\n cfg(unix) => {\n fn foo() { /* unix specific functionality */ }\n }\n cfg(target_pointer_width = \"32\") => {\n fn foo() { /* non-unix, 32-bit functionality */ }\n }\n _ => {\n fn foo() { /* fallback implementation */ }\n }\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"cfg_match!","insertTextFormat":2,"textEdit":{"newText":"cfg_match! {$0}","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"concat_idents!(…)","kind":3,"detail":"macro_rules! concat_idents","documentation":{"kind":"markdown","value":"Concatenates identifiers into one identifier.\n\nThis macro takes any number of comma-separated identifiers, and\nconcatenates them all into one, yielding an expression which is a new\nidentifier. Note that hygiene makes it such that this macro cannot\ncapture local variables. Also, as a general rule, macros are only\nallowed in item, statement or expression position. That means while\nyou may use this macro for referring to existing variables, functions or\nmodules etc, you cannot define a new one with it.\n\n# Examples\n\n```rust\n#![feature(concat_idents)]\n\nfn foobar() -> u32 { 23 }\n\nlet f = concat_idents!(foo, bar);\nprintln!(\"{}\", f());\n\n// fn concat_idents!(new, fun, name) { } // not usable in this way!\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat_idents!","insertTextFormat":2,"textEdit":{"newText":"concat_idents!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"write!(…)","kind":3,"detail":"macro_rules! write","documentation":{"kind":"markdown","value":"Writes formatted data into a buffer.\n\nThis macro accepts a 'writer', a format string, and a list of arguments. Arguments will be\nformatted according to the specified format string and the result will be passed to the writer.\nThe writer may be any value with a `write_fmt` method; generally this comes from an\nimplementation of either the [`fmt::Write`] or the [`io::Write`] trait. The macro\nreturns whatever the `write_fmt` method returns; commonly a [`fmt::Result`], or an\n[`io::Result`].\n\nSee [`std::fmt`] for more information on the format string syntax.\n\n[`std::fmt`]: ../std/fmt/index.html\n[`fmt::Write`]: crate::fmt::Write\n[`io::Write`]: ../std/io/trait.Write.html\n[`fmt::Result`]: crate::fmt::Result\n[`io::Result`]: ../std/io/type.Result.html\n\n# Examples\n\n```rust\nuse std::io::Write;\n\nfn main() -> std::io::Result<()> {\n let mut w = Vec::new();\n write!(&mut w, \"test\")?;\n write!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(w, b\"testformatted arguments\");\n Ok(())\n}\n```\n\nA module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects\nimplementing either, as objects do not typically implement both. However, the module must\navoid conflict between the trait names, such as by importing them as `_` or otherwise renaming\nthem:\n\n```rust\nuse std::fmt::Write as _;\nuse std::io::Write as _;\n\nfn main() -> Result<(), Box> {\n let mut s = String::new();\n let mut v = Vec::new();\n\n write!(&mut s, \"{} {}\", \"abc\", 123)?; // uses fmt::Write::write_fmt\n write!(&mut v, \"s = {:?}\", s)?; // uses io::Write::write_fmt\n assert_eq!(v, b\"s = \\\"abc 123\\\"\");\n Ok(())\n}\n```\n\nIf you also need the trait names themselves, such as to implement one or both on your types,\nimport the containing module and then name them with a prefix:\n\n```rust\nuse std::fmt::{self, Write as _};\nuse std::io::{self, Write as _};\n\nstruct Example;\n\nimpl fmt::Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n```\n\nNote: This macro can be used in `no_std` setups as well.\nIn a `no_std` setup you are responsible for the implementation details of the components.\n\n```rust\nuse core::fmt::Write;\n\nstruct Example;\n\nimpl Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n\nlet mut m = Example{};\nwrite!(&mut m, \"Hello World\").expect(\"Not written\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"write!","insertTextFormat":2,"textEdit":{"newText":"write!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"line!(…)","kind":3,"detail":"macro_rules! line","documentation":{"kind":"markdown","value":"Expands to the line number on which it was invoked.\n\nWith [`column!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first line\nin each file evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned line is *not necessarily* the line of the `line!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `line!` macro.\n\n# Examples\n\n```rust\nlet current_line = line!();\nprintln!(\"defined on line: {current_line}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"line!","insertTextFormat":2,"textEdit":{"newText":"line!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"debug_assert!(…)","kind":3,"detail":"macro_rules! debug_assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\nLike [`assert!`], this macro also has a second version, where a custom panic\nmessage can be provided.\n\n# Uses\n\nUnlike [`assert!`], `debug_assert!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert!` is always type checked.\n\nAn unchecked assertion allows a program in an inconsistent state to keep\nrunning, which might have unexpected consequences but does not introduce\nunsafety as long as this only happens in safe code. The performance cost\nof assertions, however, is not measurable in general. Replacing [`assert!`]\nwith `debug_assert!` is thus only encouraged after thorough profiling, and\nmore importantly, only in safe code!\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\ndebug_assert!(true);\n\nfn some_expensive_computation() -> bool { true } // a very simple function\ndebug_assert!(some_expensive_computation());\n\n// assert with a custom message\nlet x = true;\ndebug_assert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\ndebug_assert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert!","insertTextFormat":2,"textEdit":{"newText":"debug_assert!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"include_bytes!(…)","kind":3,"detail":"macro_rules! include_bytes","documentation":{"kind":"markdown","value":"Includes a file as a reference to a byte array.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static [u8; N]` which is\nthe contents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let bytes = include_bytes!(\"spanish.in\");\n assert_eq!(bytes, b\"adi\\xc3\\xb3s\\n\");\n print!(\"{}\", String::from_utf8_lossy(bytes));\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"deprecated":false,"sortText":"ffffffef","filterText":"include_bytes!","insertTextFormat":2,"textEdit":{"newText":"include_bytes!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"const_format_args!(…)","kind":3,"detail":"macro_rules! const_format_args","documentation":{"kind":"markdown","value":"Same as [`format_args`], but can be used in some const contexts.\n\nThis macro is used by the panic macros for the `const_panic` feature.\n\nThis macro will be removed once `format_args` is allowed in const contexts."},"deprecated":false,"sortText":"ffffffef","filterText":"const_format_args!","insertTextFormat":2,"textEdit":{"newText":"const_format_args!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"env!(…)","kind":3,"detail":"macro_rules! env","documentation":{"kind":"markdown","value":"Inspects an environment variable at compile time.\n\nThis macro will expand to the value of the named environment variable at\ncompile time, yielding an expression of type `&'static str`. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nIf the environment variable is not defined, then a compilation error\nwill be emitted. To not emit a compile error, use the [`option_env!`]\nmacro instead.\n\n# Examples\n\n```rust\nlet path: &'static str = env!(\"PATH\");\nprintln!(\"the $PATH variable at the time of compiling was: {path}\");\n```\n\nYou can customize the error message by passing a string as the second\nparameter:\n\n```rust\nlet doc: &'static str = env!(\"documentation\", \"what's that?!\");\n```\n\nIf the `documentation` environment variable is not defined, you'll get\nthe following error:\n\n```text\nerror: what's that?!\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"env!","insertTextFormat":2,"textEdit":{"newText":"env!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"try!(…)","kind":3,"detail":"macro_rules! r#try","documentation":{"kind":"markdown","value":"Unwraps a result or propagates its error.\n\nThe [`?` operator][propagating-errors] was added to replace `try!`\nand should be used instead. Furthermore, `try` is a reserved word\nin Rust 2018, so if you must use it, you will need to use the\n[raw-identifier syntax][ris]: `r#try`.\n\n[propagating-errors]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator\n[ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html\n\n`try!` matches the given [`Result`]. In case of the `Ok` variant, the\nexpression has the value of the wrapped value.\n\nIn case of the `Err` variant, it retrieves the inner error. `try!` then\nperforms conversion using `From`. This provides automatic conversion\nbetween specialized errors and more general ones. The resulting\nerror is then immediately returned.\n\nBecause of the early return, `try!` can only be used in functions that\nreturn [`Result`].\n\n# Examples\n\n```rust\nuse std::io;\nuse std::fs::File;\nuse std::io::prelude::*;\n\nenum MyError {\n FileWriteError\n}\n\nimpl From for MyError {\n fn from(e: io::Error) -> MyError {\n MyError::FileWriteError\n }\n}\n\n// The preferred method of quick returning Errors\nfn write_to_file_question() -> Result<(), MyError> {\n let mut file = File::create(\"my_best_friends.txt\")?;\n file.write_all(b\"This is a list of my best friends.\")?;\n Ok(())\n}\n\n// The previous method of quick returning Errors\nfn write_to_file_using_try() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n r#try!(file.write_all(b\"This is a list of my best friends.\"));\n Ok(())\n}\n\n// This is equivalent to:\nfn write_to_file_using_match() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n match file.write_all(b\"This is a list of my best friends.\") {\n Ok(v) => v,\n Err(e) => return Err(From::from(e)),\n }\n Ok(())\n}\n```"},"deprecated":true,"sortText":"ffffffef","filterText":"try!","insertTextFormat":2,"textEdit":{"newText":"r#try!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[],"tags":[1]},{"label":"file!(…)","kind":3,"detail":"macro_rules! file","documentation":{"kind":"markdown","value":"Expands to the file name in which it was invoked.\n\nWith [`line!`] and [`column!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `&'static str`, and the returned file\nis not the invocation of the `file!` macro itself, but rather the\nfirst macro invocation leading up to the invocation of the `file!`\nmacro.\n\n# Examples\n\n```rust\nlet this_file = file!();\nprintln!(\"defined in file: {this_file}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"file!","insertTextFormat":2,"textEdit":{"newText":"file!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"thread_local! {…}","kind":3,"detail":"macro_rules! thread_local","documentation":{"kind":"markdown","value":"Declare a new thread local storage key of type [`std::thread::LocalKey`].\n\n# Syntax\n\nThe macro wraps any number of static declarations and makes them thread local.\nPublicity and attributes for each static are allowed. Example:\n\n```rust\nuse std::cell::RefCell;\nthread_local! {\n pub static FOO: RefCell = RefCell::new(1);\n\n static BAR: RefCell = RefCell::new(1.0);\n}\n\nFOO.with(|foo| assert_eq!(*foo.borrow(), 1));\nBAR.with(|bar| assert_eq!(*bar.borrow(), 1.0));\n```\n\nThis macro supports a special `const {}` syntax that can be used\nwhen the initialization expression can be evaluated as a constant.\nThis can enable a more efficient thread local implementation that\ncan avoid lazy initialization. For types that do not\n[need to be dropped][crate::mem::needs_drop], this can enable an\neven more efficient implementation that does not need to\ntrack any additional state.\n\n```rust\nuse std::cell::Cell;\nthread_local! {\n pub static FOO: Cell = const { Cell::new(1) };\n}\n\nFOO.with(|foo| assert_eq!(foo.get(), 1));\n```\n\nSee [`LocalKey` documentation][`std::thread::LocalKey`] for more\ninformation.\n\n[`std::thread::LocalKey`]: crate::thread::LocalKey"},"deprecated":false,"sortText":"ffffffef","filterText":"thread_local!","insertTextFormat":2,"textEdit":{"newText":"thread_local! {$0}","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"assert!(…)","kind":3,"detail":"macro_rules! assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\n# Uses\n\nAssertions are always checked in both debug and release builds, and cannot\nbe disabled. See [`debug_assert!`] for assertions that are not enabled in\nrelease builds by default.\n\nUnsafe code may rely on `assert!` to enforce run-time invariants that, if\nviolated could lead to unsafety.\n\nOther use-cases of `assert!` include testing and enforcing run-time\ninvariants in safe code (whose violation cannot result in unsafety).\n\n# Custom Messages\n\nThis macro has a second form, where a custom panic message can\nbe provided with or without arguments for formatting. See [`std::fmt`]\nfor syntax for this form. Expressions used as format arguments will only\nbe evaluated if the assertion fails.\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\nassert!(true);\n\nfn some_computation() -> bool { true } // a very simple function\n\nassert!(some_computation());\n\n// assert with a custom message\nlet x = true;\nassert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\nassert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert!","insertTextFormat":2,"textEdit":{"newText":"assert!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"column!(…)","kind":3,"detail":"macro_rules! column","documentation":{"kind":"markdown","value":"Expands to the column number at which it was invoked.\n\nWith [`line!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first column\nin each line evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned column is *not necessarily* the line of the `column!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `column!` macro.\n\n# Examples\n\n```rust\nlet current_col = column!();\nprintln!(\"defined on column: {current_col}\");\n```\n\n`column!` counts Unicode code points, not bytes or graphemes. As a result, the first two\ninvocations return the same value, but the third does not.\n\n```rust\nlet a = (\"foobar\", column!()).1;\nlet b = (\"人之初性本善\", column!()).1;\nlet c = (\"f̅o̅o̅b̅a̅r̅\", column!()).1; // Uses combining overline (U+0305)\n\nassert_eq!(a, b);\nassert_ne!(b, c);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"column!","insertTextFormat":2,"textEdit":{"newText":"column!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"format_args_nl!(…)","kind":3,"detail":"macro_rules! format_args_nl","documentation":{"kind":"markdown","value":"Same as [`format_args`], but adds a newline in the end."},"deprecated":false,"sortText":"ffffffef","filterText":"format_args_nl!","insertTextFormat":2,"textEdit":{"newText":"format_args_nl!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"unreachable!(…)","kind":3,"detail":"macro_rules! unreachable","documentation":{"kind":"markdown","value":"Indicates unreachable code.\n\nThis is useful any time that the compiler can't determine that some code is unreachable. For\nexample:\n\n* Match arms with guard conditions.\n* Loops that dynamically terminate.\n* Iterators that dynamically terminate.\n\nIf the determination that the code is unreachable proves incorrect, the\nprogram immediately terminates with a [`panic!`].\n\nThe unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which\nwill cause undefined behavior if the code is reached.\n\n[`unreachable_unchecked`]: crate::hint::unreachable_unchecked\n\n# Panics\n\nThis will always [`panic!`] because `unreachable!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nMatch arms:\n\n```rust\nfn foo(x: Option) {\n match x {\n Some(n) if n >= 0 => println!(\"Some(Non-negative)\"),\n Some(n) if n < 0 => println!(\"Some(Negative)\"),\n Some(_) => unreachable!(), // compile error if commented out\n None => println!(\"None\")\n }\n}\n```\n\nIterators:\n\n```rust\nfn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3\n for i in 0.. {\n if 3*i < i { panic!(\"u32 overflow\"); }\n if x < 3*i { return i-1; }\n }\n unreachable!(\"The loop should always return\");\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"unreachable!","insertTextFormat":2,"textEdit":{"newText":"unreachable!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"eprintln!(…)","kind":3,"detail":"macro_rules! eprintln","documentation":{"kind":"markdown","value":"Prints to the standard error, with a newline.\n\nEquivalent to the [`println!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`println!`] for\nexample usage.\n\nUse `eprintln!` only for error and progress messages. Use `println!`\ninstead for the primary output of your program.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n[`println!`]: crate::println\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprintln!(\"Error: Could not complete task\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"eprintln!","insertTextFormat":2,"textEdit":{"newText":"eprintln!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"unimplemented!(…)","kind":3,"detail":"macro_rules! unimplemented","documentation":{"kind":"markdown","value":"Indicates unimplemented code by panicking with a message of \"not implemented\".\n\nThis allows your code to type-check, which is useful if you are prototyping or\nimplementing a trait that requires multiple methods which you don't plan to use all of.\n\nThe difference between `unimplemented!` and [`todo!`] is that while `todo!`\nconveys an intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `unimplemented!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n[`todo!`]: crate::todo\n\n# Examples\n\nSay we have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` for 'MyStruct', but for some reason it only makes sense\nto implement the `bar()` function. `baz()` and `qux()` will still need to be defined\nin our implementation of `Foo`, but we can use `unimplemented!` in their definitions\nto allow our code to compile.\n\nWe still want to have our program stop running if the unimplemented methods are\nreached.\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // It makes no sense to `baz` a `MyStruct`, so we have no logic here\n // at all.\n // This will display \"thread 'main' panicked at 'not implemented'\".\n unimplemented!();\n }\n\n fn qux(&self) -> Result {\n // We have some logic here,\n // We can add a message to unimplemented! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not implemented: MyStruct isn't quxable'\".\n unimplemented!(\"MyStruct isn't quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"unimplemented!","insertTextFormat":2,"textEdit":{"newText":"unimplemented!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"cfg!(…)","kind":3,"detail":"macro_rules! cfg","documentation":{"kind":"markdown","value":"Evaluates boolean combinations of configuration flags at compile-time.\n\nIn addition to the `#[cfg]` attribute, this macro is provided to allow\nboolean expression evaluation of configuration flags. This frequently\nleads to less duplicated code.\n\nThe syntax given to this macro is the same syntax as the [`cfg`]\nattribute.\n\n`cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For\nexample, all blocks in an if/else expression need to be valid when `cfg!` is used for\nthe condition, regardless of what `cfg!` is evaluating.\n\n[`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute\n\n# Examples\n\n```rust\nlet my_directory = if cfg!(windows) {\n \"windows-specific-directory\"\n} else {\n \"unix-directory\"\n};\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"cfg!","insertTextFormat":2,"textEdit":{"newText":"cfg!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"todo!(…)","kind":3,"detail":"macro_rules! todo","documentation":{"kind":"markdown","value":"Indicates unfinished code.\n\nThis can be useful if you are prototyping and just\nwant a placeholder to let your code pass type analysis.\n\nThe difference between [`unimplemented!`] and `todo!` is that while `todo!` conveys\nan intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `todo!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nHere's an example of some in-progress code. We have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` on one of our types, but we also want to work on\njust `bar()` first. In order for our code to compile, we need to implement\n`baz()` and `qux()`, so we can use `todo!`:\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // Let's not worry about implementing baz() for now\n todo!();\n }\n\n fn qux(&self) -> Result {\n // We can add a message to todo! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not yet implemented: MyStruct is not yet quxable'\".\n todo!(\"MyStruct is not yet quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n\n // We aren't even using baz() or qux(), so this is fine.\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"todo!","insertTextFormat":2,"textEdit":{"newText":"todo!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"trace_macros!(…)","kind":3,"detail":"macro_rules! trace_macros","documentation":{"kind":"markdown","value":"Enables or disables tracing functionality used for debugging other macros."},"deprecated":false,"sortText":"ffffffef","filterText":"trace_macros!","insertTextFormat":2,"textEdit":{"newText":"trace_macros!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"module_path!(…)","kind":3,"detail":"macro_rules! module_path","documentation":{"kind":"markdown","value":"Expands to a string that represents the current module path.\n\nThe current module path can be thought of as the hierarchy of modules\nleading back up to the crate root. The first component of the path\nreturned is the name of the crate currently being compiled.\n\n# Examples\n\n```rust\nmod test {\n pub fn foo() {\n assert!(module_path!().ends_with(\"test\"));\n }\n}\n\ntest::foo();\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"module_path!","insertTextFormat":2,"textEdit":{"newText":"module_path!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"option_env!(…)","kind":3,"detail":"macro_rules! option_env","documentation":{"kind":"markdown","value":"Optionally inspects an environment variable at compile time.\n\nIf the named environment variable is present at compile time, this will\nexpand into an expression of type `Option<&'static str>` whose value is\n`Some` of the value of the environment variable. If the environment\nvariable is not present, then this will expand to `None`. See\n[`Option`][Option] for more information on this type. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nA compile time error is never emitted when using this macro regardless\nof whether the environment variable is present or not.\nTo emit a compile error if the environment variable is not present,\nuse the [`env!`] macro instead.\n\n# Examples\n\n```rust\nlet key: Option<&'static str> = option_env!(\"SECRET_KEY\");\nprintln!(\"the secret key might be: {key:?}\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"option_env!","insertTextFormat":2,"textEdit":{"newText":"option_env!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"writeln!(…)","kind":3,"detail":"macro_rules! writeln","documentation":{"kind":"markdown","value":"Write formatted data into a buffer, with a newline appended.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`).\n\nFor more information, see [`write!`]. For information on the format string syntax, see\n[`std::fmt`].\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\nuse std::io::{Write, Result};\n\nfn main() -> Result<()> {\n let mut w = Vec::new();\n writeln!(&mut w)?;\n writeln!(&mut w, \"test\")?;\n writeln!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(&w[..], \"\\ntest\\nformatted arguments\\n\".as_bytes());\n Ok(())\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"writeln!","insertTextFormat":2,"textEdit":{"newText":"writeln!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"assert_eq!(…)","kind":3,"detail":"macro_rules! assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\nassert_eq!(a, b);\n\nassert_eq!(a, b, \"we are testing addition with {} and {}\", a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"assert_eq!","insertTextFormat":2,"textEdit":{"newText":"assert_eq!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"compile_error!(…)","kind":3,"detail":"macro_rules! compile_error","documentation":{"kind":"markdown","value":"Causes compilation to fail with the given error message when encountered.\n\nThis macro should be used when a crate uses a conditional compilation strategy to provide\nbetter error messages for erroneous conditions. It's the compiler-level form of [`panic!`],\nbut emits an error during *compilation* rather than at *runtime*.\n\n# Examples\n\nTwo such examples are macros and `#[cfg]` environments.\n\nEmit a better compiler error if a macro is passed invalid values. Without the final branch,\nthe compiler would still emit an error, but the error's message would not mention the two\nvalid values.\n\n```rust\nmacro_rules! give_me_foo_or_bar {\n (foo) => {};\n (bar) => {};\n ($x:ident) => {\n compile_error!(\"This macro only accepts `foo` or `bar`\");\n }\n}\n\ngive_me_foo_or_bar!(neither);\n// ^ will fail at compile time with message \"This macro only accepts `foo` or `bar`\"\n```\n\nEmit a compiler error if one of a number of features isn't available.\n\n```rust\n#[cfg(not(any(feature = \"foo\", feature = \"bar\")))]\ncompile_error!(\"Either feature \\\"foo\\\" or \\\"bar\\\" must be enabled for this crate.\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"compile_error!","insertTextFormat":2,"textEdit":{"newText":"compile_error!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"matches!(…)","kind":3,"detail":"macro_rules! matches","documentation":{"kind":"markdown","value":"Returns whether the given expression matches any of the given patterns.\n\nLike in a `match` expression, the pattern can be optionally followed by `if`\nand a guard expression that has access to names bound by the pattern.\n\n# Examples\n\n```rust\nlet foo = 'f';\nassert!(matches!(foo, 'A'..='Z' | 'a'..='z'));\n\nlet bar = Some(4);\nassert!(matches!(bar, Some(x) if x > 2));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"matches!","insertTextFormat":2,"textEdit":{"newText":"matches!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"format_args!(…)","kind":3,"detail":"macro_rules! format_args","documentation":{"kind":"markdown","value":"Constructs parameters for the other string-formatting macros.\n\nThis macro functions by taking a formatting string literal containing\n`{}` for each additional argument passed. `format_args!` prepares the\nadditional parameters to ensure the output can be interpreted as a string\nand canonicalizes the arguments into a single type. Any value that implements\nthe [`Display`] trait can be passed to `format_args!`, as can any\n[`Debug`] implementation be passed to a `{:?}` within the formatting string.\n\nThis macro produces a value of type [`fmt::Arguments`]. This value can be\npassed to the macros within [`std::fmt`] for performing useful redirection.\nAll other formatting macros ([`format!`], [`write!`], [`println!`], etc) are\nproxied through this one. `format_args!`, unlike its derived macros, avoids\nheap allocations.\n\nYou can use the [`fmt::Arguments`] value that `format_args!` returns\nin `Debug` and `Display` contexts as seen below. The example also shows\nthat `Debug` and `Display` format to the same thing: the interpolated\nformat string in `format_args!`.\n\n```rust\nlet debug = format!(\"{:?}\", format_args!(\"{} foo {:?}\", 1, 2));\nlet display = format!(\"{}\", format_args!(\"{} foo {:?}\", 1, 2));\nassert_eq!(\"1 foo 2\", display);\nassert_eq!(display, debug);\n```\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax, and further information.\n\n[`Display`]: crate::fmt::Display\n[`Debug`]: crate::fmt::Debug\n[`fmt::Arguments`]: crate::fmt::Arguments\n[`std::fmt`]: ../std/fmt/index.html\n[`format!`]: ../std/macro.format.html\n[`println!`]: ../std/macro.println.html\n\n# Examples\n\n```rust\nuse std::fmt;\n\nlet s = fmt::format(format_args!(\"hello {}\", \"world\"));\nassert_eq!(s, format!(\"hello {}\", \"world\"));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"format_args!","insertTextFormat":2,"textEdit":{"newText":"format_args!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"is_x86_feature_detected!(…)","kind":3,"detail":"macro_rules! is_x86_feature_detected","documentation":{"kind":"markdown","value":"A macro to test at *runtime* whether a CPU feature is available on\nx86/x86-64 platforms.\n\nThis macro is provided in the standard library and will detect at runtime\nwhether the specified CPU feature is detected. This does **not** resolve at\ncompile time unless the specified feature is already enabled for the entire\ncrate. Runtime detection currently relies mostly on the `cpuid` instruction.\n\nThis macro only takes one argument which is a string literal of the feature\nbeing tested for. The feature names supported are the lowercase versions of\nthe ones defined by Intel in [their documentation][docs].\n\n## Supported arguments\n\nThis macro supports the same names that `#[target_feature]` supports. Unlike\n`#[target_feature]`, however, this macro does not support names separated\nwith a comma. Instead testing for multiple features must be done through\nseparate macro invocations for now.\n\nSupported arguments are:\n\n* `\"aes\"`\n* `\"pclmulqdq\"`\n* `\"rdrand\"`\n* `\"rdseed\"`\n* `\"tsc\"`\n* `\"mmx\"`\n* `\"sse\"`\n* `\"sse2\"`\n* `\"sse3\"`\n* `\"ssse3\"`\n* `\"sse4.1\"`\n* `\"sse4.2\"`\n* `\"sse4a\"`\n* `\"sha\"`\n* `\"avx\"`\n* `\"avx2\"`\n* `\"avx512f\"`\n* `\"avx512cd\"`\n* `\"avx512er\"`\n* `\"avx512pf\"`\n* `\"avx512bw\"`\n* `\"avx512dq\"`\n* `\"avx512vl\"`\n* `\"avx512ifma\"`\n* `\"avx512vbmi\"`\n* `\"avx512vpopcntdq\"`\n* `\"avx512vbmi2\"`\n* `\"gfni\"`\n* `\"vaes\"`\n* `\"vpclmulqdq\"`\n* `\"avx512vnni\"`\n* `\"avx512bitalg\"`\n* `\"avx512bf16\"`\n* `\"avx512vp2intersect\"`\n* `\"f16c\"`\n* `\"fma\"`\n* `\"bmi1\"`\n* `\"bmi2\"`\n* `\"abm\"`\n* `\"lzcnt\"`\n* `\"tbm\"`\n* `\"popcnt\"`\n* `\"fxsr\"`\n* `\"xsave\"`\n* `\"xsaveopt\"`\n* `\"xsaves\"`\n* `\"xsavec\"`\n* `\"cmpxchg16b\"`\n* `\"adx\"`\n* `\"rtm\"`\n* `\"movbe\"`\n* `\"ermsb\"`\n\n[docs]: https://software.intel.com/sites/landingpage/IntrinsicsGuide"},"deprecated":false,"sortText":"ffffffef","filterText":"is_x86_feature_detected!","insertTextFormat":2,"textEdit":{"newText":"is_x86_feature_detected!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"concat_bytes!(…)","kind":3,"detail":"macro_rules! concat_bytes","documentation":{"kind":"markdown","value":"Concatenates literals into a byte slice.\n\nThis macro takes any number of comma-separated literals, and concatenates them all into\none, yielding an expression of type `&[u8; _]`, which represents all of the literals\nconcatenated left-to-right. The literals passed can be any combination of:\n\n- byte literals (`b'r'`)\n- byte strings (`b\"Rust\"`)\n- arrays of bytes/numbers (`[b'A', 66, b'C']`)\n\n# Examples\n\n```rust\n#![feature(concat_bytes)]\n\nlet s: &[u8; 6] = concat_bytes!(b'A', b\"BC\", [68, b'E', 70]);\nassert_eq!(s, b\"ABCDEF\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"concat_bytes!","insertTextFormat":2,"textEdit":{"newText":"concat_bytes!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"eprint!(…)","kind":3,"detail":"macro_rules! eprint","documentation":{"kind":"markdown","value":"Prints to the standard error.\n\nEquivalent to the [`print!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`print!`] for\nexample usage.\n\nUse `eprint!` only for error and progress messages. Use `print!`\ninstead for the primary output of your program.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprint!(\"Error: Could not complete task\");\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"eprint!","insertTextFormat":2,"textEdit":{"newText":"eprint!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"debug_assert_ne!(…)","kind":3,"detail":"macro_rules! debug_assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_ne!`], `debug_assert_ne!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_ne!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_ne!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_ne!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\ndebug_assert_ne!(a, b);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"debug_assert_ne!","insertTextFormat":2,"textEdit":{"newText":"debug_assert_ne!($0)","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"std","kind":9,"documentation":{"kind":"markdown","value":"# The Rust Standard Library\n\nThe Rust Standard Library is the foundation of portable Rust software, a\nset of minimal and battle-tested shared abstractions for the [broader Rust\necosystem][crates.io]. It offers core types, like [`Vec`] and\n[`Option`], library-defined [operations on language\nprimitives](#primitives), [standard macros](#macros), [I/O] and\n[multithreading], among [many other things][other].\n\n`std` is available to all Rust crates by default. Therefore, the\nstandard library can be accessed in [`use`] statements through the path\n`std`, as in [`use std::env`].\n\n# How to read this documentation\n\nIf you already know the name of what you are looking for, the fastest way to\nfind it is to use the search\nbar at the top of the page.\n\nOtherwise, you may want to jump to one of these useful sections:\n\n* [`std::*` modules](#modules)\n* [Primitive types](#primitives)\n* [Standard macros](#macros)\n* [The Rust Prelude]\n\nIf this is your first time, the documentation for the standard library is\nwritten to be casually perused. Clicking on interesting things should\ngenerally lead you to interesting places. Still, there are important bits\nyou don't want to miss, so read on for a tour of the standard library and\nits documentation!\n\nOnce you are familiar with the contents of the standard library you may\nbegin to find the verbosity of the prose distracting. At this stage in your\ndevelopment you may want to press the `[-]` button near the top of the\npage to collapse it into a more skimmable view.\n\nWhile you are looking at that `[-]` button also notice the `source`\nlink. Rust's API documentation comes with the source code and you are\nencouraged to read it. The standard library source is generally high\nquality and a peek behind the curtains is often enlightening.\n\n# What is in the standard library documentation?\n\nFirst of all, The Rust Standard Library is divided into a number of focused\nmodules, [all listed further down this page](#modules). These modules are\nthe bedrock upon which all of Rust is forged, and they have mighty names\nlike [`std::slice`] and [`std::cmp`]. Modules' documentation typically\nincludes an overview of the module along with examples, and are a smart\nplace to start familiarizing yourself with the library.\n\nSecond, implicit methods on [primitive types] are documented here. This can\nbe a source of confusion for two reasons:\n\n1. While primitives are implemented by the compiler, the standard library\n implements methods directly on the primitive types (and it is the only\n library that does so), which are [documented in the section on\n primitives](#primitives).\n2. The standard library exports many modules *with the same name as\n primitive types*. These define additional items related to the primitive\n type, but not the all-important methods.\n\nSo for example there is a [page for the primitive type\n`i32`](primitive::i32) that lists all the methods that can be called on\n32-bit integers (very useful), and there is a [page for the module\n`std::i32`] that documents the constant values [`MIN`] and [`MAX`] (rarely\nuseful).\n\nNote the documentation for the primitives [`str`] and [`[T]`][prim@slice] (also\ncalled 'slice'). Many method calls on [`String`] and [`Vec`] are actually\ncalls to methods on [`str`] and [`[T]`][prim@slice] respectively, via [deref\ncoercions][deref-coercions].\n\nThird, the standard library defines [The Rust Prelude], a small collection\nof items - mostly traits - that are imported into every module of every\ncrate. The traits in the prelude are pervasive, making the prelude\ndocumentation a good entry point to learning about the library.\n\nAnd finally, the standard library exports a number of standard macros, and\n[lists them on this page](#macros) (technically, not all of the standard\nmacros are defined by the standard library - some are defined by the\ncompiler - but they are documented here the same). Like the prelude, the\nstandard macros are imported by default into all crates.\n\n# Contributing changes to the documentation\n\nCheck out the rust contribution guidelines [here](\nhttps://rustc-dev-guide.rust-lang.org/contributing.html#writing-documentation).\nThe source for this documentation can be found on\n[GitHub](https://github.com/rust-lang/rust).\nTo contribute changes, make sure you read the guidelines first, then submit\npull-requests for your suggested changes.\n\nContributions are appreciated! If you see a part of the docs that can be\nimproved, submit a PR, or chat with us first on [Discord][rust-discord]\n#docs.\n\n# A Tour of The Rust Standard Library\n\nThe rest of this crate documentation is dedicated to pointing out notable\nfeatures of The Rust Standard Library.\n\n## Containers and collections\n\nThe [`option`] and [`result`] modules define optional and error-handling\ntypes, [`Option`] and [`Result`]. The [`iter`] module defines\nRust's iterator trait, [`Iterator`], which works with the [`for`] loop to\naccess collections.\n\nThe standard library exposes three common ways to deal with contiguous\nregions of memory:\n\n* [`Vec`] - A heap-allocated *vector* that is resizable at runtime.\n* [`[T; N]`][prim@array] - An inline *array* with a fixed size at compile time.\n* [`[T]`][prim@slice] - A dynamically sized *slice* into any other kind of contiguous\n storage, whether heap-allocated or not.\n\nSlices can only be handled through some kind of *pointer*, and as such come\nin many flavors such as:\n\n* `&[T]` - *shared slice*\n* `&mut [T]` - *mutable slice*\n* [`Box<[T]>`][owned slice] - *owned slice*\n\n[`str`], a UTF-8 string slice, is a primitive type, and the standard library\ndefines many methods for it. Rust [`str`]s are typically accessed as\nimmutable references: `&str`. Use the owned [`String`] for building and\nmutating strings.\n\nFor converting to strings use the [`format!`] macro, and for converting from\nstrings use the [`FromStr`] trait.\n\nData may be shared by placing it in a reference-counted box or the [`Rc`]\ntype, and if further contained in a [`Cell`] or [`RefCell`], may be mutated\nas well as shared. Likewise, in a concurrent setting it is common to pair an\natomically-reference-counted box, [`Arc`], with a [`Mutex`] to get the same\neffect.\n\nThe [`collections`] module defines maps, sets, linked lists and other\ntypical collection types, including the common [`HashMap`].\n\n## Platform abstractions and I/O\n\nBesides basic data types, the standard library is largely concerned with\nabstracting over differences in common platforms, most notably Windows and\nUnix derivatives.\n\nCommon types of I/O, including [files], [TCP], and [UDP], are defined in\nthe [`io`], [`fs`], and [`net`] modules.\n\nThe [`thread`] module contains Rust's threading abstractions. [`sync`]\ncontains further primitive shared memory types, including [`atomic`] and\n[`mpsc`], which contains the channel types for message passing.\n\n# Use before and after `main()`\n\nMany parts of the standard library are expected to work before and after `main()`;\nbut this is not guaranteed or ensured by tests. It is recommended that you write your own tests\nand run them on each platform you wish to support.\nThis means that use of `std` before/after main, especially of features that interact with the\nOS or global state, is exempted from stability and portability guarantees and instead only\nprovided on a best-effort basis. Nevertheless bug reports are appreciated.\n\nOn the other hand `core` and `alloc` are most likely to work in such environments with\nthe caveat that any hookable behavior such as panics, oom handling or allocators will also\ndepend on the compatibility of the hooks.\n\nSome features may also behave differently outside main, e.g. stdio could become unbuffered,\nsome panics might turn into aborts, backtraces might not get symbolicated or similar.\n\nNon-exhaustive list of known limitations:\n\n- after-main use of thread-locals, which also affects additional features:\n - [`thread::current()`]\n - [`thread::scope()`]\n - [`sync::mpsc`]\n- before-main stdio file descriptors are not guaranteed to be open on unix platforms\n\n\n[I/O]: io\n[`MIN`]: i32::MIN\n[`MAX`]: i32::MAX\n[page for the module `std::i32`]: crate::i32\n[TCP]: net::TcpStream\n[The Rust Prelude]: prelude\n[UDP]: net::UdpSocket\n[`Arc`]: sync::Arc\n[owned slice]: boxed\n[`Cell`]: cell::Cell\n[`FromStr`]: str::FromStr\n[`HashMap`]: collections::HashMap\n[`Mutex`]: sync::Mutex\n[`Option`]: option::Option\n[`Rc`]: rc::Rc\n[`RefCell`]: cell::RefCell\n[`Result`]: result::Result\n[`Vec`]: vec::Vec\n[`atomic`]: sync::atomic\n[`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for\n[`str`]: prim@str\n[`mpsc`]: sync::mpsc\n[`std::cmp`]: cmp\n[`std::slice`]: mod@slice\n[`use std::env`]: env/index.html\n[`use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html\n[crates.io]: https://crates.io\n[deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods\n[files]: fs::File\n[multithreading]: thread\n[other]: #what-is-in-the-standard-library-documentation\n[primitive types]: ../book/ch03-02-data-types.html\n[rust-discord]: https://discord.gg/rust-lang\n[array]: prim@array\n[slice]: prim@slice"},"deprecated":false,"sortText":"ffffffef","filterText":"std","textEdit":{"newText":"std","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"alloc","kind":9,"documentation":{"kind":"markdown","value":"# The Rust core allocation and collections library\n\nThis library provides smart pointers and collections for managing\nheap-allocated values.\n\nThis library, like core, normally doesn’t need to be used directly\nsince its contents are re-exported in the [`std` crate](../std/index.html).\nCrates that use the `#![no_std]` attribute however will typically\nnot depend on `std`, so they’d use this crate instead.\n\n## Boxed values\n\nThe [`Box`] type is a smart pointer type. There can only be one owner of a\n[`Box`], and the owner can decide to mutate the contents, which live on the\nheap.\n\nThis type can be sent among threads efficiently as the size of a `Box` value\nis the same as that of a pointer. Tree-like data structures are often built\nwith boxes because each node often has only one owner, the parent.\n\n## Reference counted pointers\n\nThe [`Rc`] type is a non-threadsafe reference-counted pointer type intended\nfor sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and\nonly allows access to `&T`, a shared reference.\n\nThis type is useful when inherited mutability (such as using [`Box`]) is too\nconstraining for an application, and is often paired with the [`Cell`] or\n[`RefCell`] types in order to allow mutation.\n\n## Atomically reference counted pointers\n\nThe [`Arc`] type is the threadsafe equivalent of the [`Rc`] type. It\nprovides all the same functionality of [`Rc`], except it requires that the\ncontained type `T` is shareable. Additionally, [`Arc`][`Arc`] is itself\nsendable while [`Rc`][`Rc`] is not.\n\nThis type allows for shared access to the contained data, and is often\npaired with synchronization primitives such as mutexes to allow mutation of\nshared resources.\n\n## Collections\n\nImplementations of the most common general purpose data structures are\ndefined in this library. They are re-exported through the\n[standard collections library](../std/collections/index.html).\n\n## Heap interfaces\n\nThe [`alloc`](alloc/index.html) module defines the low-level interface to the\ndefault global allocator. It is not compatible with the libc allocator API.\n\n[`Arc`]: sync\n[`Box`]: boxed\n[`Cell`]: core::cell\n[`Rc`]: rc\n[`RefCell`]: core::cell"},"deprecated":false,"sortText":"ffffffef","filterText":"alloc","textEdit":{"newText":"alloc","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"core","kind":9,"documentation":{"kind":"markdown","value":"# The Rust Core Library\n\nThe Rust Core Library is the dependency-free[^free] foundation of [The\nRust Standard Library](../std/index.html). It is the portable glue\nbetween the language and its libraries, defining the intrinsic and\nprimitive building blocks of all Rust code. It links to no\nupstream libraries, no system libraries, and no libc.\n\n[^free]: Strictly speaking, there are some symbols which are needed but\n they aren't always necessary.\n\nThe core library is *minimal*: it isn't even aware of heap allocation,\nnor does it provide concurrency or I/O. These things require\nplatform integration, and this library is platform-agnostic.\n\n# How to use the core library\n\nPlease note that all of these details are currently not considered stable.\n\nThis library is built on the assumption of a few existing symbols:\n\n* `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines\n which are generated by Rust codegen backends. Additionally, this library can make explicit\n calls to `strlen`. Their signatures are the same as found in C, but there are extra\n assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if\n the `n` parameter is 0, the function is assumed to not be UB, even if the pointers are NULL or\n dangling. (Note that making extra assumptions about these functions is common among compilers:\n [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)\n These functions are often provided by the system libc, but can also be provided by the\n [compiler-builtins crate](https://crates.io/crates/compiler_builtins).\n Note that the library does not guarantee that it will always make these assumptions, so Rust\n user code directly calling the C functions should follow the C specification! The advice for\n Rust user code is to call the functions provided by this library instead (such as\n `ptr::copy`).\n\n* `rust_begin_panic` - This function takes four arguments, a\n `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments\n dictate the panic message, the file at which panic was invoked, and the\n line and column inside the file. It is up to consumers of this core\n library to define this panic function; it is only required to never\n return. This requires a `lang` attribute named `panic_impl`.\n\n* `rust_eh_personality` - is used by the failure mechanisms of the\n compiler. This is often mapped to GCC's personality function, but crates\n which do not trigger a panic can be assured that this function is never\n called. The `lang` attribute is called `eh_personality`."},"deprecated":false,"sortText":"ffffffef","filterText":"core","textEdit":{"newText":"core","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"u32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u32","textEdit":{"newText":"u32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"bool","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"bool","textEdit":{"newText":"bool","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"u8","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u8","textEdit":{"newText":"u8","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"isize","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"isize","textEdit":{"newText":"isize","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"u16","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u16","textEdit":{"newText":"u16","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"u64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u64","textEdit":{"newText":"u64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"u128","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"u128","textEdit":{"newText":"u128","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"f32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"f32","textEdit":{"newText":"f32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"i128","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i128","textEdit":{"newText":"i128","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"i16","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i16","textEdit":{"newText":"i16","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"str","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"str","textEdit":{"newText":"str","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"i64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i64","textEdit":{"newText":"i64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"char","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"char","textEdit":{"newText":"char","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"f64","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"f64","textEdit":{"newText":"f64","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"i32","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i32","textEdit":{"newText":"i32","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"i8","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"i8","textEdit":{"newText":"i8","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"usize","kind":22,"deprecated":false,"sortText":"ffffffef","filterText":"usize","textEdit":{"newText":"usize","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"AsMut","kind":8,"documentation":{"kind":"markdown","value":"Used to do a cheap mutable-to-mutable reference conversion.\n\nThis trait is similar to [`AsRef`] but used for converting between mutable\nreferences. If you need to do a costly conversion it is better to\nimplement [`From`] with type `&mut T` or write a custom function.\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsMut` auto-dereferences if the inner type is a mutable reference\n(e.g.: `foo.as_mut()` will work the same if `foo` has type `&mut Foo` or `&mut &mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[mutably dereferenceable types], e.g. `foo.as_mut()` will *not* work the same as\n`Box::new(foo).as_mut()`. Instead, many smart pointers provide an `as_mut` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsMut::as_mut`] should not be\nused for the sole purpose of mutable dereferencing; instead ['`Deref` coercion'] can be used:\n\n[mutably dereferenceable types]: core::ops::DerefMut\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::DerefMut#mutable-deref-coercion\n\n```rust\nlet mut x = Box::new(5i32);\n// Avoid this:\n// let y: &mut i32 = x.as_mut();\n// Better just write:\nlet y: &mut i32 = &mut x;\n```\n\nTypes which implement [`DerefMut`] should consider to add an implementation of `AsMut` as\nfollows:\n\n[`DerefMut`]: core::ops::DerefMut\n\n```rust\nimpl AsMut for SomeType\nwhere\n ::Target: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.deref_mut().as_mut()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsMut` would be reflexive, i.e. there would be an `impl AsMut for T`\nwith [`as_mut`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&mut T where T: AsMut` which allows `AsMut` to auto-dereference, see \"Generic\nImplementations\" above).\n\n[`as_mut`]: AsMut::as_mut\n\nA trivial implementation of `AsMut for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nUsing `AsMut` as trait bound for a generic function, we can accept all mutable references that\ncan be converted to type `&mut T`. Unlike [dereference], which has a single [target type],\nthere can be multiple implementations of `AsMut` for a type. In particular, `Vec` implements\nboth `AsMut>` and `AsMut<[T]>`.\n\nIn the following, the example functions `caesar` and `null_terminate` provide a generic\ninterface which work with any type that can be converted by cheap mutable-to-mutable conversion\ninto a byte slice (`[u8]`) or byte vector (`Vec`), respectively.\n\n[dereference]: core::ops::DerefMut\n[target type]: core::ops::Deref::Target\n\n```rust\nstruct Document {\n info: String,\n content: Vec,\n}\n\nimpl AsMut for Document\nwhere\n Vec: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.content.as_mut()\n }\n}\n\nfn caesar>(data: &mut T, key: u8) {\n for byte in data.as_mut() {\n *byte = byte.wrapping_add(key);\n }\n}\n\nfn null_terminate>>(data: &mut T) {\n // Using a non-generic inner function, which contains most of the\n // functionality, helps to minimize monomorphization overhead.\n fn doit(data: &mut Vec) {\n let len = data.len();\n if len == 0 || data[len-1] != 0 {\n data.push(0);\n }\n }\n doit(data.as_mut());\n}\n\nfn main() {\n let mut v: Vec = vec![1, 2, 3];\n caesar(&mut v, 5);\n assert_eq!(v, [6, 7, 8]);\n null_terminate(&mut v);\n assert_eq!(v, [6, 7, 8, 0]);\n let mut doc = Document {\n info: String::from(\"Example\"),\n content: vec![17, 19, 8],\n };\n caesar(&mut doc, 1);\n assert_eq!(doc.content, [18, 20, 9]);\n null_terminate(&mut doc);\n assert_eq!(doc.content, [18, 20, 9, 0]);\n}\n```\n\nNote, however, that APIs don't need to be generic. In many cases taking a `&mut [u8]` or\n`&mut Vec`, for example, is the better choice (callers need to pass the correct type then)."},"deprecated":false,"sortText":"ffffffef","filterText":"AsMut","textEdit":{"newText":"AsMut","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"AsRef","kind":8,"documentation":{"kind":"markdown","value":"Used to do a cheap reference-to-reference conversion.\n\nThis trait is similar to [`AsMut`] which is used for converting between mutable references.\nIf you need to do a costly conversion it is better to implement [`From`] with type\n`&T` or write a custom function.\n\n# Relation to `Borrow`\n\n`AsRef` has the same signature as [`Borrow`], but [`Borrow`] is different in a few aspects:\n\n- Unlike `AsRef`, [`Borrow`] has a blanket impl for any `T`, and can be used to accept either\n a reference or a value. (See also note on `AsRef`'s reflexibility below.)\n- [`Borrow`] also requires that [`Hash`], [`Eq`] and [`Ord`] for a borrowed value are\n equivalent to those of the owned value. For this reason, if you want to\n borrow only a single field of a struct you can implement `AsRef`, but not [`Borrow`].\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsRef` auto-dereferences if the inner type is a reference or a mutable reference\n(e.g.: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[dereferenceable types], e.g. `foo.as_ref()` will *not* work the same as\n`Box::new(foo).as_ref()`. Instead, many smart pointers provide an `as_ref` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsRef::as_ref`] should not be\nused for the sole purpose of dereferencing; instead ['`Deref` coercion'] can be used:\n\n[dereferenceable types]: core::ops::Deref\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::Deref#deref-coercion\n\n```rust\nlet x = Box::new(5i32);\n// Avoid this:\n// let y: &i32 = x.as_ref();\n// Better just write:\nlet y: &i32 = &x;\n```\n\nTypes which implement [`Deref`] should consider implementing `AsRef` as follows:\n\n[`Deref`]: core::ops::Deref\n\n```rust\nimpl AsRef for SomeType\nwhere\n T: ?Sized,\n ::Target: AsRef,\n{\n fn as_ref(&self) -> &T {\n self.deref().as_ref()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsRef` would be reflexive, i.e. there would be an `impl AsRef for T`\nwith [`as_ref`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&T where T: AsRef` which allows `AsRef` to auto-dereference, see \"Generic Implementations\"\nabove).\n\n[`as_ref`]: AsRef::as_ref\n\nA trivial implementation of `AsRef for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nBy using trait bounds we can accept arguments of different types as long as they can be\nconverted to the specified type `T`.\n\nFor example: By creating a generic function that takes an `AsRef` we express that we\nwant to accept all references that can be converted to [`&str`] as an argument.\nSince both [`String`] and [`&str`] implement `AsRef` we can accept both as input argument.\n\n[`&str`]: primitive@str\n[`Borrow`]: crate::borrow::Borrow\n[`Eq`]: crate::cmp::Eq\n[`Ord`]: crate::cmp::Ord\n[`String`]: ../../std/string/struct.String.html\n\n```rust\nfn is_hello>(s: T) {\n assert_eq!(\"hello\", s.as_ref());\n}\n\nlet s = \"hello\";\nis_hello(s);\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"AsRef","textEdit":{"newText":"AsRef","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Box","kind":22,"documentation":{"kind":"markdown","value":"A pointer type that uniquely owns a heap allocation of type `T`.\n\nSee the [module-level documentation](../../std/boxed/index.html) for more."},"deprecated":false,"sortText":"ffffffef","filterText":"Box","textEdit":{"newText":"Box","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Clone","kind":8,"documentation":{"kind":"markdown","value":"A common trait for the ability to explicitly duplicate an object.\n\nDiffers from [`Copy`] in that [`Copy`] is implicit and an inexpensive bit-wise copy, while\n`Clone` is always explicit and may or may not be expensive. In order to enforce\nthese characteristics, Rust does not allow you to reimplement [`Copy`], but you\nmay reimplement `Clone` and run arbitrary code.\n\nSince `Clone` is more general than [`Copy`], you can automatically make anything\n[`Copy`] be `Clone` as well.\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d\nimplementation of [`Clone`] calls [`clone`] on each field.\n\n[`clone`]: Clone::clone\n\nFor a generic struct, `#[derive]` implements `Clone` conditionally by adding bound `Clone` on\ngeneric parameters.\n\n```rust\n// `derive` implements Clone for Reading when T is Clone.\n#[derive(Clone)]\nstruct Reading {\n frequency: T,\n}\n```\n\n## How can I implement `Clone`?\n\nTypes that are [`Copy`] should have a trivial implementation of `Clone`. More formally:\nif `T: Copy`, `x: T`, and `y: &T`, then `let x = y.clone();` is equivalent to `let x = *y;`.\nManual implementations should be careful to uphold this invariant; however, unsafe code\nmust not rely on it to ensure memory safety.\n\nAn example is a generic struct holding a function pointer. In this case, the\nimplementation of `Clone` cannot be `derive`d, but can be implemented as:\n\n```rust\nstruct Generate(fn() -> T);\n\nimpl Copy for Generate {}\n\nimpl Clone for Generate {\n fn clone(&self) -> Self {\n *self\n }\n}\n```\n\nIf we `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n```\n\nthe auto-derived implementations will have unnecessary `T: Copy` and `T: Clone` bounds:\n\n```rust\n\n// Automatically derived\nimpl Copy for Generate { }\n\n// Automatically derived\nimpl Clone for Generate {\n fn clone(&self) -> Generate {\n Generate(Clone::clone(&self.0))\n }\n}\n```\n\nThe bounds are unnecessary because clearly the function itself should be\ncopy- and cloneable even if its return type is not:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n\nstruct NotCloneable;\n\nfn generate_not_cloneable() -> NotCloneable {\n NotCloneable\n}\n\nGenerate(generate_not_cloneable).clone(); // error: trait bounds were not satisfied\n// Note: With the manual implementations the above line will compile.\n```\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Clone`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Clone` themselves.\n Note that variables captured by shared reference always implement `Clone`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Clone`.\n\n[impls]: #implementors"},"deprecated":false,"sortText":"ffffffef","filterText":"Clone","textEdit":{"newText":"Clone","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Copy","kind":8,"documentation":{"kind":"markdown","value":"Types whose values can be duplicated simply by copying bits.\n\nBy default, variable bindings have 'move semantics.' In other\nwords:\n\n```rust\n#[derive(Debug)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `x` has moved into `y`, and so cannot be used\n\n// println!(\"{x:?}\"); // error: use of moved value\n```\n\nHowever, if a type implements `Copy`, it instead has 'copy semantics':\n\n```rust\n// We can derive a `Copy` implementation. `Clone` is also required, as it's\n// a supertrait of `Copy`.\n#[derive(Debug, Copy, Clone)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `y` is a copy of `x`\n\nprintln!(\"{x:?}\"); // A-OK!\n```\n\nIt's important to note that in these two examples, the only difference is whether you\nare allowed to access `x` after the assignment. Under the hood, both a copy and a move\ncan result in bits being copied in memory, although this is sometimes optimized away.\n\n## How can I implement `Copy`?\n\nThere are two ways to implement `Copy` on your type. The simplest is to use `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct MyStruct;\n```\n\nYou can also implement `Copy` and `Clone` manually:\n\n```rust\nstruct MyStruct;\n\nimpl Copy for MyStruct { }\n\nimpl Clone for MyStruct {\n fn clone(&self) -> MyStruct {\n *self\n }\n}\n```\n\nThere is a small difference between the two: the `derive` strategy will also place a `Copy`\nbound on type parameters, which isn't always desired.\n\n## What's the difference between `Copy` and `Clone`?\n\nCopies happen implicitly, for example as part of an assignment `y = x`. The behavior of\n`Copy` is not overloadable; it is always a simple bit-wise copy.\n\nCloning is an explicit action, `x.clone()`. The implementation of [`Clone`] can\nprovide any type-specific behavior necessary to duplicate values safely. For example,\nthe implementation of [`Clone`] for [`String`] needs to copy the pointed-to string\nbuffer in the heap. A simple bitwise copy of [`String`] values would merely copy the\npointer, leading to a double free down the line. For this reason, [`String`] is [`Clone`]\nbut not `Copy`.\n\n[`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement\n[`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`\n(see the example above).\n\n## When can my type be `Copy`?\n\nA type can implement `Copy` if all of its components implement `Copy`. For example, this\nstruct can be `Copy`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Point {\n x: i32,\n y: i32,\n}\n```\n\nA struct can be `Copy`, and [`i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.\nBy contrast, consider\n\n```rust\nstruct PointList {\n points: Vec,\n}\n```\n\nThe struct `PointList` cannot implement `Copy`, because [`Vec`] is not `Copy`. If we\nattempt to derive a `Copy` implementation, we'll get an error:\n\n```text\nthe trait `Copy` cannot be implemented for this type; field `points` does not implement `Copy`\n```\n\nShared references (`&T`) are also `Copy`, so a type can be `Copy`, even when it holds\nshared references of types `T` that are *not* `Copy`. Consider the following struct,\nwhich can implement `Copy`, because it only holds a *shared reference* to our non-`Copy`\ntype `PointList` from above:\n\n```rust\n#[derive(Copy, Clone)]\nstruct PointListWrapper<'a> {\n point_list_ref: &'a PointList,\n}\n```\n\n## When *can't* my type be `Copy`?\n\nSome types can't be copied safely. For example, copying `&mut T` would create an aliased\nmutable reference. Copying [`String`] would duplicate responsibility for managing the\n[`String`]'s buffer, leading to a double free.\n\nGeneralizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's\nmanaging some resource besides its own [`size_of::`] bytes.\n\nIf you try to implement `Copy` on a struct or enum containing non-`Copy` data, you will get\nthe error [E0204].\n\n[E0204]: ../../error_codes/E0204.html\n\n## When *should* my type be `Copy`?\n\nGenerally speaking, if your type _can_ implement `Copy`, it should. Keep in mind, though,\nthat implementing `Copy` is part of the public API of your type. If the type might become\nnon-`Copy` in the future, it could be prudent to omit the `Copy` implementation now, to\navoid a breaking API change.\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Copy`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Copy` themselves.\n Note that variables captured by shared reference always implement `Copy`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Copy`.\n\n[`Vec`]: ../../std/vec/struct.Vec.html\n[`String`]: ../../std/string/struct.String.html\n[`size_of::`]: crate::mem::size_of\n[impls]: #implementors"},"deprecated":false,"sortText":"ffffffef","filterText":"Copy","textEdit":{"newText":"Copy","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Default","kind":8,"documentation":{"kind":"markdown","value":"A trait for giving a type a useful default value.\n\nSometimes, you want to fall back to some kind of default value, and\ndon't particularly care what it is. This comes up often with `struct`s\nthat define a set of options:\n\n```rust\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```\n\nHow can we define some default values? You can use `Default`:\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n\nfn main() {\n let options: SomeOptions = Default::default();\n}\n```\n\nNow, you get all of the default values. Rust implements `Default` for various primitives types.\n\nIf you want to override a particular option, but still retain the other defaults:\n\n```rust\nfn main() {\n let options = SomeOptions { foo: 42, ..Default::default() };\n}\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all of the type's fields implement\n`Default`. When `derive`d, it will use the default value for each field's type.\n\n### `enum`s\n\nWhen using `#[derive(Default)]` on an `enum`, you need to choose which unit variant will be\ndefault. You do this by placing the `#[default]` attribute on the variant.\n\n```rust\n#[derive(Default)]\nenum Kind {\n #[default]\n A,\n B,\n C,\n}\n```\n\nYou cannot use the `#[default]` attribute on non-unit or non-exhaustive variants.\n\n## How can I implement `Default`?\n\nProvide an implementation for the `default()` method that returns the value of\nyour type that should be the default:\n\n```rust\nenum Kind {\n A,\n B,\n C,\n}\n\nimpl Default for Kind {\n fn default() -> Self { Kind::A }\n}\n```\n\n# Examples\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Default","textEdit":{"newText":"Default","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"DoubleEndedIterator","kind":8,"documentation":{"kind":"markdown","value":"An iterator able to yield elements from both ends.\n\nSomething that implements `DoubleEndedIterator` has one extra capability\nover something that implements [`Iterator`]: the ability to also take\n`Item`s from the back, as well as the front.\n\nIt is important to note that both back and forth work on the same range,\nand do not cross: iteration is over when they meet in the middle.\n\nIn a similar fashion to the [`Iterator`] protocol, once a\n`DoubleEndedIterator` returns [`None`] from a [`next_back()`], calling it\nagain may or may not ever return [`Some`] again. [`next()`] and\n[`next_back()`] are interchangeable for this purpose.\n\n[`next_back()`]: DoubleEndedIterator::next_back\n[`next()`]: Iterator::next\n\n# Examples\n\nBasic usage:\n\n```rust\nlet numbers = vec![1, 2, 3, 4, 5, 6];\n\nlet mut iter = numbers.iter();\n\nassert_eq!(Some(&1), iter.next());\nassert_eq!(Some(&6), iter.next_back());\nassert_eq!(Some(&5), iter.next_back());\nassert_eq!(Some(&2), iter.next());\nassert_eq!(Some(&3), iter.next());\nassert_eq!(Some(&4), iter.next());\nassert_eq!(None, iter.next());\nassert_eq!(None, iter.next_back());\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"DoubleEndedIterator","textEdit":{"newText":"DoubleEndedIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Drop","kind":8,"documentation":{"kind":"markdown","value":"Custom code within the destructor.\n\nWhen a value is no longer needed, Rust will run a \"destructor\" on that value.\nThe most common way that a value is no longer needed is when it goes out of\nscope. Destructors may still run in other circumstances, but we're going to\nfocus on scope for the examples here. To learn about some of those other cases,\nplease see [the reference] section on destructors.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\nThis destructor consists of two components:\n- A call to `Drop::drop` for that value, if this special `Drop` trait is implemented for its type.\n- The automatically generated \"drop glue\" which recursively calls the destructors\n of all the fields of this value.\n\nAs Rust automatically calls the destructors of all contained fields,\nyou don't have to implement `Drop` in most cases. But there are some cases where\nit is useful, for example for types which directly manage a resource.\nThat resource may be memory, it may be a file descriptor, it may be a network socket.\nOnce a value of that type is no longer going to be used, it should \"clean up\" its\nresource by freeing the memory or closing the file or socket. This is\nthe job of a destructor, and therefore the job of `Drop::drop`.\n\n## Examples\n\nTo see destructors in action, let's take a look at the following program:\n\n```rust\nstruct HasDrop;\n\nimpl Drop for HasDrop {\n fn drop(&mut self) {\n println!(\"Dropping HasDrop!\");\n }\n}\n\nstruct HasTwoDrops {\n one: HasDrop,\n two: HasDrop,\n}\n\nimpl Drop for HasTwoDrops {\n fn drop(&mut self) {\n println!(\"Dropping HasTwoDrops!\");\n }\n}\n\nfn main() {\n let _x = HasTwoDrops { one: HasDrop, two: HasDrop };\n println!(\"Running!\");\n}\n```\n\nRust will first call `Drop::drop` for `_x` and then for both `_x.one` and `_x.two`,\nmeaning that running this will print\n\n```text\nRunning!\nDropping HasTwoDrops!\nDropping HasDrop!\nDropping HasDrop!\n```\n\nEven if we remove the implementation of `Drop` for `HasTwoDrop`, the destructors of its fields are still called.\nThis would result in\n\n```test\nRunning!\nDropping HasDrop!\nDropping HasDrop!\n```\n\n## You cannot call `Drop::drop` yourself\n\nBecause `Drop::drop` is used to clean up a value, it may be dangerous to use this value after\nthe method has been called. As `Drop::drop` does not take ownership of its input,\nRust prevents misuse by not allowing you to call `Drop::drop` directly.\n\nIn other words, if you tried to explicitly call `Drop::drop` in the above example, you'd get a compiler error.\n\nIf you'd like to explicitly call the destructor of a value, [`mem::drop`] can be used instead.\n\n[`mem::drop`]: drop\n\n## Drop order\n\nWhich of our two `HasDrop` drops first, though? For structs, it's the same\norder that they're declared: first `one`, then `two`. If you'd like to try\nthis yourself, you can modify `HasDrop` above to contain some data, like an\ninteger, and then use it in the `println!` inside of `Drop`. This behavior is\nguaranteed by the language.\n\nUnlike for structs, local variables are dropped in reverse order:\n\n```rust\nstruct Foo;\n\nimpl Drop for Foo {\n fn drop(&mut self) {\n println!(\"Dropping Foo!\")\n }\n}\n\nstruct Bar;\n\nimpl Drop for Bar {\n fn drop(&mut self) {\n println!(\"Dropping Bar!\")\n }\n}\n\nfn main() {\n let _foo = Foo;\n let _bar = Bar;\n}\n```\n\nThis will print\n\n```text\nDropping Bar!\nDropping Foo!\n```\n\nPlease see [the reference] for the full rules.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\n## `Copy` and `Drop` are exclusive\n\nYou cannot implement both [`Copy`] and `Drop` on the same type. Types that\nare `Copy` get implicitly duplicated by the compiler, making it very\nhard to predict when, and how often destructors will be executed. As such,\nthese types cannot have destructors.\n\n## Drop check\n\nDropping interacts with the borrow checker in subtle ways: when a type `T` is being implicitly\ndropped as some variable of this type goes out of scope, the borrow checker needs to ensure that\ncalling `T`'s destructor at this moment is safe. In particular, it also needs to be safe to\nrecursively drop all the fields of `T`. For example, it is crucial that code like the following\nis being rejected:\n\n```rust\nuse std::cell::Cell;\n\nstruct S<'a>(Cell>>, Box);\nimpl Drop for S<'_> {\n fn drop(&mut self) {\n if let Some(r) = self.0.get() {\n // Print the contents of the `Box` in `r`.\n println!(\"{}\", r.1);\n }\n }\n}\n\nfn main() {\n // Set up two `S` that point to each other.\n let s1 = S(Cell::new(None), Box::new(42));\n let s2 = S(Cell::new(Some(&s1)), Box::new(42));\n s1.0.set(Some(&s2));\n // Now they both get dropped. But whichever is the 2nd one\n // to be dropped will access the `Box` in the first one,\n // which is a use-after-free!\n}\n```\n\nThe Nomicon discusses the need for [drop check in more detail][drop check].\n\nTo reject such code, the \"drop check\" analysis determines which types and lifetimes need to\nstill be live when `T` gets dropped. The exact details of this analysis are not yet\nstably guaranteed and **subject to change**. Currently, the analysis works as follows:\n- If `T` has no drop glue, then trivially nothing is required to be live. This is the case if\n neither `T` nor any of its (recursive) fields have a destructor (`impl Drop`). [`PhantomData`]\n and [`ManuallyDrop`] are considered to never have a destructor, no matter their field type.\n- If `T` has drop glue, then, for all types `U` that are *owned* by any field of `T`,\n recursively add the types and lifetimes that need to be live when `U` gets dropped. The set of\n owned types is determined by recursively traversing `T`:\n - Recursively descend through `PhantomData`, `Box`, tuples, and arrays (including arrays of\n length 0).\n - Stop at reference and raw pointer types as well as function pointers and function items;\n they do not own anything.\n - Stop at non-composite types (type parameters that remain generic in the current context and\n base types such as integers and `bool`); these types are owned.\n - When hitting an ADT with `impl Drop`, stop there; this type is owned.\n - When hitting an ADT without `impl Drop`, recursively descend to its fields. (For an `enum`,\n consider all fields of all variants.)\n- Furthermore, if `T` implements `Drop`, then all generic (lifetime and type) parameters of `T`\n must be live.\n\nIn the above example, the last clause implies that `'a` must be live when `S<'a>` is dropped,\nand hence the example is rejected. If we remove the `impl Drop`, the liveness requirement\ndisappears and the example is accepted.\n\nThere exists an unstable way for a type to opt-out of the last clause; this is called \"drop\ncheck eyepatch\" or `may_dangle`. For more details on this nightly-only feature, see the\n[discussion in the Nomicon][nomicon].\n\n[`ManuallyDrop`]: crate::mem::ManuallyDrop\n[`PhantomData`]: crate::marker::PhantomData\n[drop check]: ../../nomicon/dropck.html\n[nomicon]: ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standard-library-and-its-unstable-may_dangle"},"deprecated":false,"sortText":"ffffffef","filterText":"Drop","textEdit":{"newText":"Drop","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Eq (alias ==, !=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for comparisons corresponding to [equivalence relations](\nhttps://en.wikipedia.org/wiki/Equivalence_relation).\n\nThis means, that in addition to `a == b` and `a != b` being strict inverses,\nthe relation must be (for all `a`, `b` and `c`):\n\n- reflexive: `a == a`;\n- symmetric: `a == b` implies `b == a` (required by `PartialEq` as well); and\n- transitive: `a == b` and `b == c` implies `a == c` (required by `PartialEq` as well).\n\nThis property cannot be checked by the compiler, and therefore `Eq` implies\n[`PartialEq`], and has no extra methods.\n\nViolating this property is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\nImplement `Eq` in addition to `PartialEq` if it's guaranteed that\n`PartialEq::eq(a, a)` always returns `true` (reflexivity), in addition to\nthe symmetric and transitive properties already required by `PartialEq`.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d, because `Eq` has\nno extra methods, it is only informing the compiler that this is an\nequivalence relation rather than a partial equivalence relation. Note that\nthe `derive` strategy requires all fields are `Eq`, which isn't\nalways desired.\n\n## How can I implement `Eq`?\n\nIf you cannot use the `derive` strategy, specify that your type implements\n`Eq`, which has no methods:\n\n```rust\nenum BookFormat { Paperback, Hardback, Ebook }\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\nimpl Eq for Book {}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Eq","textEdit":{"newText":"Eq","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Err(…)","kind":20,"detail":"Err(E)","documentation":{"kind":"markdown","value":"Contains the error value"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Err()","insertTextFormat":2,"textEdit":{"newText":"Err(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"ExactSizeIterator","kind":8,"documentation":{"kind":"markdown","value":"An iterator that knows its exact length.\n\nMany [`Iterator`]s don't know how many times they will iterate, but some do.\nIf an iterator knows how many times it can iterate, providing access to\nthat information can be useful. For example, if you want to iterate\nbackwards, a good start is to know where the end is.\n\nWhen implementing an `ExactSizeIterator`, you must also implement\n[`Iterator`]. When doing so, the implementation of [`Iterator::size_hint`]\n*must* return the exact size of the iterator.\n\nThe [`len`] method has a default implementation, so you usually shouldn't\nimplement it. However, you may be able to provide a more performant\nimplementation than the default, so overriding it in this case makes sense.\n\nNote that this trait is a safe trait and as such does *not* and *cannot*\nguarantee that the returned length is correct. This means that `unsafe`\ncode **must not** rely on the correctness of [`Iterator::size_hint`]. The\nunstable and unsafe [`TrustedLen`](super::marker::TrustedLen) trait gives\nthis additional guarantee.\n\n[`len`]: ExactSizeIterator::len\n\n# When *shouldn't* an adapter be `ExactSizeIterator`?\n\nIf an adapter makes an iterator *longer*, then it's usually incorrect for\nthat adapter to implement `ExactSizeIterator`. The inner exact-sized\niterator might already be `usize::MAX`-long, and thus the length of the\nlonger adapted iterator would no longer be exactly representable in `usize`.\n\nThis is why [`Chain`](crate::iter::Chain) isn't `ExactSizeIterator`,\neven when `A` and `B` are both `ExactSizeIterator`.\n\n# Examples\n\nBasic usage:\n\n```rust\n// a finite range knows exactly how many times it will iterate\nlet five = 0..5;\n\nassert_eq!(5, five.len());\n```\n\nIn the [module-level docs], we implemented an [`Iterator`], `Counter`.\nLet's implement `ExactSizeIterator` for it as well:\n\n[module-level docs]: crate::iter\n\n```rust\nimpl ExactSizeIterator for Counter {\n // We can easily calculate the remaining number of iterations.\n fn len(&self) -> usize {\n 5 - self.count\n }\n}\n\n// And now we can use it!\n\nlet mut counter = Counter::new();\n\nassert_eq!(5, counter.len());\nlet _ = counter.next();\nassert_eq!(4, counter.len());\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"ExactSizeIterator","textEdit":{"newText":"ExactSizeIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Extend","kind":8,"documentation":{"kind":"markdown","value":"Extend a collection with the contents of an iterator.\n\nIterators produce a series of values, and collections can also be thought\nof as a series of values. The `Extend` trait bridges this gap, allowing you\nto extend a collection by including the contents of that iterator. When\nextending a collection with an already existing key, that entry is updated\nor, in the case of collections that permit multiple entries with equal\nkeys, that entry is inserted.\n\n# Examples\n\nBasic usage:\n\n```rust\n// You can extend a String with some chars:\nlet mut message = String::from(\"The first three letters are: \");\n\nmessage.extend(&['a', 'b', 'c']);\n\nassert_eq!(\"abc\", &message[29..32]);\n```\n\nImplementing `Extend`:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// since MyCollection has a list of i32s, we implement Extend for i32\nimpl Extend for MyCollection {\n\n // This is a bit simpler with the concrete type signature: we can call\n // extend on anything which can be turned into an Iterator which gives\n // us i32s. Because we need i32s to put into MyCollection.\n fn extend>(&mut self, iter: T) {\n\n // The implementation is very straightforward: loop through the\n // iterator, and add() each element to ourselves.\n for elem in iter {\n self.add(elem);\n }\n }\n}\n\nlet mut c = MyCollection::new();\n\nc.add(5);\nc.add(6);\nc.add(7);\n\n// let's extend our collection with three more numbers\nc.extend(vec![1, 2, 3]);\n\n// we've added these elements onto the end\nassert_eq!(\"MyCollection([5, 6, 7, 1, 2, 3])\", format!(\"{c:?}\"));\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Extend","textEdit":{"newText":"Extend","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Fn","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes an immutable receiver.\n\nInstances of `Fn` can be called repeatedly without mutating state.\n\n*This trait (`Fn`) is not to be confused with [function pointers]\n(`fn`).*\n\n`Fn` is implemented automatically by closures which only take immutable\nreferences to captured variables or don't capture anything at all, as well\nas (safe) [function pointers] (with some caveats, see their documentation\nfor more details). Additionally, for any type `F` that implements `Fn`, `&F`\nimplements `Fn`, too.\n\nSince both [`FnMut`] and [`FnOnce`] are supertraits of `Fn`, any\ninstance of `Fn` can be used as a parameter where a [`FnMut`] or [`FnOnce`]\nis expected.\n\nUse `Fn` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly and without mutating state (e.g., when\ncalling it concurrently). If you do not need such strict requirements, use\n[`FnMut`] or [`FnOnce`] as bounds.\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a closure\n\n```rust\nlet square = |x| x * x;\nassert_eq!(square(5), 25);\n```\n\n## Using a `Fn` parameter\n\n```rust\nfn call_with_one(func: F) -> usize\n where F: Fn(usize) -> usize {\n func(1)\n}\n\nlet double = |x| x * 2;\nassert_eq!(call_with_one(double), 2);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"Fn","textEdit":{"newText":"Fn","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"FnMut","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a mutable receiver.\n\nInstances of `FnMut` can be called repeatedly and may mutate state.\n\n`FnMut` is implemented automatically by closures which take mutable\nreferences to captured variables, as well as all types that implement\n[`Fn`], e.g., (safe) [function pointers] (since `FnMut` is a supertrait of\n[`Fn`]). Additionally, for any type `F` that implements `FnMut`, `&mut F`\nimplements `FnMut`, too.\n\nSince [`FnOnce`] is a supertrait of `FnMut`, any instance of `FnMut` can be\nused where a [`FnOnce`] is expected, and since [`Fn`] is a subtrait of\n`FnMut`, any instance of [`Fn`] can be used where `FnMut` is expected.\n\nUse `FnMut` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly, while allowing it to mutate state.\nIf you don't want the parameter to mutate state, use [`Fn`] as a\nbound; if you don't need to call it repeatedly, use [`FnOnce`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a mutably capturing closure\n\n```rust\nlet mut x = 5;\n{\n let mut square_x = || x *= x;\n square_x();\n}\nassert_eq!(x, 25);\n```\n\n## Using a `FnMut` parameter\n\n```rust\nfn do_twice(mut func: F)\n where F: FnMut()\n{\n func();\n func();\n}\n\nlet mut x: usize = 1;\n{\n let add_two_to_x = || x += 2;\n do_twice(add_two_to_x);\n}\n\nassert_eq!(x, 5);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FnMut","textEdit":{"newText":"FnMut","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"FnOnce","kind":8,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a by-value receiver.\n\nInstances of `FnOnce` can be called, but might not be callable multiple\ntimes. Because of this, if the only thing known about a type is that it\nimplements `FnOnce`, it can only be called once.\n\n`FnOnce` is implemented automatically by closures that might consume captured\nvariables, as well as all types that implement [`FnMut`], e.g., (safe)\n[function pointers] (since `FnOnce` is a supertrait of [`FnMut`]).\n\nSince both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of\n[`Fn`] or [`FnMut`] can be used where a `FnOnce` is expected.\n\nUse `FnOnce` as a bound when you want to accept a parameter of function-like\ntype and only need to call it once. If you need to call the parameter\nrepeatedly, use [`FnMut`] as a bound; if you also need it to not mutate\nstate, use [`Fn`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Using a `FnOnce` parameter\n\n```rust\nfn consume_with_relish(func: F)\n where F: FnOnce() -> String\n{\n // `func` consumes its captured variables, so it cannot be run more\n // than once.\n println!(\"Consumed: {}\", func());\n\n println!(\"Delicious!\");\n\n // Attempting to invoke `func()` again will throw a `use of moved\n // value` error for `func`.\n}\n\nlet x = String::from(\"x\");\nlet consume_and_return_x = move || x;\nconsume_with_relish(consume_and_return_x);\n\n// `consume_and_return_x` can no longer be invoked at this point\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FnOnce","textEdit":{"newText":"FnOnce","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"From","kind":8,"documentation":{"kind":"markdown","value":"Used to do value-to-value conversions while consuming the input value. It is the reciprocal of\n[`Into`].\n\nOne should always prefer implementing `From` over [`Into`]\nbecause implementing `From` automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nOnly implement [`Into`] when targeting a version prior to Rust 1.41 and converting to a type\noutside the current crate.\n`From` was not able to do these types of conversions in earlier versions because of Rust's\norphaning rules.\nSee [`Into`] for more details.\n\nPrefer using [`Into`] over using `From` when specifying trait bounds on a generic function.\nThis way, types that directly implement [`Into`] can be used as arguments as well.\n\nThe `From` is also very useful when performing error handling. When constructing a function\nthat is capable of failing, the return type will generally be of the form `Result`.\nThe `From` trait simplifies error handling by allowing a function to return a single error type\nthat encapsulate multiple error types. See the \"Examples\" section and [the book][book] for more\ndetails.\n\n**Note: This trait must not fail**. The `From` trait is intended for perfect conversions.\nIf the conversion can fail or is not perfect, use [`TryFrom`].\n\n# Generic Implementations\n\n- `From for U` implies [`Into`]` for T`\n- `From` is reflexive, which means that `From for T` is implemented\n\n# When to implement `From`\n\nWhile there's no technical restrictions on which conversions can be done using\na `From` implementation, the general expectation is that the conversions\nshould typically be restricted as follows:\n\n* The conversion is *infallible*: if the conversion can fail, use [`TryFrom`]\n instead; don't provide a `From` impl that panics.\n\n* The conversion is *lossless*: semantically, it should not lose or discard\n information. For example, `i32: From` exists, where the original\n value can be recovered using `u16: TryFrom`. And `String: From<&str>`\n exists, where you can get something equivalent to the original value via\n `Deref`. But `From` cannot be used to convert from `u32` to `u16`, since\n that cannot succeed in a lossless way. (There's some wiggle room here for\n information not considered semantically relevant. For example,\n `Box<[T]>: From>` exists even though it might not preserve capacity,\n like how two vectors can be equal despite differing capacities.)\n\n* The conversion is *value-preserving*: the conceptual kind and meaning of\n the resulting value is the same, even though the Rust type and technical\n representation might be different. For example `-1_i8 as u8` is *lossless*,\n since `as` casting back can recover the original value, but that conversion\n is *not* available via `From` because `-1` and `255` are different conceptual\n values (despite being identical bit patterns technically). But\n `f32: From` *is* available because `1_i16` and `1.0_f32` are conceptually\n the same real number (despite having very different bit patterns technically).\n `String: From` is available because they're both *text*, but\n `String: From` is *not* available, since `1` (a number) and `\"1\"`\n (text) are too different. (Converting values to text is instead covered\n by the [`Display`](crate::fmt::Display) trait.)\n\n* The conversion is *obvious*: it's the only reasonable conversion between\n the two types. Otherwise it's better to have it be a named method or\n constructor, like how [`str::as_bytes`] is a method and how integers have\n methods like [`u32::from_ne_bytes`], [`u32::from_le_bytes`], and\n [`u32::from_be_bytes`], none of which are `From` implementations. Whereas\n there's only one reasonable way to wrap an [`Ipv6Addr`](crate::net::Ipv6Addr)\n into an [`IpAddr`](crate::net::IpAddr), thus `IpAddr: From` exists.\n\n# Examples\n\n[`String`] implements `From<&str>`:\n\nAn explicit conversion from a `&str` to a String is done as follows:\n\n```rust\nlet string = \"hello\".to_string();\nlet other_string = String::from(\"hello\");\n\nassert_eq!(string, other_string);\n```\n\nWhile performing error handling it is often useful to implement `From` for your own error type.\nBy converting underlying error types to our own custom error type that encapsulates the\nunderlying error type, we can return a single error type without losing information on the\nunderlying cause. The '?' operator automatically converts the underlying error type to our\ncustom error type with `From::from`.\n\n```rust\nuse std::fs;\nuse std::io;\nuse std::num;\n\nenum CliError {\n IoError(io::Error),\n ParseError(num::ParseIntError),\n}\n\nimpl From for CliError {\n fn from(error: io::Error) -> Self {\n CliError::IoError(error)\n }\n}\n\nimpl From for CliError {\n fn from(error: num::ParseIntError) -> Self {\n CliError::ParseError(error)\n }\n}\n\nfn open_and_parse_file(file_name: &str) -> Result {\n let mut contents = fs::read_to_string(&file_name)?;\n let num: i32 = contents.trim().parse()?;\n Ok(num)\n}\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`from`]: From::from\n[book]: ../../book/ch09-00-error-handling.html"},"deprecated":false,"sortText":"ffffffef","filterText":"From","textEdit":{"newText":"From","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"FromIterator","kind":8,"documentation":{"kind":"markdown","value":"Conversion from an [`Iterator`].\n\nBy implementing `FromIterator` for a type, you define how it will be\ncreated from an iterator. This is common for types which describe a\ncollection of some kind.\n\nIf you want to create a collection from the contents of an iterator, the\n[`Iterator::collect()`] method is preferred. However, when you need to\nspecify the container type, [`FromIterator::from_iter()`] can be more\nreadable than using a turbofish (e.g. `::>()`). See the\n[`Iterator::collect()`] documentation for more examples of its use.\n\nSee also: [`IntoIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v = Vec::from_iter(five_fives);\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`Iterator::collect()`] to implicitly use `FromIterator`:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v: Vec = five_fives.collect();\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`FromIterator::from_iter()`] as a more readable alternative to\n[`Iterator::collect()`]:\n\n```rust\nuse std::collections::VecDeque;\nlet first = (0..10).collect::>();\nlet second = VecDeque::from_iter(0..10);\n\nassert_eq!(first, second);\n```\n\nImplementing `FromIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement FromIterator\nimpl FromIterator for MyCollection {\n fn from_iter>(iter: I) -> Self {\n let mut c = MyCollection::new();\n\n for i in iter {\n c.add(i);\n }\n\n c\n }\n}\n\n// Now we can make a new iterator...\nlet iter = (0..5).into_iter();\n\n// ... and make a MyCollection out of it\nlet c = MyCollection::from_iter(iter);\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n\n// collect works too!\n\nlet iter = (0..5).into_iter();\nlet c: MyCollection = iter.collect();\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"FromIterator","textEdit":{"newText":"FromIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Into","kind":8,"documentation":{"kind":"markdown","value":"A value-to-value conversion that consumes the input value. The\nopposite of [`From`].\n\nOne should avoid implementing [`Into`] and implement [`From`] instead.\nImplementing [`From`] automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nPrefer using [`Into`] over [`From`] when specifying trait bounds on a generic function\nto ensure that types that only implement [`Into`] can be used as well.\n\n**Note: This trait must not fail**. If the conversion can fail, use [`TryInto`].\n\n# Generic Implementations\n\n- [`From`]` for U` implies `Into for T`\n- [`Into`] is reflexive, which means that `Into for T` is implemented\n\n# Implementing [`Into`] for conversions to external types in old versions of Rust\n\nPrior to Rust 1.41, if the destination type was not part of the current crate\nthen you couldn't implement [`From`] directly.\nFor example, take this code:\n\n```rust\nstruct Wrapper(Vec);\nimpl From> for Vec {\n fn from(w: Wrapper) -> Vec {\n w.0\n }\n}\n```\nThis will fail to compile in older versions of the language because Rust's orphaning rules\nused to be a little bit more strict. To bypass this, you could implement [`Into`] directly:\n\n```rust\nstruct Wrapper(Vec);\nimpl Into> for Wrapper {\n fn into(self) -> Vec {\n self.0\n }\n}\n```\n\nIt is important to understand that [`Into`] does not provide a [`From`] implementation\n(as [`From`] does with [`Into`]). Therefore, you should always try to implement [`From`]\nand then fall back to [`Into`] if [`From`] can't be implemented.\n\n# Examples\n\n[`String`] implements [`Into`]`<`[`Vec`]`<`[`u8`]`>>`:\n\nIn order to express that we want a generic function to take all arguments that can be\nconverted to a specified type `T`, we can use a trait bound of [`Into`]``.\nFor example: The function `is_hello` takes all arguments that can be converted into a\n[`Vec`]`<`[`u8`]`>`.\n\n```rust\nfn is_hello>>(s: T) {\n let bytes = b\"hello\".to_vec();\n assert_eq!(bytes, s.into());\n}\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`Vec`]: ../../std/vec/struct.Vec.html"},"deprecated":false,"sortText":"ffffffef","filterText":"Into","textEdit":{"newText":"Into","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"IntoIterator","kind":8,"documentation":{"kind":"markdown","value":"Conversion into an [`Iterator`].\n\nBy implementing `IntoIterator` for a type, you define how it will be\nconverted to an iterator. This is common for types which describe a\ncollection of some kind.\n\nOne benefit of implementing `IntoIterator` is that your type will [work\nwith Rust's `for` loop syntax](crate::iter#for-loops-and-intoiterator).\n\nSee also: [`FromIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = [1, 2, 3];\nlet mut iter = v.into_iter();\n\nassert_eq!(Some(1), iter.next());\nassert_eq!(Some(2), iter.next());\nassert_eq!(Some(3), iter.next());\nassert_eq!(None, iter.next());\n```\nImplementing `IntoIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement IntoIterator\nimpl IntoIterator for MyCollection {\n type Item = i32;\n type IntoIter = std::vec::IntoIter;\n\n fn into_iter(self) -> Self::IntoIter {\n self.0.into_iter()\n }\n}\n\n// Now we can make a new collection...\nlet mut c = MyCollection::new();\n\n// ... add some stuff to it ...\nc.add(0);\nc.add(1);\nc.add(2);\n\n// ... and then turn it into an Iterator:\nfor (i, n) in c.into_iter().enumerate() {\n assert_eq!(i as i32, n);\n}\n```\n\nIt is common to use `IntoIterator` as a trait bound. This allows\nthe input collection type to change, so long as it is still an\niterator. Additional bounds can be specified by restricting on\n`Item`:\n\n```rust\nfn collect_as_strings(collection: T) -> Vec\nwhere\n T: IntoIterator,\n T::Item: std::fmt::Debug,\n{\n collection\n .into_iter()\n .map(|item| format!(\"{item:?}\"))\n .collect()\n}\n```"},"deprecated":false,"sortText":"ffffffef","filterText":"IntoIterator","textEdit":{"newText":"IntoIterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Iterator","kind":8,"documentation":{"kind":"markdown","value":"A trait for dealing with iterators.\n\nThis is the main iterator trait. For more about the concept of iterators\ngenerally, please see the [module-level documentation]. In particular, you\nmay want to know how to [implement `Iterator`][impl].\n\n[module-level documentation]: crate::iter\n[impl]: crate::iter#implementing-iterator"},"deprecated":false,"sortText":"ffffffef","filterText":"Iterator","textEdit":{"newText":"Iterator","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"None","kind":20,"detail":"None","documentation":{"kind":"markdown","value":"No value."},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"None","insertTextFormat":2,"textEdit":{"newText":"None$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"Ok(…)","kind":20,"detail":"Ok(T)","documentation":{"kind":"markdown","value":"Contains the success value"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Ok()","insertTextFormat":2,"textEdit":{"newText":"Ok(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"Option","kind":13,"documentation":{"kind":"markdown","value":"The `Option` type. See [the module level documentation](self) for more."},"deprecated":false,"sortText":"ffffffef","filterText":"Option","textEdit":{"newText":"Option","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Ord (alias <, >, <=, >=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for types that form a [total order](https://en.wikipedia.org/wiki/Total_order).\n\nImplementations must be consistent with the [`PartialOrd`] implementation, and ensure\n`max`, `min`, and `clamp` are consistent with `cmp`:\n\n- `partial_cmp(a, b) == Some(cmp(a, b))`.\n- `max(a, b) == max_by(a, b, cmp)` (ensured by the default implementation).\n- `min(a, b) == min_by(a, b, cmp)` (ensured by the default implementation).\n- For `a.clamp(min, max)`, see the [method docs](#method.clamp)\n (ensured by the default implementation).\n\nIt's easy to accidentally make `cmp` and `partial_cmp` disagree by\nderiving some of the traits and manually implementing others.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nFrom the above and the requirements of `PartialOrd`, it follows that for\nall `a`, `b` and `c`:\n\n- exactly one of `a < b`, `a == b` or `a > b` is true; and\n- `<` is transitive: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n\nMathematically speaking, the `<` operator defines a strict [weak order]. In\ncases where `==` conforms to mathematical equality, it also defines a\nstrict [total order].\n\n[weak order]: https://en.wikipedia.org/wiki/Weak_ordering\n[total order]: https://en.wikipedia.org/wiki/Total_order\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## Lexicographical comparison\n\nLexicographical comparison is an operation with the following properties:\n - Two sequences are compared element by element.\n - The first mismatching element defines which sequence is lexicographically less or greater than the other.\n - If one sequence is a prefix of another, the shorter sequence is lexicographically less than the other.\n - If two sequences have equivalent elements and are of the same length, then the sequences are lexicographically equal.\n - An empty sequence is lexicographically less than any non-empty sequence.\n - Two empty sequences are lexicographically equal.\n\n## How can I implement `Ord`?\n\n`Ord` requires that the type also be [`PartialOrd`] and [`Eq`] (which requires [`PartialEq`]).\n\nThen you must define an implementation for [`cmp`]. You may find it useful to use\n[`cmp`] on your type's fields.\n\nHere's an example where you want to sort people by height only, disregarding `id`\nand `name`:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n[`cmp`]: Ord::cmp"},"deprecated":false,"sortText":"ffffffef","filterText":"Ord","textEdit":{"newText":"Ord","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"PartialEq (alias ==, !=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for comparisons using the equality operator.\n\nImplementing this trait for types provides the `==` and `!=` operators for\nthose types.\n\n`x.eq(y)` can also be written `x == y`, and `x.ne(y)` can be written `x != y`.\nWe use the easier-to-read infix notation in the remainder of this documentation.\n\nThis trait allows for comparisons using the equality operator, for types\nthat do not have a full equivalence relation. For example, in floating point\nnumbers `NaN != NaN`, so floating point types implement `PartialEq` but not\n[`trait@Eq`]. Formally speaking, when `Rhs == Self`, this trait corresponds\nto a [partial equivalence relation].\n\n[partial equivalence relation]: https://en.wikipedia.org/wiki/Partial_equivalence_relation\n\nImplementations must ensure that `eq` and `ne` are consistent with each other:\n\n- `a != b` if and only if `!(a == b)`.\n\nThe default implementation of `ne` provides this consistency and is almost\nalways sufficient. It should not be overridden without very good reason.\n\nIf [`PartialOrd`] or [`Ord`] are also implemented for `Self` and `Rhs`, their methods must also\nbe consistent with `PartialEq` (see the documentation of those traits for the exact\nrequirements). It's easy to accidentally make them disagree by deriving some of the traits and\nmanually implementing others.\n\nThe equality relation `==` must satisfy the following conditions\n(for all `a`, `b`, `c` of type `A`, `B`, `C`):\n\n- **Symmetric**: if `A: PartialEq` and `B: PartialEq`, then **`a == b`\n implies `b == a`**; and\n\n- **Transitive**: if `A: PartialEq` and `B: PartialEq` and `A:\n PartialEq`, then **`a == b` and `b == c` implies `a == c`**.\n\nNote that the `B: PartialEq` (symmetric) and `A: PartialEq`\n(transitive) impls are not forced to exist, but these requirements apply\nwhenever they do exist.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d on structs, two\ninstances are equal if all fields are equal, and not equal if any fields\nare not equal. When `derive`d on enums, two instances are equal if they\nare the same variant and all fields are equal.\n\n## How can I implement `PartialEq`?\n\nAn example implementation for a domain in which two books are considered\nthe same book if their ISBN matches, even if the formats differ:\n\n```rust\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\nlet b2 = Book { isbn: 3, format: BookFormat::Ebook };\nlet b3 = Book { isbn: 10, format: BookFormat::Paperback };\n\nassert!(b1 == b2);\nassert!(b1 != b3);\n```\n\n## How can I compare two different types?\n\nThe type you can compare with is controlled by `PartialEq`'s type parameter.\nFor example, let's tweak our previous code a bit:\n\n```rust\n// The derive implements == comparisons\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\n// Implement == comparisons\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\n// Implement == comparisons\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\n\nassert!(b1 == BookFormat::Paperback);\nassert!(BookFormat::Ebook != b1);\n```\n\nBy changing `impl PartialEq for Book` to `impl PartialEq for Book`,\nwe allow `BookFormat`s to be compared with `Book`s.\n\nA comparison like the one above, which ignores some fields of the struct,\ncan be dangerous. It can easily lead to an unintended violation of the\nrequirements for a partial equivalence relation. For example, if we kept\nthe above implementation of `PartialEq` for `BookFormat` and added an\nimplementation of `PartialEq` for `Book` (either via a `#[derive]` or\nvia the manual implementation from the first example) then the result would\nviolate transitivity:\n\n```rust\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\n#[derive(PartialEq)]\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nfn main() {\n let b1 = Book { isbn: 1, format: BookFormat::Paperback };\n let b2 = Book { isbn: 2, format: BookFormat::Paperback };\n\n assert!(b1 == BookFormat::Paperback);\n assert!(BookFormat::Paperback == b2);\n\n // The following should hold by transitivity but doesn't.\n assert!(b1 == b2); // <-- PANICS\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x == y, false);\nassert_eq!(x.eq(&y), false);\n```\n\n[`eq`]: PartialEq::eq\n[`ne`]: PartialEq::ne"},"deprecated":false,"sortText":"ffffffef","filterText":"PartialEq","textEdit":{"newText":"PartialEq","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"PartialOrd (alias >, <, <=, >=)","kind":8,"documentation":{"kind":"markdown","value":"Trait for types that form a [partial order](https://en.wikipedia.org/wiki/Partial_order).\n\nThe `lt`, `le`, `gt`, and `ge` methods of this trait can be called using\nthe `<`, `<=`, `>`, and `>=` operators, respectively.\n\nThe methods of this trait must be consistent with each other and with those of [`PartialEq`].\nThe following conditions must hold:\n\n1. `a == b` if and only if `partial_cmp(a, b) == Some(Equal)`.\n2. `a < b` if and only if `partial_cmp(a, b) == Some(Less)`\n3. `a > b` if and only if `partial_cmp(a, b) == Some(Greater)`\n4. `a <= b` if and only if `a < b || a == b`\n5. `a >= b` if and only if `a > b || a == b`\n6. `a != b` if and only if `!(a == b)`.\n\nConditions 2–5 above are ensured by the default implementation.\nCondition 6 is already ensured by [`PartialEq`].\n\nIf [`Ord`] is also implemented for `Self` and `Rhs`, it must also be consistent with\n`partial_cmp` (see the documentation of that trait for the exact requirements). It's\neasy to accidentally make them disagree by deriving some of the traits and manually\nimplementing others.\n\nThe comparison must satisfy, for all `a`, `b` and `c`:\n\n- transitivity: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n- duality: `a < b` if and only if `b > a`.\n\nNote that these requirements mean that the trait itself must be implemented symmetrically and\ntransitively: if `T: PartialOrd` and `U: PartialOrd` then `U: PartialOrd` and `T:\nPartialOrd`.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nThe following corollaries follow from the above requirements:\n\n- irreflexivity of `<` and `>`: `!(a < a)`, `!(a > a)`\n- transitivity of `>`: if `a > b` and `b > c` then `a > c`\n- duality of `partial_cmp`: `partial_cmp(a, b) == partial_cmp(b, a).map(Ordering::reverse)`\n\n## Strict and non-strict partial orders\n\nThe `<` and `>` operators behave according to a *strict* partial order.\nHowever, `<=` and `>=` do **not** behave according to a *non-strict*\npartial order.\nThat is because mathematically, a non-strict partial order would require\nreflexivity, i.e. `a <= a` would need to be true for every `a`. This isn't\nalways the case for types that implement `PartialOrd`, for example:\n\n```rust\nlet a = f64::sqrt(-1.0);\nassert_eq!(a <= a, false);\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## How can I implement `PartialOrd`?\n\n`PartialOrd` only requires implementation of the [`partial_cmp`] method, with the others\ngenerated from default implementations.\n\nHowever it remains possible to implement the others separately for types which do not have a\ntotal order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==\nfalse` (cf. IEEE 754-2008 section 5.11).\n\n`PartialOrd` requires your type to be [`PartialEq`].\n\nIf your type is [`Ord`], you can implement [`partial_cmp`] by using [`cmp`]:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\nYou may also find it useful to use [`partial_cmp`] on your type's fields. Here\nis an example of `Person` types who have a floating-point `height` field that\nis the only field to be used for sorting:\n\n```rust\nuse std::cmp::Ordering;\n\nstruct Person {\n id: u32,\n name: String,\n height: f64,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n self.height.partial_cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x < y, true);\nassert_eq!(x.lt(&y), true);\n```\n\n[`partial_cmp`]: PartialOrd::partial_cmp\n[`cmp`]: Ord::cmp"},"deprecated":false,"sortText":"ffffffef","filterText":"PartialOrd","textEdit":{"newText":"PartialOrd","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Result","kind":13,"documentation":{"kind":"markdown","value":"`Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).\n\nSee the [module documentation](self) for details."},"deprecated":false,"sortText":"ffffffef","filterText":"Result","textEdit":{"newText":"Result","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"RustcDecodable","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"RustcDecodable","textEdit":{"newText":"RustcDecodable","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"RustcEncodable","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"RustcEncodable","textEdit":{"newText":"RustcEncodable","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Some(…)","kind":20,"detail":"Some(T)","documentation":{"kind":"markdown","value":"Some value of type `T`."},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"Some()","insertTextFormat":2,"textEdit":{"newText":"Some(${1:()})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"String","kind":22,"documentation":{"kind":"markdown","value":"A UTF-8–encoded, growable string.\n\nThe `String` type is the most common string type that has ownership over the\ncontents of the string. It has a close relationship with its borrowed\ncounterpart, the primitive [`str`].\n\n# Examples\n\nYou can create a `String` from [a literal string][`&str`] with [`String::from`]:\n\n[`String::from`]: From::from\n\n```rust\nlet hello = String::from(\"Hello, world!\");\n```\n\nYou can append a [`char`] to a `String` with the [`push`] method, and\nappend a [`&str`] with the [`push_str`] method:\n\n```rust\nlet mut hello = String::from(\"Hello, \");\n\nhello.push('w');\nhello.push_str(\"orld!\");\n```\n\n[`push`]: String::push\n[`push_str`]: String::push_str\n\nIf you have a vector of UTF-8 bytes, you can create a `String` from it with\nthe [`from_utf8`] method:\n\n```rust\n// some bytes, in a vector\nlet sparkle_heart = vec![240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `unwrap()`.\nlet sparkle_heart = String::from_utf8(sparkle_heart).unwrap();\n\nassert_eq!(\"💖\", sparkle_heart);\n```\n\n[`from_utf8`]: String::from_utf8\n\n# UTF-8\n\n`String`s are always valid UTF-8. If you need a non-UTF-8 string, consider\n[`OsString`]. It is similar, but without the UTF-8 constraint. Because UTF-8\nis a variable width encoding, `String`s are typically smaller than an array of\nthe same `chars`:\n\n```rust\nuse std::mem;\n\n// `s` is ASCII which represents each `char` as one byte\nlet s = \"hello\";\nassert_eq!(s.len(), 5);\n\n// A `char` array with the same contents would be longer because\n// every `char` is four bytes\nlet s = ['h', 'e', 'l', 'l', 'o'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n\n// However, for non-ASCII strings, the difference will be smaller\n// and sometimes they are the same\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.len(), 20);\n\nlet s = ['💖', '💖', '💖', '💖', '💖'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n```\n\nThis raises interesting questions as to how `s[i]` should work.\nWhat should `i` be here? Several options include byte indices and\n`char` indices but, because of UTF-8 encoding, only byte indices\nwould provide constant time indexing. Getting the `i`th `char`, for\nexample, is available using [`chars`]:\n\n```rust\nlet s = \"hello\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('l'));\n\nlet s = \"💖💖💖💖💖\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('💖'));\n```\n\nNext, what should `s[i]` return? Because indexing returns a reference\nto underlying data it could be `&u8`, `&[u8]`, or something else similar.\nSince we're only providing one index, `&u8` makes the most sense but that\nmight not be what the user expects and can be explicitly achieved with\n[`as_bytes()`]:\n\n```rust\n// The first byte is 104 - the byte value of `'h'`\nlet s = \"hello\";\nassert_eq!(s.as_bytes()[0], 104);\n// or\nassert_eq!(s.as_bytes()[0], b'h');\n\n// The first byte is 240 which isn't obviously useful\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.as_bytes()[0], 240);\n```\n\nDue to these ambiguities/restrictions, indexing with a `usize` is simply\nforbidden:\n\n```rust\nlet s = \"hello\";\n\n// The following will not compile!\nprintln!(\"The first letter of s is {}\", s[0]);\n```\n\nIt is more clear, however, how `&s[i..j]` should work (that is,\nindexing with a range). It should accept byte indices (to be constant-time)\nand return a `&str` which is UTF-8 encoded. This is also called \"string slicing\".\nNote this will panic if the byte indices provided are not character\nboundaries - see [`is_char_boundary`] for more details. See the implementations\nfor [`SliceIndex`] for more details on string slicing. For a non-panicking\nversion of string slicing, see [`get`].\n\n[`OsString`]: ../../std/ffi/struct.OsString.html \"ffi::OsString\"\n[`SliceIndex`]: core::slice::SliceIndex\n[`as_bytes()`]: str::as_bytes\n[`get`]: str::get\n[`is_char_boundary`]: str::is_char_boundary\n\nThe [`bytes`] and [`chars`] methods return iterators over the bytes and\ncodepoints of the string, respectively. To iterate over codepoints along\nwith byte indices, use [`char_indices`].\n\n[`bytes`]: str::bytes\n[`chars`]: str::chars\n[`char_indices`]: str::char_indices\n\n# Deref\n\n`String` implements [Deref], and so inherits all of [`str`]'s\nmethods. In addition, this means that you can pass a `String` to a\nfunction which takes a [`&str`] by using an ampersand (`&`):\n\n```rust\nfn takes_str(s: &str) { }\n\nlet s = String::from(\"Hello\");\n\ntakes_str(&s);\n```\n\nThis will create a [`&str`] from the `String` and pass it in. This\nconversion is very inexpensive, and so generally, functions will accept\n[`&str`]s as arguments unless they need a `String` for some specific\nreason.\n\nIn certain cases Rust doesn't have enough information to make this\nconversion, known as [`Deref`] coercion. In the following example a string\nslice [`&'a str`][`&str`] implements the trait `TraitExample`, and the function\n`example_func` takes anything that implements the trait. In this case Rust\nwould need to make two implicit conversions, which Rust doesn't have the\nmeans to do. For that reason, the following example will not compile.\n\n```rust\ntrait TraitExample {}\n\nimpl<'a> TraitExample for &'a str {}\n\nfn example_func(example_arg: A) {}\n\nlet example_string = String::from(\"example_string\");\nexample_func(&example_string);\n```\n\nThere are two options that would work instead. The first would be to\nchange the line `example_func(&example_string);` to\n`example_func(example_string.as_str());`, using the method [`as_str()`]\nto explicitly extract the string slice containing the string. The second\nway changes `example_func(&example_string);` to\n`example_func(&*example_string);`. In this case we are dereferencing a\n`String` to a [`str`], then referencing the [`str`] back to\n[`&str`]. The second way is more idiomatic, however both work to do the\nconversion explicitly rather than relying on the implicit conversion.\n\n# Representation\n\nA `String` is made up of three components: a pointer to some bytes, a\nlength, and a capacity. The pointer points to an internal buffer `String`\nuses to store its data. The length is the number of bytes currently stored\nin the buffer, and the capacity is the size of the buffer in bytes. As such,\nthe length will always be less than or equal to the capacity.\n\nThis buffer is always stored on the heap.\n\nYou can look at these with the [`as_ptr`], [`len`], and [`capacity`]\nmethods:\n\n```rust\nuse std::mem;\n\nlet story = String::from(\"Once upon a time...\");\n\n// Prevent automatically dropping the String's data\nlet mut story = mem::ManuallyDrop::new(story);\n\nlet ptr = story.as_mut_ptr();\nlet len = story.len();\nlet capacity = story.capacity();\n\n// story has nineteen bytes\nassert_eq!(19, len);\n\n// We can re-build a String out of ptr, len, and capacity. This is all\n// unsafe because we are responsible for making sure the components are\n// valid:\nlet s = unsafe { String::from_raw_parts(ptr, len, capacity) } ;\n\nassert_eq!(String::from(\"Once upon a time...\"), s);\n```\n\n[`as_ptr`]: str::as_ptr\n[`len`]: String::len\n[`capacity`]: String::capacity\n\nIf a `String` has enough capacity, adding elements to it will not\nre-allocate. For example, consider this program:\n\n```rust\nlet mut s = String::new();\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\nThis will output the following:\n\n```text\n0\n8\n16\n16\n32\n32\n```\n\nAt first, we have no memory allocated at all, but as we append to the\nstring, it increases its capacity appropriately. If we instead use the\n[`with_capacity`] method to allocate the correct capacity initially:\n\n```rust\nlet mut s = String::with_capacity(25);\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\n[`with_capacity`]: String::with_capacity\n\nWe end up with a different output:\n\n```text\n25\n25\n25\n25\n25\n25\n```\n\nHere, there's no need to allocate more memory inside the loop.\n\n[str]: prim@str \"str\"\n[`str`]: prim@str \"str\"\n[`&str`]: prim@str \"&str\"\n[Deref]: core::ops::Deref \"ops::Deref\"\n[`Deref`]: core::ops::Deref \"ops::Deref\"\n[`as_str()`]: String::as_str"},"deprecated":false,"sortText":"ffffffef","filterText":"String","textEdit":{"newText":"String","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"ToOwned","kind":8,"documentation":{"kind":"markdown","value":"A generalization of `Clone` to borrowed data.\n\nSome types make it possible to go from borrowed to owned, usually by\nimplementing the `Clone` trait. But `Clone` works only for going from `&T`\nto `T`. The `ToOwned` trait generalizes `Clone` to construct owned data\nfrom any borrow of a given type."},"deprecated":false,"sortText":"ffffffef","filterText":"ToOwned","textEdit":{"newText":"ToOwned","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"ToString","kind":8,"documentation":{"kind":"markdown","value":"A trait for converting a value to a `String`.\n\nThis trait is automatically implemented for any type which implements the\n[`Display`] trait. As such, `ToString` shouldn't be implemented directly:\n[`Display`] should be implemented instead, and you get the `ToString`\nimplementation for free.\n\n[`Display`]: fmt::Display"},"deprecated":false,"sortText":"ffffffef","filterText":"ToString","textEdit":{"newText":"ToString","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"TryFrom","kind":8,"documentation":{"kind":"markdown","value":"Simple and safe type conversions that may fail in a controlled\nway under some circumstances. It is the reciprocal of [`TryInto`].\n\nThis is useful when you are doing a type conversion that may\ntrivially succeed but may also need special handling.\nFor example, there is no way to convert an [`i64`] into an [`i32`]\nusing the [`From`] trait, because an [`i64`] may contain a value\nthat an [`i32`] cannot represent and so the conversion would lose data.\nThis might be handled by truncating the [`i64`] to an [`i32`] or by\nsimply returning [`i32::MAX`], or by some other method. The [`From`]\ntrait is intended for perfect conversions, so the `TryFrom` trait\ninforms the programmer when a type conversion could go bad and lets\nthem decide how to handle it.\n\n# Generic Implementations\n\n- `TryFrom for U` implies [`TryInto`]` for T`\n- [`try_from`] is reflexive, which means that `TryFrom for T`\nis implemented and cannot fail -- the associated `Error` type for\ncalling `T::try_from()` on a value of type `T` is [`Infallible`].\nWhen the [`!`] type is stabilized [`Infallible`] and [`!`] will be\nequivalent.\n\n`TryFrom` can be implemented as follows:\n\n```rust\nstruct GreaterThanZero(i32);\n\nimpl TryFrom for GreaterThanZero {\n type Error = &'static str;\n\n fn try_from(value: i32) -> Result {\n if value <= 0 {\n Err(\"GreaterThanZero only accepts values greater than zero!\")\n } else {\n Ok(GreaterThanZero(value))\n }\n }\n}\n```\n\n# Examples\n\nAs described, [`i32`] implements `TryFrom<`[`i64`]`>`:\n\n```rust\nlet big_number = 1_000_000_000_000i64;\n// Silently truncates `big_number`, requires detecting\n// and handling the truncation after the fact.\nlet smaller_number = big_number as i32;\nassert_eq!(smaller_number, -727379968);\n\n// Returns an error because `big_number` is too big to\n// fit in an `i32`.\nlet try_smaller_number = i32::try_from(big_number);\nassert!(try_smaller_number.is_err());\n\n// Returns `Ok(3)`.\nlet try_successful_smaller_number = i32::try_from(3);\nassert!(try_successful_smaller_number.is_ok());\n```\n\n[`try_from`]: TryFrom::try_from"},"deprecated":false,"sortText":"ffffffef","filterText":"TryFrom","textEdit":{"newText":"TryFrom","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"TryInto","kind":8,"documentation":{"kind":"markdown","value":"An attempted conversion that consumes `self`, which may or may not be\nexpensive.\n\nLibrary authors should usually not directly implement this trait,\nbut should prefer implementing the [`TryFrom`] trait, which offers\ngreater flexibility and provides an equivalent `TryInto`\nimplementation for free, thanks to a blanket implementation in the\nstandard library. For more information on this, see the\ndocumentation for [`Into`].\n\n# Implementing `TryInto`\n\nThis suffers the same restrictions and reasoning as implementing\n[`Into`], see there for details."},"deprecated":false,"sortText":"ffffffef","filterText":"TryInto","textEdit":{"newText":"TryInto","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"Vec","kind":22,"documentation":{"kind":"markdown","value":"A contiguous growable array type, written as `Vec`, short for 'vector'.\n\n# Examples\n\n```rust\nlet mut vec = Vec::new();\nvec.push(1);\nvec.push(2);\n\nassert_eq!(vec.len(), 2);\nassert_eq!(vec[0], 1);\n\nassert_eq!(vec.pop(), Some(2));\nassert_eq!(vec.len(), 1);\n\nvec[0] = 7;\nassert_eq!(vec[0], 7);\n\nvec.extend([1, 2, 3]);\n\nfor x in &vec {\n println!(\"{x}\");\n}\nassert_eq!(vec, [7, 1, 2, 3]);\n```\n\nThe [`vec!`] macro is provided for convenient initialization:\n\n```rust\nlet mut vec1 = vec![1, 2, 3];\nvec1.push(4);\nlet vec2 = Vec::from([1, 2, 3, 4]);\nassert_eq!(vec1, vec2);\n```\n\nIt can also initialize each element of a `Vec` with a given value.\nThis may be more efficient than performing allocation and initialization\nin separate steps, especially when initializing a vector of zeros:\n\n```rust\nlet vec = vec![0; 5];\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n\n// The following is equivalent, but potentially slower:\nlet mut vec = Vec::with_capacity(5);\nvec.resize(5, 0);\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n```\n\nFor more information, see\n[Capacity and Reallocation](#capacity-and-reallocation).\n\nUse a `Vec` as an efficient stack:\n\n```rust\nlet mut stack = Vec::new();\n\nstack.push(1);\nstack.push(2);\nstack.push(3);\n\nwhile let Some(top) = stack.pop() {\n // Prints 3, 2, 1\n println!(\"{top}\");\n}\n```\n\n# Indexing\n\nThe `Vec` type allows access to values by index, because it implements the\n[`Index`] trait. An example will be more explicit:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[1]); // it will display '2'\n```\n\nHowever be careful: if you try to access an index which isn't in the `Vec`,\nyour software will panic! You cannot do this:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[6]); // it will panic!\n```\n\nUse [`get`] and [`get_mut`] if you want to check whether the index is in\nthe `Vec`.\n\n# Slicing\n\nA `Vec` can be mutable. On the other hand, slices are read-only objects.\nTo get a [slice][prim@slice], use [`&`]. Example:\n\n```rust\nfn read_slice(slice: &[usize]) {\n // ...\n}\n\nlet v = vec![0, 1];\nread_slice(&v);\n\n// ... and that's all!\n// you can also do it like this:\nlet u: &[usize] = &v;\n// or like this:\nlet u: &[_] = &v;\n```\n\nIn Rust, it's more common to pass slices as arguments rather than vectors\nwhen you just want to provide read access. The same goes for [`String`] and\n[`&str`].\n\n# Capacity and reallocation\n\nThe capacity of a vector is the amount of space allocated for any future\nelements that will be added onto the vector. This is not to be confused with\nthe *length* of a vector, which specifies the number of actual elements\nwithin the vector. If a vector's length exceeds its capacity, its capacity\nwill automatically be increased, but its elements will have to be\nreallocated.\n\nFor example, a vector with capacity 10 and length 0 would be an empty vector\nwith space for 10 more elements. Pushing 10 or fewer elements onto the\nvector will not change its capacity or cause reallocation to occur. However,\nif the vector's length is increased to 11, it will have to reallocate, which\ncan be slow. For this reason, it is recommended to use [`Vec::with_capacity`]\nwhenever possible to specify how big the vector is expected to get.\n\n# Guarantees\n\nDue to its incredibly fundamental nature, `Vec` makes a lot of guarantees\nabout its design. This ensures that it's as low-overhead as possible in\nthe general case, and can be correctly manipulated in primitive ways\nby unsafe code. Note that these guarantees refer to an unqualified `Vec`.\nIf additional type parameters are added (e.g., to support custom allocators),\noverriding their defaults may change the behavior.\n\nMost fundamentally, `Vec` is and always will be a (pointer, capacity, length)\ntriplet. No more, no less. The order of these fields is completely\nunspecified, and you should use the appropriate methods to modify these.\nThe pointer will never be null, so this type is null-pointer-optimized.\n\nHowever, the pointer might not actually point to allocated memory. In particular,\nif you construct a `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],\n[`Vec::with_capacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]\non an empty Vec, it will not allocate memory. Similarly, if you store zero-sized\ntypes inside a `Vec`, it will not allocate space for them. *Note that in this case\nthe `Vec` might not report a [`capacity`] of 0*. `Vec` will allocate if and only\nif [mem::size_of::\\]\\() * [capacity]\\() > 0. In general, `Vec`'s allocation\ndetails are very subtle --- if you intend to allocate memory using a `Vec`\nand use it for something else (either to pass to unsafe code, or to build your\nown memory-backed collection), be sure to deallocate this memory by using\n`from_raw_parts` to recover the `Vec` and then dropping it.\n\nIf a `Vec` *has* allocated memory, then the memory it points to is on the heap\n(as defined by the allocator Rust is configured to use by default), and its\npointer points to [`len`] initialized, contiguous elements in order (what\nyou would see if you coerced it to a slice), followed by [capacity] - [len]\nlogically uninitialized, contiguous elements.\n\nA vector containing the elements `'a'` and `'b'` with capacity 4 can be\nvisualized as below. The top part is the `Vec` struct, it contains a\npointer to the head of the allocation in the heap, length and capacity.\nThe bottom part is the allocation on the heap, a contiguous memory block.\n\n```text\n ptr len capacity\n +--------+--------+--------+\n | 0x0123 | 2 | 4 |\n +--------+--------+--------+\n |\n v\nHeap +--------+--------+--------+--------+\n | 'a' | 'b' | uninit | uninit |\n +--------+--------+--------+--------+\n```\n\n- **uninit** represents memory that is not initialized, see [`MaybeUninit`].\n- Note: the ABI is not stable and `Vec` makes no guarantees about its memory\n layout (including the order of fields).\n\n`Vec` will never perform a \"small optimization\" where elements are actually\nstored on the stack for two reasons:\n\n* It would make it more difficult for unsafe code to correctly manipulate\n a `Vec`. The contents of a `Vec` wouldn't have a stable address if it were\n only moved, and it would be more difficult to determine if a `Vec` had\n actually allocated memory.\n\n* It would penalize the general case, incurring an additional branch\n on every access.\n\n`Vec` will never automatically shrink itself, even if completely empty. This\nensures no unnecessary allocations or deallocations occur. Emptying a `Vec`\nand then filling it back up to the same [`len`] should incur no calls to\nthe allocator. If you wish to free up unused memory, use\n[`shrink_to_fit`] or [`shrink_to`].\n\n[`push`] and [`insert`] will never (re)allocate if the reported capacity is\nsufficient. [`push`] and [`insert`] *will* (re)allocate if\n[len] == [capacity]. That is, the reported capacity is completely\naccurate, and can be relied on. It can even be used to manually free the memory\nallocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even\nwhen not necessary.\n\n`Vec` does not guarantee any particular growth strategy when reallocating\nwhen full, nor when [`reserve`] is called. The current strategy is basic\nand it may prove desirable to use a non-constant growth factor. Whatever\nstrategy is used will of course guarantee *O*(1) amortized [`push`].\n\n`vec![x; n]`, `vec![a, b, c, d]`, and\n[`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`\nwith exactly the requested capacity. If [len] == [capacity],\n(as is the case for the [`vec!`] macro), then a `Vec` can be converted to\nand from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.\n\n`Vec` will not specifically overwrite any data that is removed from it,\nbut also won't specifically preserve it. Its uninitialized memory is\nscratch space that it may use however it wants. It will generally just do\nwhatever is most efficient or otherwise easy to implement. Do not rely on\nremoved data to be erased for security purposes. Even if you drop a `Vec`, its\nbuffer may simply be reused by another allocation. Even if you zero a `Vec`'s memory\nfirst, that might not actually happen because the optimizer does not consider\nthis a side-effect that must be preserved. There is one case which we will\nnot break, however: using `unsafe` code to write to the excess capacity,\nand then increasing the length to match, is always valid.\n\nCurrently, `Vec` does not guarantee the order in which elements are dropped.\nThe order has changed in the past and may change again.\n\n[`get`]: slice::get\n[`get_mut`]: slice::get_mut\n[`String`]: crate::string::String\n[`&str`]: type@str\n[`shrink_to_fit`]: Vec::shrink_to_fit\n[`shrink_to`]: Vec::shrink_to\n[capacity]: Vec::capacity\n[`capacity`]: Vec::capacity\n[mem::size_of::\\]: core::mem::size_of\n[len]: Vec::len\n[`len`]: Vec::len\n[`push`]: Vec::push\n[`insert`]: Vec::insert\n[`reserve`]: Vec::reserve\n[`MaybeUninit`]: core::mem::MaybeUninit\n[owned slice]: Box"},"deprecated":false,"sortText":"ffffffef","filterText":"Vec","textEdit":{"newText":"Vec","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"alloc_error_handler","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"alloc_error_handler","textEdit":{"newText":"alloc_error_handler","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"drop(…)","kind":3,"detail":"fn(T)","documentation":{"kind":"markdown","value":"Disposes of a value.\n\nThis does so by calling the argument's implementation of [`Drop`][drop].\n\nThis effectively does nothing for types which implement `Copy`, e.g.\nintegers. Such values are copied and _then_ moved into the function, so the\nvalue persists after this function call.\n\nThis function is not magic; it is literally defined as\n\n```rust\npub fn drop(_x: T) {}\n```\n\nBecause `_x` is moved into the function, it is automatically dropped before\nthe function returns.\n\n[drop]: Drop\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = vec![1, 2, 3];\n\ndrop(v); // explicitly drop the vector\n```\n\nSince [`RefCell`] enforces the borrow rules at runtime, `drop` can\nrelease a [`RefCell`] borrow:\n\n```rust\nuse std::cell::RefCell;\n\nlet x = RefCell::new(1);\n\nlet mut mutable_borrow = x.borrow_mut();\n*mutable_borrow = 1;\n\ndrop(mutable_borrow); // relinquish the mutable borrow on this slot\n\nlet borrow = x.borrow();\nprintln!(\"{}\", *borrow);\n```\n\nIntegers and other types implementing [`Copy`] are unaffected by `drop`.\n\n```rust\n#[derive(Copy, Clone)]\nstruct Foo(u8);\n\nlet x = 1;\nlet y = Foo(2);\ndrop(x); // a copy of `x` is moved and dropped\ndrop(y); // a copy of `y` is moved and dropped\n\nprintln!(\"x: {}, y: {}\", x, y.0); // still available\n```\n\n[`RefCell`]: crate::cell::RefCell"},"deprecated":false,"preselect":true,"sortText":"ffffffec","filterText":"drop","insertTextFormat":2,"textEdit":{"newText":"drop(${1:x})$0","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[],"command":{"title":"triggerParameterHints","command":"rust-analyzer.triggerParameterHints"}},{"label":"type_ascribe","kind":18,"deprecated":false,"sortText":"ffffffef","filterText":"type_ascribe","textEdit":{"newText":"type_ascribe","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"unsafe","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"unsafe","insertTextFormat":2,"textEdit":{"newText":"unsafe {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"match","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"match","insertTextFormat":2,"textEdit":{"newText":"match $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"while","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"while","insertTextFormat":2,"textEdit":{"newText":"while $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"while let","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"while let","insertTextFormat":2,"textEdit":{"newText":"while let $1 = $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"loop","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"loop","insertTextFormat":2,"textEdit":{"newText":"loop {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"if","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"if","insertTextFormat":2,"textEdit":{"newText":"if $1 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"if let","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"if let","insertTextFormat":2,"textEdit":{"newText":"if let $1 = $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"for","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"for","insertTextFormat":2,"textEdit":{"newText":"for $1 in $2 {\n $0\n};","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"true","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"true","insertTextFormat":2,"textEdit":{"newText":"true","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"false","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"false","insertTextFormat":2,"textEdit":{"newText":"false","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]},{"label":"return","kind":14,"deprecated":false,"sortText":"ffffffef","filterText":"return","insertTextFormat":2,"textEdit":{"newText":"return","insert":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}},"replace":{"start":{"line":1,"character":12},"end":{"line":1,"character":25}}},"additionalTextEdits":[]}]}} 2023-12-27T20:29:12.380 helix_lsp::transport [INFO] rust-analyzer <- {"isIncomplete":true,"items":[{"additionalTextEdits":[],"deprecated":false,"filterText":"self::","kind":14,"label":"self::","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"self::","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"crate::","kind":14,"label":"crate::","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"crate::","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"fn()","filterText":"main","insertTextFormat":2,"kind":3,"label":"main()","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"main()$0","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! panic","filterText":"panic!","insertTextFormat":2,"kind":3,"label":"panic!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"panic!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! println","documentation":{"kind":"markdown","value":"Prints to the standard output, with a newline.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`)).\n\nThis macro uses the same syntax as [`format!`], but writes to the standard output instead.\nSee [`std::fmt`] for more information.\n\nThe `println!` macro will lock the standard output on each call. If you call\n`println!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwriteln!(lock, \"hello world\").unwrap();\n```\n\nUse `println!` only for the primary output of your program. Use\n[`eprintln!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`std::fmt`]: crate::fmt\n[`eprintln!`]: crate::eprintln\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to [`io::stdout`] fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n[`io::stdout`]: crate::io::stdout\n\n# Examples\n\n```rust\nprintln!(); // prints just a newline\nprintln!(\"hello there!\");\nprintln!(\"format {} arguments\", \"some\");\nlet local_variable = \"some\";\nprintln!(\"format {local_variable} arguments\");\n```"},"filterText":"println!","insertTextFormat":2,"kind":3,"label":"println!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"println!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_eq!`], `debug_assert_eq!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_eq!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_eq!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_eq!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\ndebug_assert_eq!(a, b);\n```"},"filterText":"debug_assert_eq!","insertTextFormat":2,"kind":3,"label":"debug_assert_eq!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert_eq!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include_str","documentation":{"kind":"markdown","value":"Includes a UTF-8 encoded file as a string.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static str` which is the\ncontents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_str = include_str!(\"spanish.in\");\n assert_eq!(my_str, \"adiós\\n\");\n print!(\"{my_str}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"filterText":"include_str!","insertTextFormat":2,"kind":3,"label":"include_str!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"include_str!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat","documentation":{"kind":"markdown","value":"Concatenates literals into a static string slice.\n\nThis macro takes any number of comma-separated literals, yielding an\nexpression of type `&'static str` which represents all of the literals\nconcatenated left-to-right.\n\nInteger and floating point literals are [stringified](core::stringify) in order to be\nconcatenated.\n\n# Examples\n\n```rust\nlet s = concat!(\"test\", 10, 'b', true);\nassert_eq!(s, \"test10btrue\");\n```"},"filterText":"concat!","insertTextFormat":2,"kind":3,"label":"concat!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"concat!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format","documentation":{"kind":"markdown","value":"Creates a `String` using interpolation of runtime expressions.\n\nThe first argument `format!` receives is a format string. This must be a string\nliteral. The power of the formatting string is in the `{}`s contained.\nAdditional parameters passed to `format!` replace the `{}`s within the\nformatting string in the order given unless named or positional parameters\nare used.\n\nSee [the formatting syntax documentation in `std::fmt`](../std/fmt/index.html)\nfor details.\n\nA common use for `format!` is concatenation and interpolation of strings.\nThe same convention is used with [`print!`] and [`write!`] macros,\ndepending on the intended destination of the string; all these macros internally use [`format_args!`].\n\nTo convert a single value to a string, use the [`to_string`] method. This\nwill use the [`Display`] formatting trait.\n\nTo concatenate literals into a `&'static str`, use the [`concat!`] macro.\n\n[`print!`]: ../std/macro.print.html\n[`write!`]: core::write\n[`format_args!`]: core::format_args\n[`to_string`]: crate::string::ToString\n[`Display`]: core::fmt::Display\n[`concat!`]: core::concat\n\n# Panics\n\n`format!` panics if a formatting trait implementation returns an error.\nThis indicates an incorrect implementation\nsince `fmt::Write for String` never returns an error itself.\n\n# Examples\n\n```rust\nformat!(\"test\"); // => \"test\"\nformat!(\"hello {}\", \"world!\"); // => \"hello world!\"\nformat!(\"x = {}, y = {val}\", 10, val = 30); // => \"x = 10, y = 30\"\nlet (x, y) = (1, 2);\nformat!(\"{x} + {y} = 3\"); // => \"1 + 2 = 3\"\n```"},"filterText":"format!","insertTextFormat":2,"kind":3,"label":"format!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"format!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! log_syntax","documentation":{"kind":"markdown","value":"Prints passed tokens into the standard output."},"filterText":"log_syntax!","insertTextFormat":2,"kind":3,"label":"log_syntax!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"log_syntax!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! stringify","documentation":{"kind":"markdown","value":"Stringifies its arguments.\n\nThis macro will yield an expression of type `&'static str` which is the\nstringification of all the tokens passed to the macro. No restrictions\nare placed on the syntax of the macro invocation itself.\n\nNote that the expanded results of the input tokens may change in the\nfuture. You should be careful if you rely on the output.\n\n# Examples\n\n```rust\nlet one_plus_one = stringify!(1 + 1);\nassert_eq!(one_plus_one, \"1 + 1\");\n```"},"filterText":"stringify!","insertTextFormat":2,"kind":3,"label":"stringify!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"stringify!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\nassert_ne!(a, b);\n\nassert_ne!(a, b, \"we are testing that the values are not equal\");\n```"},"filterText":"assert_ne!","insertTextFormat":2,"kind":3,"label":"assert_ne!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"assert_ne!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! dbg","documentation":{"kind":"markdown","value":"Prints and returns the value of a given expression for quick and dirty\ndebugging.\n\nAn example:\n\n```rust\nlet a = 2;\nlet b = dbg!(a * 2) + 1;\n// ^-- prints: [src/main.rs:2] a * 2 = 4\nassert_eq!(b, 5);\n```\n\nThe macro works by using the `Debug` implementation of the type of\nthe given expression to print the value to [stderr] along with the\nsource location of the macro invocation as well as the source code\nof the expression.\n\nInvoking the macro on an expression moves and takes ownership of it\nbefore returning the evaluated expression unchanged. If the type\nof the expression does not implement `Copy` and you don't want\nto give up ownership, you can instead borrow with `dbg!(&expr)`\nfor some expression `expr`.\n\nThe `dbg!` macro works exactly the same in release builds.\nThis is useful when debugging issues that only occur in release\nbuilds or when debugging in release mode is significantly faster.\n\nNote that the macro is intended as a debugging tool and therefore you\nshould avoid having uses of it in version control for long periods\n(other than in tests and similar).\nDebug output from production code is better done with other facilities\nsuch as the [`debug!`] macro from the [`log`] crate.\n\n# Stability\n\nThe exact output printed by this macro should not be relied upon\nand is subject to future changes.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\n# Further examples\n\nWith a method call:\n\n```rust\nfn foo(n: usize) {\n if let Some(_) = dbg!(n.checked_sub(4)) {\n // ...\n }\n}\n\nfoo(3)\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:4] n.checked_sub(4) = None\n```\n\nNaive factorial implementation:\n\n```rust\nfn factorial(n: u32) -> u32 {\n if dbg!(n <= 1) {\n dbg!(1)\n } else {\n dbg!(n * factorial(n - 1))\n }\n}\n\ndbg!(factorial(4));\n```\n\nThis prints to [stderr]:\n\n```text,ignore\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = false\n[src/main.rs:3] n <= 1 = true\n[src/main.rs:4] 1 = 1\n[src/main.rs:5] n * factorial(n - 1) = 2\n[src/main.rs:5] n * factorial(n - 1) = 6\n[src/main.rs:5] n * factorial(n - 1) = 24\n[src/main.rs:11] factorial(4) = 24\n```\n\nThe `dbg!(..)` macro moves the input:\n\n```rust\n/// A wrapper around `usize` which importantly is not Copyable.\n#[derive(Debug)]\nstruct NoCopy(usize);\n\nlet a = NoCopy(42);\nlet _ = dbg!(a); // <-- `a` is moved here.\nlet _ = dbg!(a); // <-- `a` is moved again; error!\n```\n\nYou can also use `dbg!()` without a value to just print the\nfile and line whenever it's reached.\n\nFinally, if you want to `dbg!(..)` multiple values, it will treat them as\na tuple (and return it, too):\n\n```rust\nassert_eq!(dbg!(1usize, 2u32), (1, 2));\n```\n\nHowever, a single argument with a trailing comma will still not be treated\nas a tuple, following the convention of ignoring trailing commas in macro\ninvocations. You can use a 1-tuple directly if you need one:\n\n```rust\nassert_eq!(1, dbg!(1u32,)); // trailing comma ignored\nassert_eq!((1,), dbg!((1u32,))); // 1-tuple\n```\n\n[stderr]: https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)\n[`debug!`]: https://docs.rs/log/*/log/macro.debug.html\n[`log`]: https://crates.io/crates/log"},"filterText":"dbg!","insertTextFormat":2,"kind":3,"label":"dbg!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"dbg!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! vec","documentation":{"kind":"markdown","value":"Creates a [`Vec`] containing the arguments.\n\n`vec!` allows `Vec`s to be defined with the same syntax as array expressions.\nThere are two forms of this macro:\n\n- Create a [`Vec`] containing a given list of elements:\n\n```rust\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```\n\n- Create a [`Vec`] from a given element and size:\n\n```rust\nlet v = vec![1; 3];\nassert_eq!(v, [1, 1, 1]);\n```\n\nNote that unlike array expressions this syntax supports all elements\nwhich implement [`Clone`] and the number of elements doesn't have to be\na constant.\n\nThis will use `clone` to duplicate an expression, so one should be careful\nusing this with types having a nonstandard `Clone` implementation. For\nexample, `vec![Rc::new(1); 5]` will create a vector of five references\nto the same boxed integer value, not five references pointing to independently\nboxed integers.\n\nAlso, note that `vec![expr; 0]` is allowed, and produces an empty vector.\nThis will still evaluate `expr`, however, and immediately drop the resulting value, so\nbe mindful of side effects.\n\n[`Vec`]: crate::vec::Vec"},"filterText":"vec!","insertTextFormat":2,"kind":3,"label":"vec![…]","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"vec![$0]","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include","documentation":{"kind":"markdown","value":"Parses a file as an expression or an item according to the context.\n\n**Warning**: For multi-file Rust projects, the `include!` macro is probably not what you\nare looking for. Usually, multi-file Rust projects use\n[modules](https://doc.rust-lang.org/reference/items/modules.html). Multi-file projects and\nmodules are explained in the Rust-by-Example book\n[here](https://doc.rust-lang.org/rust-by-example/mod/split.html) and the module system is\nexplained in the Rust Book\n[here](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html).\n\nThe included file is placed in the surrounding code\n[unhygienically](https://doc.rust-lang.org/reference/macros-by-example.html#hygiene). If\nthe included file is parsed as an expression and variables or functions share names across\nboth files, it could result in variables or functions being different from what the\nincluded file expected.\n\nThe included file is located relative to the current file (similarly to how modules are\nfound). The provided path is interpreted in a platform-specific way at compile time. So,\nfor instance, an invocation with a Windows path containing backslashes `\\` would not\ncompile correctly on Unix.\n\n# Uses\n\nThe `include!` macro is primarily used for two purposes. It is used to include\ndocumentation that is written in a separate file and it is used to include [build artifacts\nusually as a result from the `build.rs`\nscript](https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script).\n\nWhen using the `include` macro to include stretches of documentation, remember that the\nincluded file still needs to be a valid rust syntax. It is also possible to\nuse the [`include_str`] macro as `#![doc = include_str!(\"...\")]` (at the module level) or\n`#[doc = include_str!(\"...\")]` (at the item level) to include documentation from a plain\ntext or markdown file.\n\n# Examples\n\nAssume there are two files in the same directory with the following contents:\n\nFile 'monkeys.in':\n\n```rust\n['🙈', '🙊', '🙉']\n .iter()\n .cycle()\n .take(6)\n .collect::()\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let my_string = include!(\"monkeys.in\");\n assert_eq!(\"🙈🙊🙉🙈🙊🙉\", my_string);\n println!(\"{my_string}\");\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print\n\"🙈🙊🙉🙈🙊🙉\"."},"filterText":"include!","insertTextFormat":2,"kind":3,"label":"include!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"include!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! print","documentation":{"kind":"markdown","value":"Prints to the standard output.\n\nEquivalent to the [`println!`] macro except that a newline is not printed at\nthe end of the message.\n\nNote that stdout is frequently line-buffered by default so it may be\nnecessary to use [`io::stdout().flush()`][flush] to ensure the output is emitted\nimmediately.\n\nThe `print!` macro will lock the standard output on each call. If you call\n`print!` within a hot loop, this behavior may be the bottleneck of the loop.\nTo avoid this, lock stdout with [`io::stdout().lock()`][lock]:\n```rust\nuse std::io::{stdout, Write};\n\nlet mut lock = stdout().lock();\nwrite!(lock, \"hello world\").unwrap();\n```\n\nUse `print!` only for the primary output of your program. Use\n[`eprint!`] instead to print error and progress messages.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[flush]: crate::io::Write::flush\n[`println!`]: crate::println\n[`eprint!`]: crate::eprint\n[lock]: crate::io::Stdout\n\n# Panics\n\nPanics if writing to `io::stdout()` fails.\n\nWriting to non-blocking stdout can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\nuse std::io::{self, Write};\n\nprint!(\"this \");\nprint!(\"will \");\nprint!(\"be \");\nprint!(\"on \");\nprint!(\"the \");\nprint!(\"same \");\nprint!(\"line \");\n\nio::stdout().flush().unwrap();\n\nprint!(\"this string has a newline, why not choose println! instead?\\n\");\n\nio::stdout().flush().unwrap();\n```"},"filterText":"print!","insertTextFormat":2,"kind":3,"label":"print!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"print!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro cfg_match","documentation":{"kind":"markdown","value":"A macro for defining `#[cfg]` match-like statements.\n\nIt is similar to the `if/elif` C preprocessor macro by allowing definition of a cascade of\n`#[cfg]` cases, emitting the implementation which matches first.\n\nThis allows you to conveniently provide a long list `#[cfg]`'d blocks of code\nwithout having to rewrite each clause multiple times.\n\nTrailing `_` wildcard match arms are **optional** and they indicate a fallback branch when\nall previous declarations do not evaluate to true.\n\n# Example\n\n```rust\n#![feature(cfg_match)]\n\ncfg_match! {\n cfg(unix) => {\n fn foo() { /* unix specific functionality */ }\n }\n cfg(target_pointer_width = \"32\") => {\n fn foo() { /* non-unix, 32-bit functionality */ }\n }\n _ => {\n fn foo() { /* fallback implementation */ }\n }\n}\n```"},"filterText":"cfg_match!","insertTextFormat":2,"kind":3,"label":"cfg_match! {…}","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"cfg_match! {$0}","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat_idents","documentation":{"kind":"markdown","value":"Concatenates identifiers into one identifier.\n\nThis macro takes any number of comma-separated identifiers, and\nconcatenates them all into one, yielding an expression which is a new\nidentifier. Note that hygiene makes it such that this macro cannot\ncapture local variables. Also, as a general rule, macros are only\nallowed in item, statement or expression position. That means while\nyou may use this macro for referring to existing variables, functions or\nmodules etc, you cannot define a new one with it.\n\n# Examples\n\n```rust\n#![feature(concat_idents)]\n\nfn foobar() -> u32 { 23 }\n\nlet f = concat_idents!(foo, bar);\nprintln!(\"{}\", f());\n\n// fn concat_idents!(new, fun, name) { } // not usable in this way!\n```"},"filterText":"concat_idents!","insertTextFormat":2,"kind":3,"label":"concat_idents!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"concat_idents!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! write","documentation":{"kind":"markdown","value":"Writes formatted data into a buffer.\n\nThis macro accepts a 'writer', a format string, and a list of arguments. Arguments will be\nformatted according to the specified format string and the result will be passed to the writer.\nThe writer may be any value with a `write_fmt` method; generally this comes from an\nimplementation of either the [`fmt::Write`] or the [`io::Write`] trait. The macro\nreturns whatever the `write_fmt` method returns; commonly a [`fmt::Result`], or an\n[`io::Result`].\n\nSee [`std::fmt`] for more information on the format string syntax.\n\n[`std::fmt`]: ../std/fmt/index.html\n[`fmt::Write`]: crate::fmt::Write\n[`io::Write`]: ../std/io/trait.Write.html\n[`fmt::Result`]: crate::fmt::Result\n[`io::Result`]: ../std/io/type.Result.html\n\n# Examples\n\n```rust\nuse std::io::Write;\n\nfn main() -> std::io::Result<()> {\n let mut w = Vec::new();\n write!(&mut w, \"test\")?;\n write!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(w, b\"testformatted arguments\");\n Ok(())\n}\n```\n\nA module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects\nimplementing either, as objects do not typically implement both. However, the module must\navoid conflict between the trait names, such as by importing them as `_` or otherwise renaming\nthem:\n\n```rust\nuse std::fmt::Write as _;\nuse std::io::Write as _;\n\nfn main() -> Result<(), Box> {\n let mut s = String::new();\n let mut v = Vec::new();\n\n write!(&mut s, \"{} {}\", \"abc\", 123)?; // uses fmt::Write::write_fmt\n write!(&mut v, \"s = {:?}\", s)?; // uses io::Write::write_fmt\n assert_eq!(v, b\"s = \\\"abc 123\\\"\");\n Ok(())\n}\n```\n\nIf you also need the trait names themselves, such as to implement one or both on your types,\nimport the containing module and then name them with a prefix:\n\n```rust\nuse std::fmt::{self, Write as _};\nuse std::io::{self, Write as _};\n\nstruct Example;\n\nimpl fmt::Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n```\n\nNote: This macro can be used in `no_std` setups as well.\nIn a `no_std` setup you are responsible for the implementation details of the components.\n\n```rust\nuse core::fmt::Write;\n\nstruct Example;\n\nimpl Write for Example {\n fn write_str(&mut self, _s: &str) -> core::fmt::Result {\n unimplemented!();\n }\n}\n\nlet mut m = Example{};\nwrite!(&mut m, \"Hello World\").expect(\"Not written\");\n```"},"filterText":"write!","insertTextFormat":2,"kind":3,"label":"write!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"write!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! line","documentation":{"kind":"markdown","value":"Expands to the line number on which it was invoked.\n\nWith [`column!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first line\nin each file evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned line is *not necessarily* the line of the `line!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `line!` macro.\n\n# Examples\n\n```rust\nlet current_line = line!();\nprintln!(\"defined on line: {current_line}\");\n```"},"filterText":"line!","insertTextFormat":2,"kind":3,"label":"line!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"line!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\nLike [`assert!`], this macro also has a second version, where a custom panic\nmessage can be provided.\n\n# Uses\n\nUnlike [`assert!`], `debug_assert!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert!` is always type checked.\n\nAn unchecked assertion allows a program in an inconsistent state to keep\nrunning, which might have unexpected consequences but does not introduce\nunsafety as long as this only happens in safe code. The performance cost\nof assertions, however, is not measurable in general. Replacing [`assert!`]\nwith `debug_assert!` is thus only encouraged after thorough profiling, and\nmore importantly, only in safe code!\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\ndebug_assert!(true);\n\nfn some_expensive_computation() -> bool { true } // a very simple function\ndebug_assert!(some_expensive_computation());\n\n// assert with a custom message\nlet x = true;\ndebug_assert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\ndebug_assert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"filterText":"debug_assert!","insertTextFormat":2,"kind":3,"label":"debug_assert!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! include_bytes","documentation":{"kind":"markdown","value":"Includes a file as a reference to a byte array.\n\nThe file is located relative to the current file (similarly to how\nmodules are found). The provided path is interpreted in a platform-specific\nway at compile time. So, for instance, an invocation with a Windows path\ncontaining backslashes `\\` would not compile correctly on Unix.\n\nThis macro will yield an expression of type `&'static [u8; N]` which is\nthe contents of the file.\n\n# Examples\n\nAssume there are two files in the same directory with the following\ncontents:\n\nFile 'spanish.in':\n\n```text\nadiós\n```\n\nFile 'main.rs':\n\n```rust\nfn main() {\n let bytes = include_bytes!(\"spanish.in\");\n assert_eq!(bytes, b\"adi\\xc3\\xb3s\\n\");\n print!(\"{}\", String::from_utf8_lossy(bytes));\n}\n```\n\nCompiling 'main.rs' and running the resulting binary will print \"adiós\"."},"filterText":"include_bytes!","insertTextFormat":2,"kind":3,"label":"include_bytes!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"include_bytes!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! const_format_args","documentation":{"kind":"markdown","value":"Same as [`format_args`], but can be used in some const contexts.\n\nThis macro is used by the panic macros for the `const_panic` feature.\n\nThis macro will be removed once `format_args` is allowed in const contexts."},"filterText":"const_format_args!","insertTextFormat":2,"kind":3,"label":"const_format_args!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"const_format_args!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! env","documentation":{"kind":"markdown","value":"Inspects an environment variable at compile time.\n\nThis macro will expand to the value of the named environment variable at\ncompile time, yielding an expression of type `&'static str`. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nIf the environment variable is not defined, then a compilation error\nwill be emitted. To not emit a compile error, use the [`option_env!`]\nmacro instead.\n\n# Examples\n\n```rust\nlet path: &'static str = env!(\"PATH\");\nprintln!(\"the $PATH variable at the time of compiling was: {path}\");\n```\n\nYou can customize the error message by passing a string as the second\nparameter:\n\n```rust\nlet doc: &'static str = env!(\"documentation\", \"what's that?!\");\n```\n\nIf the `documentation` environment variable is not defined, you'll get\nthe following error:\n\n```text\nerror: what's that?!\n```"},"filterText":"env!","insertTextFormat":2,"kind":3,"label":"env!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"env!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":true,"detail":"macro_rules! r#try","documentation":{"kind":"markdown","value":"Unwraps a result or propagates its error.\n\nThe [`?` operator][propagating-errors] was added to replace `try!`\nand should be used instead. Furthermore, `try` is a reserved word\nin Rust 2018, so if you must use it, you will need to use the\n[raw-identifier syntax][ris]: `r#try`.\n\n[propagating-errors]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator\n[ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html\n\n`try!` matches the given [`Result`]. In case of the `Ok` variant, the\nexpression has the value of the wrapped value.\n\nIn case of the `Err` variant, it retrieves the inner error. `try!` then\nperforms conversion using `From`. This provides automatic conversion\nbetween specialized errors and more general ones. The resulting\nerror is then immediately returned.\n\nBecause of the early return, `try!` can only be used in functions that\nreturn [`Result`].\n\n# Examples\n\n```rust\nuse std::io;\nuse std::fs::File;\nuse std::io::prelude::*;\n\nenum MyError {\n FileWriteError\n}\n\nimpl From for MyError {\n fn from(e: io::Error) -> MyError {\n MyError::FileWriteError\n }\n}\n\n// The preferred method of quick returning Errors\nfn write_to_file_question() -> Result<(), MyError> {\n let mut file = File::create(\"my_best_friends.txt\")?;\n file.write_all(b\"This is a list of my best friends.\")?;\n Ok(())\n}\n\n// The previous method of quick returning Errors\nfn write_to_file_using_try() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n r#try!(file.write_all(b\"This is a list of my best friends.\"));\n Ok(())\n}\n\n// This is equivalent to:\nfn write_to_file_using_match() -> Result<(), MyError> {\n let mut file = r#try!(File::create(\"my_best_friends.txt\"));\n match file.write_all(b\"This is a list of my best friends.\") {\n Ok(v) => v,\n Err(e) => return Err(From::from(e)),\n }\n Ok(())\n}\n```"},"filterText":"try!","insertTextFormat":2,"kind":3,"label":"try!(…)","sortText":"ffffffef","tags":[1],"textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"r#try!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! file","documentation":{"kind":"markdown","value":"Expands to the file name in which it was invoked.\n\nWith [`line!`] and [`column!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `&'static str`, and the returned file\nis not the invocation of the `file!` macro itself, but rather the\nfirst macro invocation leading up to the invocation of the `file!`\nmacro.\n\n# Examples\n\n```rust\nlet this_file = file!();\nprintln!(\"defined in file: {this_file}\");\n```"},"filterText":"file!","insertTextFormat":2,"kind":3,"label":"file!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"file!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! thread_local","documentation":{"kind":"markdown","value":"Declare a new thread local storage key of type [`std::thread::LocalKey`].\n\n# Syntax\n\nThe macro wraps any number of static declarations and makes them thread local.\nPublicity and attributes for each static are allowed. Example:\n\n```rust\nuse std::cell::RefCell;\nthread_local! {\n pub static FOO: RefCell = RefCell::new(1);\n\n static BAR: RefCell = RefCell::new(1.0);\n}\n\nFOO.with(|foo| assert_eq!(*foo.borrow(), 1));\nBAR.with(|bar| assert_eq!(*bar.borrow(), 1.0));\n```\n\nThis macro supports a special `const {}` syntax that can be used\nwhen the initialization expression can be evaluated as a constant.\nThis can enable a more efficient thread local implementation that\ncan avoid lazy initialization. For types that do not\n[need to be dropped][crate::mem::needs_drop], this can enable an\neven more efficient implementation that does not need to\ntrack any additional state.\n\n```rust\nuse std::cell::Cell;\nthread_local! {\n pub static FOO: Cell = const { Cell::new(1) };\n}\n\nFOO.with(|foo| assert_eq!(foo.get(), 1));\n```\n\nSee [`LocalKey` documentation][`std::thread::LocalKey`] for more\ninformation.\n\n[`std::thread::LocalKey`]: crate::thread::LocalKey"},"filterText":"thread_local!","insertTextFormat":2,"kind":3,"label":"thread_local! {…}","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"thread_local! {$0}","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert","documentation":{"kind":"markdown","value":"Asserts that a boolean expression is `true` at runtime.\n\nThis will invoke the [`panic!`] macro if the provided expression cannot be\nevaluated to `true` at runtime.\n\n# Uses\n\nAssertions are always checked in both debug and release builds, and cannot\nbe disabled. See [`debug_assert!`] for assertions that are not enabled in\nrelease builds by default.\n\nUnsafe code may rely on `assert!` to enforce run-time invariants that, if\nviolated could lead to unsafety.\n\nOther use-cases of `assert!` include testing and enforcing run-time\ninvariants in safe code (whose violation cannot result in unsafety).\n\n# Custom Messages\n\nThis macro has a second form, where a custom panic message can\nbe provided with or without arguments for formatting. See [`std::fmt`]\nfor syntax for this form. Expressions used as format arguments will only\nbe evaluated if the assertion fails.\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\n// the panic message for these assertions is the stringified value of the\n// expression given.\nassert!(true);\n\nfn some_computation() -> bool { true } // a very simple function\n\nassert!(some_computation());\n\n// assert with a custom message\nlet x = true;\nassert!(x, \"x wasn't true!\");\n\nlet a = 3; let b = 27;\nassert!(a + b == 30, \"a = {}, b = {}\", a, b);\n```"},"filterText":"assert!","insertTextFormat":2,"kind":3,"label":"assert!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"assert!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! column","documentation":{"kind":"markdown","value":"Expands to the column number at which it was invoked.\n\nWith [`line!`] and [`file!`], these macros provide debugging information for\ndevelopers about the location within the source.\n\nThe expanded expression has type `u32` and is 1-based, so the first column\nin each line evaluates to 1, the second to 2, etc. This is consistent\nwith error messages by common compilers or popular editors.\nThe returned column is *not necessarily* the line of the `column!` invocation itself,\nbut rather the first macro invocation leading up to the invocation\nof the `column!` macro.\n\n# Examples\n\n```rust\nlet current_col = column!();\nprintln!(\"defined on column: {current_col}\");\n```\n\n`column!` counts Unicode code points, not bytes or graphemes. As a result, the first two\ninvocations return the same value, but the third does not.\n\n```rust\nlet a = (\"foobar\", column!()).1;\nlet b = (\"人之初性本善\", column!()).1;\nlet c = (\"f̅o̅o̅b̅a̅r̅\", column!()).1; // Uses combining overline (U+0305)\n\nassert_eq!(a, b);\nassert_ne!(b, c);\n```"},"filterText":"column!","insertTextFormat":2,"kind":3,"label":"column!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"column!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format_args_nl","documentation":{"kind":"markdown","value":"Same as [`format_args`], but adds a newline in the end."},"filterText":"format_args_nl!","insertTextFormat":2,"kind":3,"label":"format_args_nl!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"format_args_nl!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! unreachable","documentation":{"kind":"markdown","value":"Indicates unreachable code.\n\nThis is useful any time that the compiler can't determine that some code is unreachable. For\nexample:\n\n* Match arms with guard conditions.\n* Loops that dynamically terminate.\n* Iterators that dynamically terminate.\n\nIf the determination that the code is unreachable proves incorrect, the\nprogram immediately terminates with a [`panic!`].\n\nThe unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which\nwill cause undefined behavior if the code is reached.\n\n[`unreachable_unchecked`]: crate::hint::unreachable_unchecked\n\n# Panics\n\nThis will always [`panic!`] because `unreachable!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nMatch arms:\n\n```rust\nfn foo(x: Option) {\n match x {\n Some(n) if n >= 0 => println!(\"Some(Non-negative)\"),\n Some(n) if n < 0 => println!(\"Some(Negative)\"),\n Some(_) => unreachable!(), // compile error if commented out\n None => println!(\"None\")\n }\n}\n```\n\nIterators:\n\n```rust\nfn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3\n for i in 0.. {\n if 3*i < i { panic!(\"u32 overflow\"); }\n if x < 3*i { return i-1; }\n }\n unreachable!(\"The loop should always return\");\n}\n```"},"filterText":"unreachable!","insertTextFormat":2,"kind":3,"label":"unreachable!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"unreachable!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! eprintln","documentation":{"kind":"markdown","value":"Prints to the standard error, with a newline.\n\nEquivalent to the [`println!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`println!`] for\nexample usage.\n\nUse `eprintln!` only for error and progress messages. Use `println!`\ninstead for the primary output of your program.\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n[`println!`]: crate::println\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprintln!(\"Error: Could not complete task\");\n```"},"filterText":"eprintln!","insertTextFormat":2,"kind":3,"label":"eprintln!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"eprintln!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! unimplemented","documentation":{"kind":"markdown","value":"Indicates unimplemented code by panicking with a message of \"not implemented\".\n\nThis allows your code to type-check, which is useful if you are prototyping or\nimplementing a trait that requires multiple methods which you don't plan to use all of.\n\nThe difference between `unimplemented!` and [`todo!`] is that while `todo!`\nconveys an intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `unimplemented!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n[`todo!`]: crate::todo\n\n# Examples\n\nSay we have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` for 'MyStruct', but for some reason it only makes sense\nto implement the `bar()` function. `baz()` and `qux()` will still need to be defined\nin our implementation of `Foo`, but we can use `unimplemented!` in their definitions\nto allow our code to compile.\n\nWe still want to have our program stop running if the unimplemented methods are\nreached.\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // It makes no sense to `baz` a `MyStruct`, so we have no logic here\n // at all.\n // This will display \"thread 'main' panicked at 'not implemented'\".\n unimplemented!();\n }\n\n fn qux(&self) -> Result {\n // We have some logic here,\n // We can add a message to unimplemented! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not implemented: MyStruct isn't quxable'\".\n unimplemented!(\"MyStruct isn't quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n}\n```"},"filterText":"unimplemented!","insertTextFormat":2,"kind":3,"label":"unimplemented!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"unimplemented!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! cfg","documentation":{"kind":"markdown","value":"Evaluates boolean combinations of configuration flags at compile-time.\n\nIn addition to the `#[cfg]` attribute, this macro is provided to allow\nboolean expression evaluation of configuration flags. This frequently\nleads to less duplicated code.\n\nThe syntax given to this macro is the same syntax as the [`cfg`]\nattribute.\n\n`cfg!`, unlike `#[cfg]`, does not remove any code and only evaluates to true or false. For\nexample, all blocks in an if/else expression need to be valid when `cfg!` is used for\nthe condition, regardless of what `cfg!` is evaluating.\n\n[`cfg`]: ../reference/conditional-compilation.html#the-cfg-attribute\n\n# Examples\n\n```rust\nlet my_directory = if cfg!(windows) {\n \"windows-specific-directory\"\n} else {\n \"unix-directory\"\n};\n```"},"filterText":"cfg!","insertTextFormat":2,"kind":3,"label":"cfg!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"cfg!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! todo","documentation":{"kind":"markdown","value":"Indicates unfinished code.\n\nThis can be useful if you are prototyping and just\nwant a placeholder to let your code pass type analysis.\n\nThe difference between [`unimplemented!`] and `todo!` is that while `todo!` conveys\nan intent of implementing the functionality later and the message is \"not yet\nimplemented\", `unimplemented!` makes no such claims. Its message is \"not implemented\".\n\nAlso, some IDEs will mark `todo!`s.\n\n# Panics\n\nThis will always [`panic!`] because `todo!` is just a shorthand for `panic!` with a\nfixed, specific message.\n\nLike `panic!`, this macro has a second form for displaying custom values.\n\n# Examples\n\nHere's an example of some in-progress code. We have a trait `Foo`:\n\n```rust\ntrait Foo {\n fn bar(&self) -> u8;\n fn baz(&self);\n fn qux(&self) -> Result;\n}\n```\n\nWe want to implement `Foo` on one of our types, but we also want to work on\njust `bar()` first. In order for our code to compile, we need to implement\n`baz()` and `qux()`, so we can use `todo!`:\n\n```rust\nstruct MyStruct;\n\nimpl Foo for MyStruct {\n fn bar(&self) -> u8 {\n 1 + 1\n }\n\n fn baz(&self) {\n // Let's not worry about implementing baz() for now\n todo!();\n }\n\n fn qux(&self) -> Result {\n // We can add a message to todo! to display our omission.\n // This will display:\n // \"thread 'main' panicked at 'not yet implemented: MyStruct is not yet quxable'\".\n todo!(\"MyStruct is not yet quxable\");\n }\n}\n\nfn main() {\n let s = MyStruct;\n s.bar();\n\n // We aren't even using baz() or qux(), so this is fine.\n}\n```"},"filterText":"todo!","insertTextFormat":2,"kind":3,"label":"todo!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"todo!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! trace_macros","documentation":{"kind":"markdown","value":"Enables or disables tracing functionality used for debugging other macros."},"filterText":"trace_macros!","insertTextFormat":2,"kind":3,"label":"trace_macros!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"trace_macros!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! module_path","documentation":{"kind":"markdown","value":"Expands to a string that represents the current module path.\n\nThe current module path can be thought of as the hierarchy of modules\nleading back up to the crate root. The first component of the path\nreturned is the name of the crate currently being compiled.\n\n# Examples\n\n```rust\nmod test {\n pub fn foo() {\n assert!(module_path!().ends_with(\"test\"));\n }\n}\n\ntest::foo();\n```"},"filterText":"module_path!","insertTextFormat":2,"kind":3,"label":"module_path!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"module_path!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! option_env","documentation":{"kind":"markdown","value":"Optionally inspects an environment variable at compile time.\n\nIf the named environment variable is present at compile time, this will\nexpand into an expression of type `Option<&'static str>` whose value is\n`Some` of the value of the environment variable. If the environment\nvariable is not present, then this will expand to `None`. See\n[`Option`][Option] for more information on this type. Use\n[`std::env::var`] instead if you want to read the value at runtime.\n\n[`std::env::var`]: ../std/env/fn.var.html\n\nA compile time error is never emitted when using this macro regardless\nof whether the environment variable is present or not.\nTo emit a compile error if the environment variable is not present,\nuse the [`env!`] macro instead.\n\n# Examples\n\n```rust\nlet key: Option<&'static str> = option_env!(\"SECRET_KEY\");\nprintln!(\"the secret key might be: {key:?}\");\n```"},"filterText":"option_env!","insertTextFormat":2,"kind":3,"label":"option_env!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"option_env!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! writeln","documentation":{"kind":"markdown","value":"Write formatted data into a buffer, with a newline appended.\n\nOn all platforms, the newline is the LINE FEED character (`\\n`/`U+000A`) alone\n(no additional CARRIAGE RETURN (`\\r`/`U+000D`).\n\nFor more information, see [`write!`]. For information on the format string syntax, see\n[`std::fmt`].\n\n[`std::fmt`]: ../std/fmt/index.html\n\n# Examples\n\n```rust\nuse std::io::{Write, Result};\n\nfn main() -> Result<()> {\n let mut w = Vec::new();\n writeln!(&mut w)?;\n writeln!(&mut w, \"test\")?;\n writeln!(&mut w, \"formatted {}\", \"arguments\")?;\n\n assert_eq!(&w[..], \"\\ntest\\nformatted arguments\\n\".as_bytes());\n Ok(())\n}\n```"},"filterText":"writeln!","insertTextFormat":2,"kind":3,"label":"writeln!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"writeln!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! assert_eq","documentation":{"kind":"markdown","value":"Asserts that two expressions are equal to each other (using [`PartialEq`]).\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nLike [`assert!`], this macro has a second form, where a custom\npanic message can be provided.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 1 + 2;\nassert_eq!(a, b);\n\nassert_eq!(a, b, \"we are testing addition with {} and {}\", a, b);\n```"},"filterText":"assert_eq!","insertTextFormat":2,"kind":3,"label":"assert_eq!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"assert_eq!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! compile_error","documentation":{"kind":"markdown","value":"Causes compilation to fail with the given error message when encountered.\n\nThis macro should be used when a crate uses a conditional compilation strategy to provide\nbetter error messages for erroneous conditions. It's the compiler-level form of [`panic!`],\nbut emits an error during *compilation* rather than at *runtime*.\n\n# Examples\n\nTwo such examples are macros and `#[cfg]` environments.\n\nEmit a better compiler error if a macro is passed invalid values. Without the final branch,\nthe compiler would still emit an error, but the error's message would not mention the two\nvalid values.\n\n```rust\nmacro_rules! give_me_foo_or_bar {\n (foo) => {};\n (bar) => {};\n ($x:ident) => {\n compile_error!(\"This macro only accepts `foo` or `bar`\");\n }\n}\n\ngive_me_foo_or_bar!(neither);\n// ^ will fail at compile time with message \"This macro only accepts `foo` or `bar`\"\n```\n\nEmit a compiler error if one of a number of features isn't available.\n\n```rust\n#[cfg(not(any(feature = \"foo\", feature = \"bar\")))]\ncompile_error!(\"Either feature \\\"foo\\\" or \\\"bar\\\" must be enabled for this crate.\");\n```"},"filterText":"compile_error!","insertTextFormat":2,"kind":3,"label":"compile_error!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"compile_error!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! matches","documentation":{"kind":"markdown","value":"Returns whether the given expression matches any of the given patterns.\n\nLike in a `match` expression, the pattern can be optionally followed by `if`\nand a guard expression that has access to names bound by the pattern.\n\n# Examples\n\n```rust\nlet foo = 'f';\nassert!(matches!(foo, 'A'..='Z' | 'a'..='z'));\n\nlet bar = Some(4);\nassert!(matches!(bar, Some(x) if x > 2));\n```"},"filterText":"matches!","insertTextFormat":2,"kind":3,"label":"matches!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"matches!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! format_args","documentation":{"kind":"markdown","value":"Constructs parameters for the other string-formatting macros.\n\nThis macro functions by taking a formatting string literal containing\n`{}` for each additional argument passed. `format_args!` prepares the\nadditional parameters to ensure the output can be interpreted as a string\nand canonicalizes the arguments into a single type. Any value that implements\nthe [`Display`] trait can be passed to `format_args!`, as can any\n[`Debug`] implementation be passed to a `{:?}` within the formatting string.\n\nThis macro produces a value of type [`fmt::Arguments`]. This value can be\npassed to the macros within [`std::fmt`] for performing useful redirection.\nAll other formatting macros ([`format!`], [`write!`], [`println!`], etc) are\nproxied through this one. `format_args!`, unlike its derived macros, avoids\nheap allocations.\n\nYou can use the [`fmt::Arguments`] value that `format_args!` returns\nin `Debug` and `Display` contexts as seen below. The example also shows\nthat `Debug` and `Display` format to the same thing: the interpolated\nformat string in `format_args!`.\n\n```rust\nlet debug = format!(\"{:?}\", format_args!(\"{} foo {:?}\", 1, 2));\nlet display = format!(\"{}\", format_args!(\"{} foo {:?}\", 1, 2));\nassert_eq!(\"1 foo 2\", display);\nassert_eq!(display, debug);\n```\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax, and further information.\n\n[`Display`]: crate::fmt::Display\n[`Debug`]: crate::fmt::Debug\n[`fmt::Arguments`]: crate::fmt::Arguments\n[`std::fmt`]: ../std/fmt/index.html\n[`format!`]: ../std/macro.format.html\n[`println!`]: ../std/macro.println.html\n\n# Examples\n\n```rust\nuse std::fmt;\n\nlet s = fmt::format(format_args!(\"hello {}\", \"world\"));\nassert_eq!(s, format!(\"hello {}\", \"world\"));\n```"},"filterText":"format_args!","insertTextFormat":2,"kind":3,"label":"format_args!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"format_args!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! is_x86_feature_detected","documentation":{"kind":"markdown","value":"A macro to test at *runtime* whether a CPU feature is available on\nx86/x86-64 platforms.\n\nThis macro is provided in the standard library and will detect at runtime\nwhether the specified CPU feature is detected. This does **not** resolve at\ncompile time unless the specified feature is already enabled for the entire\ncrate. Runtime detection currently relies mostly on the `cpuid` instruction.\n\nThis macro only takes one argument which is a string literal of the feature\nbeing tested for. The feature names supported are the lowercase versions of\nthe ones defined by Intel in [their documentation][docs].\n\n## Supported arguments\n\nThis macro supports the same names that `#[target_feature]` supports. Unlike\n`#[target_feature]`, however, this macro does not support names separated\nwith a comma. Instead testing for multiple features must be done through\nseparate macro invocations for now.\n\nSupported arguments are:\n\n* `\"aes\"`\n* `\"pclmulqdq\"`\n* `\"rdrand\"`\n* `\"rdseed\"`\n* `\"tsc\"`\n* `\"mmx\"`\n* `\"sse\"`\n* `\"sse2\"`\n* `\"sse3\"`\n* `\"ssse3\"`\n* `\"sse4.1\"`\n* `\"sse4.2\"`\n* `\"sse4a\"`\n* `\"sha\"`\n* `\"avx\"`\n* `\"avx2\"`\n* `\"avx512f\"`\n* `\"avx512cd\"`\n* `\"avx512er\"`\n* `\"avx512pf\"`\n* `\"avx512bw\"`\n* `\"avx512dq\"`\n* `\"avx512vl\"`\n* `\"avx512ifma\"`\n* `\"avx512vbmi\"`\n* `\"avx512vpopcntdq\"`\n* `\"avx512vbmi2\"`\n* `\"gfni\"`\n* `\"vaes\"`\n* `\"vpclmulqdq\"`\n* `\"avx512vnni\"`\n* `\"avx512bitalg\"`\n* `\"avx512bf16\"`\n* `\"avx512vp2intersect\"`\n* `\"f16c\"`\n* `\"fma\"`\n* `\"bmi1\"`\n* `\"bmi2\"`\n* `\"abm\"`\n* `\"lzcnt\"`\n* `\"tbm\"`\n* `\"popcnt\"`\n* `\"fxsr\"`\n* `\"xsave\"`\n* `\"xsaveopt\"`\n* `\"xsaves\"`\n* `\"xsavec\"`\n* `\"cmpxchg16b\"`\n* `\"adx\"`\n* `\"rtm\"`\n* `\"movbe\"`\n* `\"ermsb\"`\n\n[docs]: https://software.intel.com/sites/landingpage/IntrinsicsGuide"},"filterText":"is_x86_feature_detected!","insertTextFormat":2,"kind":3,"label":"is_x86_feature_detected!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"is_x86_feature_detected!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! concat_bytes","documentation":{"kind":"markdown","value":"Concatenates literals into a byte slice.\n\nThis macro takes any number of comma-separated literals, and concatenates them all into\none, yielding an expression of type `&[u8; _]`, which represents all of the literals\nconcatenated left-to-right. The literals passed can be any combination of:\n\n- byte literals (`b'r'`)\n- byte strings (`b\"Rust\"`)\n- arrays of bytes/numbers (`[b'A', 66, b'C']`)\n\n# Examples\n\n```rust\n#![feature(concat_bytes)]\n\nlet s: &[u8; 6] = concat_bytes!(b'A', b\"BC\", [68, b'E', 70]);\nassert_eq!(s, b\"ABCDEF\");\n```"},"filterText":"concat_bytes!","insertTextFormat":2,"kind":3,"label":"concat_bytes!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"concat_bytes!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! eprint","documentation":{"kind":"markdown","value":"Prints to the standard error.\n\nEquivalent to the [`print!`] macro, except that output goes to\n[`io::stderr`] instead of [`io::stdout`]. See [`print!`] for\nexample usage.\n\nUse `eprint!` only for error and progress messages. Use `print!`\ninstead for the primary output of your program.\n\n[`io::stderr`]: crate::io::stderr\n[`io::stdout`]: crate::io::stdout\n\nSee [the formatting documentation in `std::fmt`](../std/fmt/index.html)\nfor details of the macro argument syntax.\n\n# Panics\n\nPanics if writing to `io::stderr` fails.\n\nWriting to non-blocking stderr can cause an error, which will lead\nthis macro to panic.\n\n# Examples\n\n```rust\neprint!(\"Error: Could not complete task\");\n```"},"filterText":"eprint!","insertTextFormat":2,"kind":3,"label":"eprint!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"eprint!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"detail":"macro_rules! debug_assert_ne","documentation":{"kind":"markdown","value":"Asserts that two expressions are not equal to each other.\n\nOn panic, this macro will print the values of the expressions with their\ndebug representations.\n\nUnlike [`assert_ne!`], `debug_assert_ne!` statements are only enabled in non\noptimized builds by default. An optimized build will not execute\n`debug_assert_ne!` statements unless `-C debug-assertions` is passed to the\ncompiler. This makes `debug_assert_ne!` useful for checks that are too\nexpensive to be present in a release build but may be helpful during\ndevelopment. The result of expanding `debug_assert_ne!` is always type checked.\n\n# Examples\n\n```rust\nlet a = 3;\nlet b = 2;\ndebug_assert_ne!(a, b);\n```"},"filterText":"debug_assert_ne!","insertTextFormat":2,"kind":3,"label":"debug_assert_ne!(…)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"debug_assert_ne!($0)","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust Standard Library\n\nThe Rust Standard Library is the foundation of portable Rust software, a\nset of minimal and battle-tested shared abstractions for the [broader Rust\necosystem][crates.io]. It offers core types, like [`Vec`] and\n[`Option`], library-defined [operations on language\nprimitives](#primitives), [standard macros](#macros), [I/O] and\n[multithreading], among [many other things][other].\n\n`std` is available to all Rust crates by default. Therefore, the\nstandard library can be accessed in [`use`] statements through the path\n`std`, as in [`use std::env`].\n\n# How to read this documentation\n\nIf you already know the name of what you are looking for, the fastest way to\nfind it is to use the search\nbar at the top of the page.\n\nOtherwise, you may want to jump to one of these useful sections:\n\n* [`std::*` modules](#modules)\n* [Primitive types](#primitives)\n* [Standard macros](#macros)\n* [The Rust Prelude]\n\nIf this is your first time, the documentation for the standard library is\nwritten to be casually perused. Clicking on interesting things should\ngenerally lead you to interesting places. Still, there are important bits\nyou don't want to miss, so read on for a tour of the standard library and\nits documentation!\n\nOnce you are familiar with the contents of the standard library you may\nbegin to find the verbosity of the prose distracting. At this stage in your\ndevelopment you may want to press the `[-]` button near the top of the\npage to collapse it into a more skimmable view.\n\nWhile you are looking at that `[-]` button also notice the `source`\nlink. Rust's API documentation comes with the source code and you are\nencouraged to read it. The standard library source is generally high\nquality and a peek behind the curtains is often enlightening.\n\n# What is in the standard library documentation?\n\nFirst of all, The Rust Standard Library is divided into a number of focused\nmodules, [all listed further down this page](#modules). These modules are\nthe bedrock upon which all of Rust is forged, and they have mighty names\nlike [`std::slice`] and [`std::cmp`]. Modules' documentation typically\nincludes an overview of the module along with examples, and are a smart\nplace to start familiarizing yourself with the library.\n\nSecond, implicit methods on [primitive types] are documented here. This can\nbe a source of confusion for two reasons:\n\n1. While primitives are implemented by the compiler, the standard library\n implements methods directly on the primitive types (and it is the only\n library that does so), which are [documented in the section on\n primitives](#primitives).\n2. The standard library exports many modules *with the same name as\n primitive types*. These define additional items related to the primitive\n type, but not the all-important methods.\n\nSo for example there is a [page for the primitive type\n`i32`](primitive::i32) that lists all the methods that can be called on\n32-bit integers (very useful), and there is a [page for the module\n`std::i32`] that documents the constant values [`MIN`] and [`MAX`] (rarely\nuseful).\n\nNote the documentation for the primitives [`str`] and [`[T]`][prim@slice] (also\ncalled 'slice'). Many method calls on [`String`] and [`Vec`] are actually\ncalls to methods on [`str`] and [`[T]`][prim@slice] respectively, via [deref\ncoercions][deref-coercions].\n\nThird, the standard library defines [The Rust Prelude], a small collection\nof items - mostly traits - that are imported into every module of every\ncrate. The traits in the prelude are pervasive, making the prelude\ndocumentation a good entry point to learning about the library.\n\nAnd finally, the standard library exports a number of standard macros, and\n[lists them on this page](#macros) (technically, not all of the standard\nmacros are defined by the standard library - some are defined by the\ncompiler - but they are documented here the same). Like the prelude, the\nstandard macros are imported by default into all crates.\n\n# Contributing changes to the documentation\n\nCheck out the rust contribution guidelines [here](\nhttps://rustc-dev-guide.rust-lang.org/contributing.html#writing-documentation).\nThe source for this documentation can be found on\n[GitHub](https://github.com/rust-lang/rust).\nTo contribute changes, make sure you read the guidelines first, then submit\npull-requests for your suggested changes.\n\nContributions are appreciated! If you see a part of the docs that can be\nimproved, submit a PR, or chat with us first on [Discord][rust-discord]\n#docs.\n\n# A Tour of The Rust Standard Library\n\nThe rest of this crate documentation is dedicated to pointing out notable\nfeatures of The Rust Standard Library.\n\n## Containers and collections\n\nThe [`option`] and [`result`] modules define optional and error-handling\ntypes, [`Option`] and [`Result`]. The [`iter`] module defines\nRust's iterator trait, [`Iterator`], which works with the [`for`] loop to\naccess collections.\n\nThe standard library exposes three common ways to deal with contiguous\nregions of memory:\n\n* [`Vec`] - A heap-allocated *vector* that is resizable at runtime.\n* [`[T; N]`][prim@array] - An inline *array* with a fixed size at compile time.\n* [`[T]`][prim@slice] - A dynamically sized *slice* into any other kind of contiguous\n storage, whether heap-allocated or not.\n\nSlices can only be handled through some kind of *pointer*, and as such come\nin many flavors such as:\n\n* `&[T]` - *shared slice*\n* `&mut [T]` - *mutable slice*\n* [`Box<[T]>`][owned slice] - *owned slice*\n\n[`str`], a UTF-8 string slice, is a primitive type, and the standard library\ndefines many methods for it. Rust [`str`]s are typically accessed as\nimmutable references: `&str`. Use the owned [`String`] for building and\nmutating strings.\n\nFor converting to strings use the [`format!`] macro, and for converting from\nstrings use the [`FromStr`] trait.\n\nData may be shared by placing it in a reference-counted box or the [`Rc`]\ntype, and if further contained in a [`Cell`] or [`RefCell`], may be mutated\nas well as shared. Likewise, in a concurrent setting it is common to pair an\natomically-reference-counted box, [`Arc`], with a [`Mutex`] to get the same\neffect.\n\nThe [`collections`] module defines maps, sets, linked lists and other\ntypical collection types, including the common [`HashMap`].\n\n## Platform abstractions and I/O\n\nBesides basic data types, the standard library is largely concerned with\nabstracting over differences in common platforms, most notably Windows and\nUnix derivatives.\n\nCommon types of I/O, including [files], [TCP], and [UDP], are defined in\nthe [`io`], [`fs`], and [`net`] modules.\n\nThe [`thread`] module contains Rust's threading abstractions. [`sync`]\ncontains further primitive shared memory types, including [`atomic`] and\n[`mpsc`], which contains the channel types for message passing.\n\n# Use before and after `main()`\n\nMany parts of the standard library are expected to work before and after `main()`;\nbut this is not guaranteed or ensured by tests. It is recommended that you write your own tests\nand run them on each platform you wish to support.\nThis means that use of `std` before/after main, especially of features that interact with the\nOS or global state, is exempted from stability and portability guarantees and instead only\nprovided on a best-effort basis. Nevertheless bug reports are appreciated.\n\nOn the other hand `core` and `alloc` are most likely to work in such environments with\nthe caveat that any hookable behavior such as panics, oom handling or allocators will also\ndepend on the compatibility of the hooks.\n\nSome features may also behave differently outside main, e.g. stdio could become unbuffered,\nsome panics might turn into aborts, backtraces might not get symbolicated or similar.\n\nNon-exhaustive list of known limitations:\n\n- after-main use of thread-locals, which also affects additional features:\n - [`thread::current()`]\n - [`thread::scope()`]\n - [`sync::mpsc`]\n- before-main stdio file descriptors are not guaranteed to be open on unix platforms\n\n\n[I/O]: io\n[`MIN`]: i32::MIN\n[`MAX`]: i32::MAX\n[page for the module `std::i32`]: crate::i32\n[TCP]: net::TcpStream\n[The Rust Prelude]: prelude\n[UDP]: net::UdpSocket\n[`Arc`]: sync::Arc\n[owned slice]: boxed\n[`Cell`]: cell::Cell\n[`FromStr`]: str::FromStr\n[`HashMap`]: collections::HashMap\n[`Mutex`]: sync::Mutex\n[`Option`]: option::Option\n[`Rc`]: rc::Rc\n[`RefCell`]: cell::RefCell\n[`Result`]: result::Result\n[`Vec`]: vec::Vec\n[`atomic`]: sync::atomic\n[`for`]: ../book/ch03-05-control-flow.html#looping-through-a-collection-with-for\n[`str`]: prim@str\n[`mpsc`]: sync::mpsc\n[`std::cmp`]: cmp\n[`std::slice`]: mod@slice\n[`use std::env`]: env/index.html\n[`use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html\n[crates.io]: https://crates.io\n[deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods\n[files]: fs::File\n[multithreading]: thread\n[other]: #what-is-in-the-standard-library-documentation\n[primitive types]: ../book/ch03-02-data-types.html\n[rust-discord]: https://discord.gg/rust-lang\n[array]: prim@array\n[slice]: prim@slice"},"filterText":"std","kind":9,"label":"std","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"std","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust core allocation and collections library\n\nThis library provides smart pointers and collections for managing\nheap-allocated values.\n\nThis library, like core, normally doesn’t need to be used directly\nsince its contents are re-exported in the [`std` crate](../std/index.html).\nCrates that use the `#![no_std]` attribute however will typically\nnot depend on `std`, so they’d use this crate instead.\n\n## Boxed values\n\nThe [`Box`] type is a smart pointer type. There can only be one owner of a\n[`Box`], and the owner can decide to mutate the contents, which live on the\nheap.\n\nThis type can be sent among threads efficiently as the size of a `Box` value\nis the same as that of a pointer. Tree-like data structures are often built\nwith boxes because each node often has only one owner, the parent.\n\n## Reference counted pointers\n\nThe [`Rc`] type is a non-threadsafe reference-counted pointer type intended\nfor sharing memory within a thread. An [`Rc`] pointer wraps a type, `T`, and\nonly allows access to `&T`, a shared reference.\n\nThis type is useful when inherited mutability (such as using [`Box`]) is too\nconstraining for an application, and is often paired with the [`Cell`] or\n[`RefCell`] types in order to allow mutation.\n\n## Atomically reference counted pointers\n\nThe [`Arc`] type is the threadsafe equivalent of the [`Rc`] type. It\nprovides all the same functionality of [`Rc`], except it requires that the\ncontained type `T` is shareable. Additionally, [`Arc`][`Arc`] is itself\nsendable while [`Rc`][`Rc`] is not.\n\nThis type allows for shared access to the contained data, and is often\npaired with synchronization primitives such as mutexes to allow mutation of\nshared resources.\n\n## Collections\n\nImplementations of the most common general purpose data structures are\ndefined in this library. They are re-exported through the\n[standard collections library](../std/collections/index.html).\n\n## Heap interfaces\n\nThe [`alloc`](alloc/index.html) module defines the low-level interface to the\ndefault global allocator. It is not compatible with the libc allocator API.\n\n[`Arc`]: sync\n[`Box`]: boxed\n[`Cell`]: core::cell\n[`Rc`]: rc\n[`RefCell`]: core::cell"},"filterText":"alloc","kind":9,"label":"alloc","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"alloc","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"# The Rust Core Library\n\nThe Rust Core Library is the dependency-free[^free] foundation of [The\nRust Standard Library](../std/index.html). It is the portable glue\nbetween the language and its libraries, defining the intrinsic and\nprimitive building blocks of all Rust code. It links to no\nupstream libraries, no system libraries, and no libc.\n\n[^free]: Strictly speaking, there are some symbols which are needed but\n they aren't always necessary.\n\nThe core library is *minimal*: it isn't even aware of heap allocation,\nnor does it provide concurrency or I/O. These things require\nplatform integration, and this library is platform-agnostic.\n\n# How to use the core library\n\nPlease note that all of these details are currently not considered stable.\n\nThis library is built on the assumption of a few existing symbols:\n\n* `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines\n which are generated by Rust codegen backends. Additionally, this library can make explicit\n calls to `strlen`. Their signatures are the same as found in C, but there are extra\n assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if\n the `n` parameter is 0, the function is assumed to not be UB, even if the pointers are NULL or\n dangling. (Note that making extra assumptions about these functions is common among compilers:\n [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)\n These functions are often provided by the system libc, but can also be provided by the\n [compiler-builtins crate](https://crates.io/crates/compiler_builtins).\n Note that the library does not guarantee that it will always make these assumptions, so Rust\n user code directly calling the C functions should follow the C specification! The advice for\n Rust user code is to call the functions provided by this library instead (such as\n `ptr::copy`).\n\n* `rust_begin_panic` - This function takes four arguments, a\n `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments\n dictate the panic message, the file at which panic was invoked, and the\n line and column inside the file. It is up to consumers of this core\n library to define this panic function; it is only required to never\n return. This requires a `lang` attribute named `panic_impl`.\n\n* `rust_eh_personality` - is used by the failure mechanisms of the\n compiler. This is often mapped to GCC's personality function, but crates\n which do not trigger a panic can be assured that this function is never\n called. The `lang` attribute is called `eh_personality`."},"filterText":"core","kind":9,"label":"core","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"core","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u32","kind":22,"label":"u32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"u32","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"bool","kind":22,"label":"bool","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"bool","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u8","kind":22,"label":"u8","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"u8","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"isize","kind":22,"label":"isize","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"isize","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u16","kind":22,"label":"u16","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"u16","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u64","kind":22,"label":"u64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"u64","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"u128","kind":22,"label":"u128","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"u128","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"f32","kind":22,"label":"f32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"f32","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i128","kind":22,"label":"i128","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"i128","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i16","kind":22,"label":"i16","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"i16","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"str","kind":22,"label":"str","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"str","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i64","kind":22,"label":"i64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"i64","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"char","kind":22,"label":"char","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"char","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"f64","kind":22,"label":"f64","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"f64","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i32","kind":22,"label":"i32","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"i32","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"i8","kind":22,"label":"i8","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"i8","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"usize","kind":22,"label":"usize","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"usize","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do a cheap mutable-to-mutable reference conversion.\n\nThis trait is similar to [`AsRef`] but used for converting between mutable\nreferences. If you need to do a costly conversion it is better to\nimplement [`From`] with type `&mut T` or write a custom function.\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsMut` auto-dereferences if the inner type is a mutable reference\n(e.g.: `foo.as_mut()` will work the same if `foo` has type `&mut Foo` or `&mut &mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[mutably dereferenceable types], e.g. `foo.as_mut()` will *not* work the same as\n`Box::new(foo).as_mut()`. Instead, many smart pointers provide an `as_mut` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsMut::as_mut`] should not be\nused for the sole purpose of mutable dereferencing; instead ['`Deref` coercion'] can be used:\n\n[mutably dereferenceable types]: core::ops::DerefMut\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::DerefMut#mutable-deref-coercion\n\n```rust\nlet mut x = Box::new(5i32);\n// Avoid this:\n// let y: &mut i32 = x.as_mut();\n// Better just write:\nlet y: &mut i32 = &mut x;\n```\n\nTypes which implement [`DerefMut`] should consider to add an implementation of `AsMut` as\nfollows:\n\n[`DerefMut`]: core::ops::DerefMut\n\n```rust\nimpl AsMut for SomeType\nwhere\n ::Target: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.deref_mut().as_mut()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsMut` would be reflexive, i.e. there would be an `impl AsMut for T`\nwith [`as_mut`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&mut T where T: AsMut` which allows `AsMut` to auto-dereference, see \"Generic\nImplementations\" above).\n\n[`as_mut`]: AsMut::as_mut\n\nA trivial implementation of `AsMut for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nUsing `AsMut` as trait bound for a generic function, we can accept all mutable references that\ncan be converted to type `&mut T`. Unlike [dereference], which has a single [target type],\nthere can be multiple implementations of `AsMut` for a type. In particular, `Vec` implements\nboth `AsMut>` and `AsMut<[T]>`.\n\nIn the following, the example functions `caesar` and `null_terminate` provide a generic\ninterface which work with any type that can be converted by cheap mutable-to-mutable conversion\ninto a byte slice (`[u8]`) or byte vector (`Vec`), respectively.\n\n[dereference]: core::ops::DerefMut\n[target type]: core::ops::Deref::Target\n\n```rust\nstruct Document {\n info: String,\n content: Vec,\n}\n\nimpl AsMut for Document\nwhere\n Vec: AsMut,\n{\n fn as_mut(&mut self) -> &mut T {\n self.content.as_mut()\n }\n}\n\nfn caesar>(data: &mut T, key: u8) {\n for byte in data.as_mut() {\n *byte = byte.wrapping_add(key);\n }\n}\n\nfn null_terminate>>(data: &mut T) {\n // Using a non-generic inner function, which contains most of the\n // functionality, helps to minimize monomorphization overhead.\n fn doit(data: &mut Vec) {\n let len = data.len();\n if len == 0 || data[len-1] != 0 {\n data.push(0);\n }\n }\n doit(data.as_mut());\n}\n\nfn main() {\n let mut v: Vec = vec![1, 2, 3];\n caesar(&mut v, 5);\n assert_eq!(v, [6, 7, 8]);\n null_terminate(&mut v);\n assert_eq!(v, [6, 7, 8, 0]);\n let mut doc = Document {\n info: String::from(\"Example\"),\n content: vec![17, 19, 8],\n };\n caesar(&mut doc, 1);\n assert_eq!(doc.content, [18, 20, 9]);\n null_terminate(&mut doc);\n assert_eq!(doc.content, [18, 20, 9, 0]);\n}\n```\n\nNote, however, that APIs don't need to be generic. In many cases taking a `&mut [u8]` or\n`&mut Vec`, for example, is the better choice (callers need to pass the correct type then)."},"filterText":"AsMut","kind":8,"label":"AsMut","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"AsMut","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do a cheap reference-to-reference conversion.\n\nThis trait is similar to [`AsMut`] which is used for converting between mutable references.\nIf you need to do a costly conversion it is better to implement [`From`] with type\n`&T` or write a custom function.\n\n# Relation to `Borrow`\n\n`AsRef` has the same signature as [`Borrow`], but [`Borrow`] is different in a few aspects:\n\n- Unlike `AsRef`, [`Borrow`] has a blanket impl for any `T`, and can be used to accept either\n a reference or a value. (See also note on `AsRef`'s reflexibility below.)\n- [`Borrow`] also requires that [`Hash`], [`Eq`] and [`Ord`] for a borrowed value are\n equivalent to those of the owned value. For this reason, if you want to\n borrow only a single field of a struct you can implement `AsRef`, but not [`Borrow`].\n\n**Note: This trait must not fail**. If the conversion can fail, use a\ndedicated method which returns an [`Option`] or a [`Result`].\n\n# Generic Implementations\n\n`AsRef` auto-dereferences if the inner type is a reference or a mutable reference\n(e.g.: `foo.as_ref()` will work the same if `foo` has type `&mut Foo` or `&&mut Foo`).\n\nNote that due to historic reasons, the above currently does not hold generally for all\n[dereferenceable types], e.g. `foo.as_ref()` will *not* work the same as\n`Box::new(foo).as_ref()`. Instead, many smart pointers provide an `as_ref` implementation which\nsimply returns a reference to the [pointed-to value] (but do not perform a cheap\nreference-to-reference conversion for that value). However, [`AsRef::as_ref`] should not be\nused for the sole purpose of dereferencing; instead ['`Deref` coercion'] can be used:\n\n[dereferenceable types]: core::ops::Deref\n[pointed-to value]: core::ops::Deref::Target\n['`Deref` coercion']: core::ops::Deref#deref-coercion\n\n```rust\nlet x = Box::new(5i32);\n// Avoid this:\n// let y: &i32 = x.as_ref();\n// Better just write:\nlet y: &i32 = &x;\n```\n\nTypes which implement [`Deref`] should consider implementing `AsRef` as follows:\n\n[`Deref`]: core::ops::Deref\n\n```rust\nimpl AsRef for SomeType\nwhere\n T: ?Sized,\n ::Target: AsRef,\n{\n fn as_ref(&self) -> &T {\n self.deref().as_ref()\n }\n}\n```\n\n# Reflexivity\n\nIdeally, `AsRef` would be reflexive, i.e. there would be an `impl AsRef for T`\nwith [`as_ref`] simply returning its argument unchanged.\nSuch a blanket implementation is currently *not* provided due to technical restrictions of\nRust's type system (it would be overlapping with another existing blanket implementation for\n`&T where T: AsRef` which allows `AsRef` to auto-dereference, see \"Generic Implementations\"\nabove).\n\n[`as_ref`]: AsRef::as_ref\n\nA trivial implementation of `AsRef for T` must be added explicitly for a particular type `T`\nwhere needed or desired. Note, however, that not all types from `std` contain such an\nimplementation, and those cannot be added by external code due to orphan rules.\n\n# Examples\n\nBy using trait bounds we can accept arguments of different types as long as they can be\nconverted to the specified type `T`.\n\nFor example: By creating a generic function that takes an `AsRef` we express that we\nwant to accept all references that can be converted to [`&str`] as an argument.\nSince both [`String`] and [`&str`] implement `AsRef` we can accept both as input argument.\n\n[`&str`]: primitive@str\n[`Borrow`]: crate::borrow::Borrow\n[`Eq`]: crate::cmp::Eq\n[`Ord`]: crate::cmp::Ord\n[`String`]: ../../std/string/struct.String.html\n\n```rust\nfn is_hello>(s: T) {\n assert_eq!(\"hello\", s.as_ref());\n}\n\nlet s = \"hello\";\nis_hello(s);\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```"},"filterText":"AsRef","kind":8,"label":"AsRef","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"AsRef","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A pointer type that uniquely owns a heap allocation of type `T`.\n\nSee the [module-level documentation](../../std/boxed/index.html) for more."},"filterText":"Box","kind":22,"label":"Box","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Box","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A common trait for the ability to explicitly duplicate an object.\n\nDiffers from [`Copy`] in that [`Copy`] is implicit and an inexpensive bit-wise copy, while\n`Clone` is always explicit and may or may not be expensive. In order to enforce\nthese characteristics, Rust does not allow you to reimplement [`Copy`], but you\nmay reimplement `Clone` and run arbitrary code.\n\nSince `Clone` is more general than [`Copy`], you can automatically make anything\n[`Copy`] be `Clone` as well.\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all fields are `Clone`. The `derive`d\nimplementation of [`Clone`] calls [`clone`] on each field.\n\n[`clone`]: Clone::clone\n\nFor a generic struct, `#[derive]` implements `Clone` conditionally by adding bound `Clone` on\ngeneric parameters.\n\n```rust\n// `derive` implements Clone for Reading when T is Clone.\n#[derive(Clone)]\nstruct Reading {\n frequency: T,\n}\n```\n\n## How can I implement `Clone`?\n\nTypes that are [`Copy`] should have a trivial implementation of `Clone`. More formally:\nif `T: Copy`, `x: T`, and `y: &T`, then `let x = y.clone();` is equivalent to `let x = *y;`.\nManual implementations should be careful to uphold this invariant; however, unsafe code\nmust not rely on it to ensure memory safety.\n\nAn example is a generic struct holding a function pointer. In this case, the\nimplementation of `Clone` cannot be `derive`d, but can be implemented as:\n\n```rust\nstruct Generate(fn() -> T);\n\nimpl Copy for Generate {}\n\nimpl Clone for Generate {\n fn clone(&self) -> Self {\n *self\n }\n}\n```\n\nIf we `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n```\n\nthe auto-derived implementations will have unnecessary `T: Copy` and `T: Clone` bounds:\n\n```rust\n\n// Automatically derived\nimpl Copy for Generate { }\n\n// Automatically derived\nimpl Clone for Generate {\n fn clone(&self) -> Generate {\n Generate(Clone::clone(&self.0))\n }\n}\n```\n\nThe bounds are unnecessary because clearly the function itself should be\ncopy- and cloneable even if its return type is not:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Generate(fn() -> T);\n\nstruct NotCloneable;\n\nfn generate_not_cloneable() -> NotCloneable {\n NotCloneable\n}\n\nGenerate(generate_not_cloneable).clone(); // error: trait bounds were not satisfied\n// Note: With the manual implementations the above line will compile.\n```\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Clone`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Clone` themselves.\n Note that variables captured by shared reference always implement `Clone`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Clone`.\n\n[impls]: #implementors"},"filterText":"Clone","kind":8,"label":"Clone","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Clone","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Types whose values can be duplicated simply by copying bits.\n\nBy default, variable bindings have 'move semantics.' In other\nwords:\n\n```rust\n#[derive(Debug)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `x` has moved into `y`, and so cannot be used\n\n// println!(\"{x:?}\"); // error: use of moved value\n```\n\nHowever, if a type implements `Copy`, it instead has 'copy semantics':\n\n```rust\n// We can derive a `Copy` implementation. `Clone` is also required, as it's\n// a supertrait of `Copy`.\n#[derive(Debug, Copy, Clone)]\nstruct Foo;\n\nlet x = Foo;\n\nlet y = x;\n\n// `y` is a copy of `x`\n\nprintln!(\"{x:?}\"); // A-OK!\n```\n\nIt's important to note that in these two examples, the only difference is whether you\nare allowed to access `x` after the assignment. Under the hood, both a copy and a move\ncan result in bits being copied in memory, although this is sometimes optimized away.\n\n## How can I implement `Copy`?\n\nThere are two ways to implement `Copy` on your type. The simplest is to use `derive`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct MyStruct;\n```\n\nYou can also implement `Copy` and `Clone` manually:\n\n```rust\nstruct MyStruct;\n\nimpl Copy for MyStruct { }\n\nimpl Clone for MyStruct {\n fn clone(&self) -> MyStruct {\n *self\n }\n}\n```\n\nThere is a small difference between the two: the `derive` strategy will also place a `Copy`\nbound on type parameters, which isn't always desired.\n\n## What's the difference between `Copy` and `Clone`?\n\nCopies happen implicitly, for example as part of an assignment `y = x`. The behavior of\n`Copy` is not overloadable; it is always a simple bit-wise copy.\n\nCloning is an explicit action, `x.clone()`. The implementation of [`Clone`] can\nprovide any type-specific behavior necessary to duplicate values safely. For example,\nthe implementation of [`Clone`] for [`String`] needs to copy the pointed-to string\nbuffer in the heap. A simple bitwise copy of [`String`] values would merely copy the\npointer, leading to a double free down the line. For this reason, [`String`] is [`Clone`]\nbut not `Copy`.\n\n[`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement\n[`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`\n(see the example above).\n\n## When can my type be `Copy`?\n\nA type can implement `Copy` if all of its components implement `Copy`. For example, this\nstruct can be `Copy`:\n\n```rust\n#[derive(Copy, Clone)]\nstruct Point {\n x: i32,\n y: i32,\n}\n```\n\nA struct can be `Copy`, and [`i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.\nBy contrast, consider\n\n```rust\nstruct PointList {\n points: Vec,\n}\n```\n\nThe struct `PointList` cannot implement `Copy`, because [`Vec`] is not `Copy`. If we\nattempt to derive a `Copy` implementation, we'll get an error:\n\n```text\nthe trait `Copy` cannot be implemented for this type; field `points` does not implement `Copy`\n```\n\nShared references (`&T`) are also `Copy`, so a type can be `Copy`, even when it holds\nshared references of types `T` that are *not* `Copy`. Consider the following struct,\nwhich can implement `Copy`, because it only holds a *shared reference* to our non-`Copy`\ntype `PointList` from above:\n\n```rust\n#[derive(Copy, Clone)]\nstruct PointListWrapper<'a> {\n point_list_ref: &'a PointList,\n}\n```\n\n## When *can't* my type be `Copy`?\n\nSome types can't be copied safely. For example, copying `&mut T` would create an aliased\nmutable reference. Copying [`String`] would duplicate responsibility for managing the\n[`String`]'s buffer, leading to a double free.\n\nGeneralizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's\nmanaging some resource besides its own [`size_of::`] bytes.\n\nIf you try to implement `Copy` on a struct or enum containing non-`Copy` data, you will get\nthe error [E0204].\n\n[E0204]: ../../error_codes/E0204.html\n\n## When *should* my type be `Copy`?\n\nGenerally speaking, if your type _can_ implement `Copy`, it should. Keep in mind, though,\nthat implementing `Copy` is part of the public API of your type. If the type might become\nnon-`Copy` in the future, it could be prudent to omit the `Copy` implementation now, to\navoid a breaking API change.\n\n## Additional implementors\n\nIn addition to the [implementors listed below][impls],\nthe following types also implement `Copy`:\n\n* Function item types (i.e., the distinct types defined for each function)\n* Function pointer types (e.g., `fn() -> i32`)\n* Closure types, if they capture no value from the environment\n or if all such captured values implement `Copy` themselves.\n Note that variables captured by shared reference always implement `Copy`\n (even if the referent doesn't),\n while variables captured by mutable reference never implement `Copy`.\n\n[`Vec`]: ../../std/vec/struct.Vec.html\n[`String`]: ../../std/string/struct.String.html\n[`size_of::`]: crate::mem::size_of\n[impls]: #implementors"},"filterText":"Copy","kind":8,"label":"Copy","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Copy","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for giving a type a useful default value.\n\nSometimes, you want to fall back to some kind of default value, and\ndon't particularly care what it is. This comes up often with `struct`s\nthat define a set of options:\n\n```rust\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```\n\nHow can we define some default values? You can use `Default`:\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n\nfn main() {\n let options: SomeOptions = Default::default();\n}\n```\n\nNow, you get all of the default values. Rust implements `Default` for various primitives types.\n\nIf you want to override a particular option, but still retain the other defaults:\n\n```rust\nfn main() {\n let options = SomeOptions { foo: 42, ..Default::default() };\n}\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]` if all of the type's fields implement\n`Default`. When `derive`d, it will use the default value for each field's type.\n\n### `enum`s\n\nWhen using `#[derive(Default)]` on an `enum`, you need to choose which unit variant will be\ndefault. You do this by placing the `#[default]` attribute on the variant.\n\n```rust\n#[derive(Default)]\nenum Kind {\n #[default]\n A,\n B,\n C,\n}\n```\n\nYou cannot use the `#[default]` attribute on non-unit or non-exhaustive variants.\n\n## How can I implement `Default`?\n\nProvide an implementation for the `default()` method that returns the value of\nyour type that should be the default:\n\n```rust\nenum Kind {\n A,\n B,\n C,\n}\n\nimpl Default for Kind {\n fn default() -> Self { Kind::A }\n}\n```\n\n# Examples\n\n```rust\n#[derive(Default)]\nstruct SomeOptions {\n foo: i32,\n bar: f32,\n}\n```"},"filterText":"Default","kind":8,"label":"Default","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Default","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An iterator able to yield elements from both ends.\n\nSomething that implements `DoubleEndedIterator` has one extra capability\nover something that implements [`Iterator`]: the ability to also take\n`Item`s from the back, as well as the front.\n\nIt is important to note that both back and forth work on the same range,\nand do not cross: iteration is over when they meet in the middle.\n\nIn a similar fashion to the [`Iterator`] protocol, once a\n`DoubleEndedIterator` returns [`None`] from a [`next_back()`], calling it\nagain may or may not ever return [`Some`] again. [`next()`] and\n[`next_back()`] are interchangeable for this purpose.\n\n[`next_back()`]: DoubleEndedIterator::next_back\n[`next()`]: Iterator::next\n\n# Examples\n\nBasic usage:\n\n```rust\nlet numbers = vec![1, 2, 3, 4, 5, 6];\n\nlet mut iter = numbers.iter();\n\nassert_eq!(Some(&1), iter.next());\nassert_eq!(Some(&6), iter.next_back());\nassert_eq!(Some(&5), iter.next_back());\nassert_eq!(Some(&2), iter.next());\nassert_eq!(Some(&3), iter.next());\nassert_eq!(Some(&4), iter.next());\nassert_eq!(None, iter.next());\nassert_eq!(None, iter.next_back());\n```"},"filterText":"DoubleEndedIterator","kind":8,"label":"DoubleEndedIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"DoubleEndedIterator","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Custom code within the destructor.\n\nWhen a value is no longer needed, Rust will run a \"destructor\" on that value.\nThe most common way that a value is no longer needed is when it goes out of\nscope. Destructors may still run in other circumstances, but we're going to\nfocus on scope for the examples here. To learn about some of those other cases,\nplease see [the reference] section on destructors.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\nThis destructor consists of two components:\n- A call to `Drop::drop` for that value, if this special `Drop` trait is implemented for its type.\n- The automatically generated \"drop glue\" which recursively calls the destructors\n of all the fields of this value.\n\nAs Rust automatically calls the destructors of all contained fields,\nyou don't have to implement `Drop` in most cases. But there are some cases where\nit is useful, for example for types which directly manage a resource.\nThat resource may be memory, it may be a file descriptor, it may be a network socket.\nOnce a value of that type is no longer going to be used, it should \"clean up\" its\nresource by freeing the memory or closing the file or socket. This is\nthe job of a destructor, and therefore the job of `Drop::drop`.\n\n## Examples\n\nTo see destructors in action, let's take a look at the following program:\n\n```rust\nstruct HasDrop;\n\nimpl Drop for HasDrop {\n fn drop(&mut self) {\n println!(\"Dropping HasDrop!\");\n }\n}\n\nstruct HasTwoDrops {\n one: HasDrop,\n two: HasDrop,\n}\n\nimpl Drop for HasTwoDrops {\n fn drop(&mut self) {\n println!(\"Dropping HasTwoDrops!\");\n }\n}\n\nfn main() {\n let _x = HasTwoDrops { one: HasDrop, two: HasDrop };\n println!(\"Running!\");\n}\n```\n\nRust will first call `Drop::drop` for `_x` and then for both `_x.one` and `_x.two`,\nmeaning that running this will print\n\n```text\nRunning!\nDropping HasTwoDrops!\nDropping HasDrop!\nDropping HasDrop!\n```\n\nEven if we remove the implementation of `Drop` for `HasTwoDrop`, the destructors of its fields are still called.\nThis would result in\n\n```test\nRunning!\nDropping HasDrop!\nDropping HasDrop!\n```\n\n## You cannot call `Drop::drop` yourself\n\nBecause `Drop::drop` is used to clean up a value, it may be dangerous to use this value after\nthe method has been called. As `Drop::drop` does not take ownership of its input,\nRust prevents misuse by not allowing you to call `Drop::drop` directly.\n\nIn other words, if you tried to explicitly call `Drop::drop` in the above example, you'd get a compiler error.\n\nIf you'd like to explicitly call the destructor of a value, [`mem::drop`] can be used instead.\n\n[`mem::drop`]: drop\n\n## Drop order\n\nWhich of our two `HasDrop` drops first, though? For structs, it's the same\norder that they're declared: first `one`, then `two`. If you'd like to try\nthis yourself, you can modify `HasDrop` above to contain some data, like an\ninteger, and then use it in the `println!` inside of `Drop`. This behavior is\nguaranteed by the language.\n\nUnlike for structs, local variables are dropped in reverse order:\n\n```rust\nstruct Foo;\n\nimpl Drop for Foo {\n fn drop(&mut self) {\n println!(\"Dropping Foo!\")\n }\n}\n\nstruct Bar;\n\nimpl Drop for Bar {\n fn drop(&mut self) {\n println!(\"Dropping Bar!\")\n }\n}\n\nfn main() {\n let _foo = Foo;\n let _bar = Bar;\n}\n```\n\nThis will print\n\n```text\nDropping Bar!\nDropping Foo!\n```\n\nPlease see [the reference] for the full rules.\n\n[the reference]: https://doc.rust-lang.org/reference/destructors.html\n\n## `Copy` and `Drop` are exclusive\n\nYou cannot implement both [`Copy`] and `Drop` on the same type. Types that\nare `Copy` get implicitly duplicated by the compiler, making it very\nhard to predict when, and how often destructors will be executed. As such,\nthese types cannot have destructors.\n\n## Drop check\n\nDropping interacts with the borrow checker in subtle ways: when a type `T` is being implicitly\ndropped as some variable of this type goes out of scope, the borrow checker needs to ensure that\ncalling `T`'s destructor at this moment is safe. In particular, it also needs to be safe to\nrecursively drop all the fields of `T`. For example, it is crucial that code like the following\nis being rejected:\n\n```rust\nuse std::cell::Cell;\n\nstruct S<'a>(Cell>>, Box);\nimpl Drop for S<'_> {\n fn drop(&mut self) {\n if let Some(r) = self.0.get() {\n // Print the contents of the `Box` in `r`.\n println!(\"{}\", r.1);\n }\n }\n}\n\nfn main() {\n // Set up two `S` that point to each other.\n let s1 = S(Cell::new(None), Box::new(42));\n let s2 = S(Cell::new(Some(&s1)), Box::new(42));\n s1.0.set(Some(&s2));\n // Now they both get dropped. But whichever is the 2nd one\n // to be dropped will access the `Box` in the first one,\n // which is a use-after-free!\n}\n```\n\nThe Nomicon discusses the need for [drop check in more detail][drop check].\n\nTo reject such code, the \"drop check\" analysis determines which types and lifetimes need to\nstill be live when `T` gets dropped. The exact details of this analysis are not yet\nstably guaranteed and **subject to change**. Currently, the analysis works as follows:\n- If `T` has no drop glue, then trivially nothing is required to be live. This is the case if\n neither `T` nor any of its (recursive) fields have a destructor (`impl Drop`). [`PhantomData`]\n and [`ManuallyDrop`] are considered to never have a destructor, no matter their field type.\n- If `T` has drop glue, then, for all types `U` that are *owned* by any field of `T`,\n recursively add the types and lifetimes that need to be live when `U` gets dropped. The set of\n owned types is determined by recursively traversing `T`:\n - Recursively descend through `PhantomData`, `Box`, tuples, and arrays (including arrays of\n length 0).\n - Stop at reference and raw pointer types as well as function pointers and function items;\n they do not own anything.\n - Stop at non-composite types (type parameters that remain generic in the current context and\n base types such as integers and `bool`); these types are owned.\n - When hitting an ADT with `impl Drop`, stop there; this type is owned.\n - When hitting an ADT without `impl Drop`, recursively descend to its fields. (For an `enum`,\n consider all fields of all variants.)\n- Furthermore, if `T` implements `Drop`, then all generic (lifetime and type) parameters of `T`\n must be live.\n\nIn the above example, the last clause implies that `'a` must be live when `S<'a>` is dropped,\nand hence the example is rejected. If we remove the `impl Drop`, the liveness requirement\ndisappears and the example is accepted.\n\nThere exists an unstable way for a type to opt-out of the last clause; this is called \"drop\ncheck eyepatch\" or `may_dangle`. For more details on this nightly-only feature, see the\n[discussion in the Nomicon][nomicon].\n\n[`ManuallyDrop`]: crate::mem::ManuallyDrop\n[`PhantomData`]: crate::marker::PhantomData\n[drop check]: ../../nomicon/dropck.html\n[nomicon]: ../../nomicon/phantom-data.html#an-exception-the-special-case-of-the-standard-library-and-its-unstable-may_dangle"},"filterText":"Drop","kind":8,"label":"Drop","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Drop","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for comparisons corresponding to [equivalence relations](\nhttps://en.wikipedia.org/wiki/Equivalence_relation).\n\nThis means, that in addition to `a == b` and `a != b` being strict inverses,\nthe relation must be (for all `a`, `b` and `c`):\n\n- reflexive: `a == a`;\n- symmetric: `a == b` implies `b == a` (required by `PartialEq` as well); and\n- transitive: `a == b` and `b == c` implies `a == c` (required by `PartialEq` as well).\n\nThis property cannot be checked by the compiler, and therefore `Eq` implies\n[`PartialEq`], and has no extra methods.\n\nViolating this property is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\nImplement `Eq` in addition to `PartialEq` if it's guaranteed that\n`PartialEq::eq(a, a)` always returns `true` (reflexivity), in addition to\nthe symmetric and transitive properties already required by `PartialEq`.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d, because `Eq` has\nno extra methods, it is only informing the compiler that this is an\nequivalence relation rather than a partial equivalence relation. Note that\nthe `derive` strategy requires all fields are `Eq`, which isn't\nalways desired.\n\n## How can I implement `Eq`?\n\nIf you cannot use the `derive` strategy, specify that your type implements\n`Eq`, which has no methods:\n\n```rust\nenum BookFormat { Paperback, Hardback, Ebook }\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\nimpl Eq for Book {}\n```"},"filterText":"Eq","kind":8,"label":"Eq (alias ==, !=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Eq","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Err(E)","documentation":{"kind":"markdown","value":"Contains the error value"},"filterText":"Err()","insertTextFormat":2,"kind":20,"label":"Err(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Err(${1:()})$0","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An iterator that knows its exact length.\n\nMany [`Iterator`]s don't know how many times they will iterate, but some do.\nIf an iterator knows how many times it can iterate, providing access to\nthat information can be useful. For example, if you want to iterate\nbackwards, a good start is to know where the end is.\n\nWhen implementing an `ExactSizeIterator`, you must also implement\n[`Iterator`]. When doing so, the implementation of [`Iterator::size_hint`]\n*must* return the exact size of the iterator.\n\nThe [`len`] method has a default implementation, so you usually shouldn't\nimplement it. However, you may be able to provide a more performant\nimplementation than the default, so overriding it in this case makes sense.\n\nNote that this trait is a safe trait and as such does *not* and *cannot*\nguarantee that the returned length is correct. This means that `unsafe`\ncode **must not** rely on the correctness of [`Iterator::size_hint`]. The\nunstable and unsafe [`TrustedLen`](super::marker::TrustedLen) trait gives\nthis additional guarantee.\n\n[`len`]: ExactSizeIterator::len\n\n# When *shouldn't* an adapter be `ExactSizeIterator`?\n\nIf an adapter makes an iterator *longer*, then it's usually incorrect for\nthat adapter to implement `ExactSizeIterator`. The inner exact-sized\niterator might already be `usize::MAX`-long, and thus the length of the\nlonger adapted iterator would no longer be exactly representable in `usize`.\n\nThis is why [`Chain`](crate::iter::Chain) isn't `ExactSizeIterator`,\neven when `A` and `B` are both `ExactSizeIterator`.\n\n# Examples\n\nBasic usage:\n\n```rust\n// a finite range knows exactly how many times it will iterate\nlet five = 0..5;\n\nassert_eq!(5, five.len());\n```\n\nIn the [module-level docs], we implemented an [`Iterator`], `Counter`.\nLet's implement `ExactSizeIterator` for it as well:\n\n[module-level docs]: crate::iter\n\n```rust\nimpl ExactSizeIterator for Counter {\n // We can easily calculate the remaining number of iterations.\n fn len(&self) -> usize {\n 5 - self.count\n }\n}\n\n// And now we can use it!\n\nlet mut counter = Counter::new();\n\nassert_eq!(5, counter.len());\nlet _ = counter.next();\nassert_eq!(4, counter.len());\n```"},"filterText":"ExactSizeIterator","kind":8,"label":"ExactSizeIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"ExactSizeIterator","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Extend a collection with the contents of an iterator.\n\nIterators produce a series of values, and collections can also be thought\nof as a series of values. The `Extend` trait bridges this gap, allowing you\nto extend a collection by including the contents of that iterator. When\nextending a collection with an already existing key, that entry is updated\nor, in the case of collections that permit multiple entries with equal\nkeys, that entry is inserted.\n\n# Examples\n\nBasic usage:\n\n```rust\n// You can extend a String with some chars:\nlet mut message = String::from(\"The first three letters are: \");\n\nmessage.extend(&['a', 'b', 'c']);\n\nassert_eq!(\"abc\", &message[29..32]);\n```\n\nImplementing `Extend`:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// since MyCollection has a list of i32s, we implement Extend for i32\nimpl Extend for MyCollection {\n\n // This is a bit simpler with the concrete type signature: we can call\n // extend on anything which can be turned into an Iterator which gives\n // us i32s. Because we need i32s to put into MyCollection.\n fn extend>(&mut self, iter: T) {\n\n // The implementation is very straightforward: loop through the\n // iterator, and add() each element to ourselves.\n for elem in iter {\n self.add(elem);\n }\n }\n}\n\nlet mut c = MyCollection::new();\n\nc.add(5);\nc.add(6);\nc.add(7);\n\n// let's extend our collection with three more numbers\nc.extend(vec![1, 2, 3]);\n\n// we've added these elements onto the end\nassert_eq!(\"MyCollection([5, 6, 7, 1, 2, 3])\", format!(\"{c:?}\"));\n```"},"filterText":"Extend","kind":8,"label":"Extend","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Extend","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes an immutable receiver.\n\nInstances of `Fn` can be called repeatedly without mutating state.\n\n*This trait (`Fn`) is not to be confused with [function pointers]\n(`fn`).*\n\n`Fn` is implemented automatically by closures which only take immutable\nreferences to captured variables or don't capture anything at all, as well\nas (safe) [function pointers] (with some caveats, see their documentation\nfor more details). Additionally, for any type `F` that implements `Fn`, `&F`\nimplements `Fn`, too.\n\nSince both [`FnMut`] and [`FnOnce`] are supertraits of `Fn`, any\ninstance of `Fn` can be used as a parameter where a [`FnMut`] or [`FnOnce`]\nis expected.\n\nUse `Fn` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly and without mutating state (e.g., when\ncalling it concurrently). If you do not need such strict requirements, use\n[`FnMut`] or [`FnOnce`] as bounds.\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a closure\n\n```rust\nlet square = |x| x * x;\nassert_eq!(square(5), 25);\n```\n\n## Using a `Fn` parameter\n\n```rust\nfn call_with_one(func: F) -> usize\n where F: Fn(usize) -> usize {\n func(1)\n}\n\nlet double = |x| x * 2;\nassert_eq!(call_with_one(double), 2);\n```"},"filterText":"Fn","kind":8,"label":"Fn","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Fn","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a mutable receiver.\n\nInstances of `FnMut` can be called repeatedly and may mutate state.\n\n`FnMut` is implemented automatically by closures which take mutable\nreferences to captured variables, as well as all types that implement\n[`Fn`], e.g., (safe) [function pointers] (since `FnMut` is a supertrait of\n[`Fn`]). Additionally, for any type `F` that implements `FnMut`, `&mut F`\nimplements `FnMut`, too.\n\nSince [`FnOnce`] is a supertrait of `FnMut`, any instance of `FnMut` can be\nused where a [`FnOnce`] is expected, and since [`Fn`] is a subtrait of\n`FnMut`, any instance of [`Fn`] can be used where `FnMut` is expected.\n\nUse `FnMut` as a bound when you want to accept a parameter of function-like\ntype and need to call it repeatedly, while allowing it to mutate state.\nIf you don't want the parameter to mutate state, use [`Fn`] as a\nbound; if you don't need to call it repeatedly, use [`FnOnce`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Calling a mutably capturing closure\n\n```rust\nlet mut x = 5;\n{\n let mut square_x = || x *= x;\n square_x();\n}\nassert_eq!(x, 25);\n```\n\n## Using a `FnMut` parameter\n\n```rust\nfn do_twice(mut func: F)\n where F: FnMut()\n{\n func();\n func();\n}\n\nlet mut x: usize = 1;\n{\n let add_two_to_x = || x += 2;\n do_twice(add_two_to_x);\n}\n\nassert_eq!(x, 5);\n```"},"filterText":"FnMut","kind":8,"label":"FnMut","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"FnMut","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The version of the call operator that takes a by-value receiver.\n\nInstances of `FnOnce` can be called, but might not be callable multiple\ntimes. Because of this, if the only thing known about a type is that it\nimplements `FnOnce`, it can only be called once.\n\n`FnOnce` is implemented automatically by closures that might consume captured\nvariables, as well as all types that implement [`FnMut`], e.g., (safe)\n[function pointers] (since `FnOnce` is a supertrait of [`FnMut`]).\n\nSince both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of\n[`Fn`] or [`FnMut`] can be used where a `FnOnce` is expected.\n\nUse `FnOnce` as a bound when you want to accept a parameter of function-like\ntype and only need to call it once. If you need to call the parameter\nrepeatedly, use [`FnMut`] as a bound; if you also need it to not mutate\nstate, use [`Fn`].\n\nSee the [chapter on closures in *The Rust Programming Language*][book] for\nsome more information on this topic.\n\nAlso of note is the special syntax for `Fn` traits (e.g.\n`Fn(usize, bool) -> usize`). Those interested in the technical details of\nthis can refer to [the relevant section in the *Rustonomicon*][nomicon].\n\n[book]: ../../book/ch13-01-closures.html\n[function pointers]: fn\n[nomicon]: ../../nomicon/hrtb.html\n\n# Examples\n\n## Using a `FnOnce` parameter\n\n```rust\nfn consume_with_relish(func: F)\n where F: FnOnce() -> String\n{\n // `func` consumes its captured variables, so it cannot be run more\n // than once.\n println!(\"Consumed: {}\", func());\n\n println!(\"Delicious!\");\n\n // Attempting to invoke `func()` again will throw a `use of moved\n // value` error for `func`.\n}\n\nlet x = String::from(\"x\");\nlet consume_and_return_x = move || x;\nconsume_with_relish(consume_and_return_x);\n\n// `consume_and_return_x` can no longer be invoked at this point\n```"},"filterText":"FnOnce","kind":8,"label":"FnOnce","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"FnOnce","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Used to do value-to-value conversions while consuming the input value. It is the reciprocal of\n[`Into`].\n\nOne should always prefer implementing `From` over [`Into`]\nbecause implementing `From` automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nOnly implement [`Into`] when targeting a version prior to Rust 1.41 and converting to a type\noutside the current crate.\n`From` was not able to do these types of conversions in earlier versions because of Rust's\norphaning rules.\nSee [`Into`] for more details.\n\nPrefer using [`Into`] over using `From` when specifying trait bounds on a generic function.\nThis way, types that directly implement [`Into`] can be used as arguments as well.\n\nThe `From` is also very useful when performing error handling. When constructing a function\nthat is capable of failing, the return type will generally be of the form `Result`.\nThe `From` trait simplifies error handling by allowing a function to return a single error type\nthat encapsulate multiple error types. See the \"Examples\" section and [the book][book] for more\ndetails.\n\n**Note: This trait must not fail**. The `From` trait is intended for perfect conversions.\nIf the conversion can fail or is not perfect, use [`TryFrom`].\n\n# Generic Implementations\n\n- `From for U` implies [`Into`]` for T`\n- `From` is reflexive, which means that `From for T` is implemented\n\n# When to implement `From`\n\nWhile there's no technical restrictions on which conversions can be done using\na `From` implementation, the general expectation is that the conversions\nshould typically be restricted as follows:\n\n* The conversion is *infallible*: if the conversion can fail, use [`TryFrom`]\n instead; don't provide a `From` impl that panics.\n\n* The conversion is *lossless*: semantically, it should not lose or discard\n information. For example, `i32: From` exists, where the original\n value can be recovered using `u16: TryFrom`. And `String: From<&str>`\n exists, where you can get something equivalent to the original value via\n `Deref`. But `From` cannot be used to convert from `u32` to `u16`, since\n that cannot succeed in a lossless way. (There's some wiggle room here for\n information not considered semantically relevant. For example,\n `Box<[T]>: From>` exists even though it might not preserve capacity,\n like how two vectors can be equal despite differing capacities.)\n\n* The conversion is *value-preserving*: the conceptual kind and meaning of\n the resulting value is the same, even though the Rust type and technical\n representation might be different. For example `-1_i8 as u8` is *lossless*,\n since `as` casting back can recover the original value, but that conversion\n is *not* available via `From` because `-1` and `255` are different conceptual\n values (despite being identical bit patterns technically). But\n `f32: From` *is* available because `1_i16` and `1.0_f32` are conceptually\n the same real number (despite having very different bit patterns technically).\n `String: From` is available because they're both *text*, but\n `String: From` is *not* available, since `1` (a number) and `\"1\"`\n (text) are too different. (Converting values to text is instead covered\n by the [`Display`](crate::fmt::Display) trait.)\n\n* The conversion is *obvious*: it's the only reasonable conversion between\n the two types. Otherwise it's better to have it be a named method or\n constructor, like how [`str::as_bytes`] is a method and how integers have\n methods like [`u32::from_ne_bytes`], [`u32::from_le_bytes`], and\n [`u32::from_be_bytes`], none of which are `From` implementations. Whereas\n there's only one reasonable way to wrap an [`Ipv6Addr`](crate::net::Ipv6Addr)\n into an [`IpAddr`](crate::net::IpAddr), thus `IpAddr: From` exists.\n\n# Examples\n\n[`String`] implements `From<&str>`:\n\nAn explicit conversion from a `&str` to a String is done as follows:\n\n```rust\nlet string = \"hello\".to_string();\nlet other_string = String::from(\"hello\");\n\nassert_eq!(string, other_string);\n```\n\nWhile performing error handling it is often useful to implement `From` for your own error type.\nBy converting underlying error types to our own custom error type that encapsulates the\nunderlying error type, we can return a single error type without losing information on the\nunderlying cause. The '?' operator automatically converts the underlying error type to our\ncustom error type with `From::from`.\n\n```rust\nuse std::fs;\nuse std::io;\nuse std::num;\n\nenum CliError {\n IoError(io::Error),\n ParseError(num::ParseIntError),\n}\n\nimpl From for CliError {\n fn from(error: io::Error) -> Self {\n CliError::IoError(error)\n }\n}\n\nimpl From for CliError {\n fn from(error: num::ParseIntError) -> Self {\n CliError::ParseError(error)\n }\n}\n\nfn open_and_parse_file(file_name: &str) -> Result {\n let mut contents = fs::read_to_string(&file_name)?;\n let num: i32 = contents.trim().parse()?;\n Ok(num)\n}\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`from`]: From::from\n[book]: ../../book/ch09-00-error-handling.html"},"filterText":"From","kind":8,"label":"From","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"From","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Conversion from an [`Iterator`].\n\nBy implementing `FromIterator` for a type, you define how it will be\ncreated from an iterator. This is common for types which describe a\ncollection of some kind.\n\nIf you want to create a collection from the contents of an iterator, the\n[`Iterator::collect()`] method is preferred. However, when you need to\nspecify the container type, [`FromIterator::from_iter()`] can be more\nreadable than using a turbofish (e.g. `::>()`). See the\n[`Iterator::collect()`] documentation for more examples of its use.\n\nSee also: [`IntoIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v = Vec::from_iter(five_fives);\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`Iterator::collect()`] to implicitly use `FromIterator`:\n\n```rust\nlet five_fives = std::iter::repeat(5).take(5);\n\nlet v: Vec = five_fives.collect();\n\nassert_eq!(v, vec![5, 5, 5, 5, 5]);\n```\n\nUsing [`FromIterator::from_iter()`] as a more readable alternative to\n[`Iterator::collect()`]:\n\n```rust\nuse std::collections::VecDeque;\nlet first = (0..10).collect::>();\nlet second = VecDeque::from_iter(0..10);\n\nassert_eq!(first, second);\n```\n\nImplementing `FromIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement FromIterator\nimpl FromIterator for MyCollection {\n fn from_iter>(iter: I) -> Self {\n let mut c = MyCollection::new();\n\n for i in iter {\n c.add(i);\n }\n\n c\n }\n}\n\n// Now we can make a new iterator...\nlet iter = (0..5).into_iter();\n\n// ... and make a MyCollection out of it\nlet c = MyCollection::from_iter(iter);\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n\n// collect works too!\n\nlet iter = (0..5).into_iter();\nlet c: MyCollection = iter.collect();\n\nassert_eq!(c.0, vec![0, 1, 2, 3, 4]);\n```"},"filterText":"FromIterator","kind":8,"label":"FromIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"FromIterator","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A value-to-value conversion that consumes the input value. The\nopposite of [`From`].\n\nOne should avoid implementing [`Into`] and implement [`From`] instead.\nImplementing [`From`] automatically provides one with an implementation of [`Into`]\nthanks to the blanket implementation in the standard library.\n\nPrefer using [`Into`] over [`From`] when specifying trait bounds on a generic function\nto ensure that types that only implement [`Into`] can be used as well.\n\n**Note: This trait must not fail**. If the conversion can fail, use [`TryInto`].\n\n# Generic Implementations\n\n- [`From`]` for U` implies `Into for T`\n- [`Into`] is reflexive, which means that `Into for T` is implemented\n\n# Implementing [`Into`] for conversions to external types in old versions of Rust\n\nPrior to Rust 1.41, if the destination type was not part of the current crate\nthen you couldn't implement [`From`] directly.\nFor example, take this code:\n\n```rust\nstruct Wrapper(Vec);\nimpl From> for Vec {\n fn from(w: Wrapper) -> Vec {\n w.0\n }\n}\n```\nThis will fail to compile in older versions of the language because Rust's orphaning rules\nused to be a little bit more strict. To bypass this, you could implement [`Into`] directly:\n\n```rust\nstruct Wrapper(Vec);\nimpl Into> for Wrapper {\n fn into(self) -> Vec {\n self.0\n }\n}\n```\n\nIt is important to understand that [`Into`] does not provide a [`From`] implementation\n(as [`From`] does with [`Into`]). Therefore, you should always try to implement [`From`]\nand then fall back to [`Into`] if [`From`] can't be implemented.\n\n# Examples\n\n[`String`] implements [`Into`]`<`[`Vec`]`<`[`u8`]`>>`:\n\nIn order to express that we want a generic function to take all arguments that can be\nconverted to a specified type `T`, we can use a trait bound of [`Into`]``.\nFor example: The function `is_hello` takes all arguments that can be converted into a\n[`Vec`]`<`[`u8`]`>`.\n\n```rust\nfn is_hello>>(s: T) {\n let bytes = b\"hello\".to_vec();\n assert_eq!(bytes, s.into());\n}\n\nlet s = \"hello\".to_string();\nis_hello(s);\n```\n\n[`String`]: ../../std/string/struct.String.html\n[`Vec`]: ../../std/vec/struct.Vec.html"},"filterText":"Into","kind":8,"label":"Into","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Into","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Conversion into an [`Iterator`].\n\nBy implementing `IntoIterator` for a type, you define how it will be\nconverted to an iterator. This is common for types which describe a\ncollection of some kind.\n\nOne benefit of implementing `IntoIterator` is that your type will [work\nwith Rust's `for` loop syntax](crate::iter#for-loops-and-intoiterator).\n\nSee also: [`FromIterator`].\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = [1, 2, 3];\nlet mut iter = v.into_iter();\n\nassert_eq!(Some(1), iter.next());\nassert_eq!(Some(2), iter.next());\nassert_eq!(Some(3), iter.next());\nassert_eq!(None, iter.next());\n```\nImplementing `IntoIterator` for your type:\n\n```rust\n// A sample collection, that's just a wrapper over Vec\n#[derive(Debug)]\nstruct MyCollection(Vec);\n\n// Let's give it some methods so we can create one and add things\n// to it.\nimpl MyCollection {\n fn new() -> MyCollection {\n MyCollection(Vec::new())\n }\n\n fn add(&mut self, elem: i32) {\n self.0.push(elem);\n }\n}\n\n// and we'll implement IntoIterator\nimpl IntoIterator for MyCollection {\n type Item = i32;\n type IntoIter = std::vec::IntoIter;\n\n fn into_iter(self) -> Self::IntoIter {\n self.0.into_iter()\n }\n}\n\n// Now we can make a new collection...\nlet mut c = MyCollection::new();\n\n// ... add some stuff to it ...\nc.add(0);\nc.add(1);\nc.add(2);\n\n// ... and then turn it into an Iterator:\nfor (i, n) in c.into_iter().enumerate() {\n assert_eq!(i as i32, n);\n}\n```\n\nIt is common to use `IntoIterator` as a trait bound. This allows\nthe input collection type to change, so long as it is still an\niterator. Additional bounds can be specified by restricting on\n`Item`:\n\n```rust\nfn collect_as_strings(collection: T) -> Vec\nwhere\n T: IntoIterator,\n T::Item: std::fmt::Debug,\n{\n collection\n .into_iter()\n .map(|item| format!(\"{item:?}\"))\n .collect()\n}\n```"},"filterText":"IntoIterator","kind":8,"label":"IntoIterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"IntoIterator","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for dealing with iterators.\n\nThis is the main iterator trait. For more about the concept of iterators\ngenerally, please see the [module-level documentation]. In particular, you\nmay want to know how to [implement `Iterator`][impl].\n\n[module-level documentation]: crate::iter\n[impl]: crate::iter#implementing-iterator"},"filterText":"Iterator","kind":8,"label":"Iterator","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Iterator","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"None","documentation":{"kind":"markdown","value":"No value."},"filterText":"None","insertTextFormat":2,"kind":20,"label":"None","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"None$0","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Ok(T)","documentation":{"kind":"markdown","value":"Contains the success value"},"filterText":"Ok()","insertTextFormat":2,"kind":20,"label":"Ok(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Ok(${1:()})$0","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"The `Option` type. See [the module level documentation](self) for more."},"filterText":"Option","kind":13,"label":"Option","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Option","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for types that form a [total order](https://en.wikipedia.org/wiki/Total_order).\n\nImplementations must be consistent with the [`PartialOrd`] implementation, and ensure\n`max`, `min`, and `clamp` are consistent with `cmp`:\n\n- `partial_cmp(a, b) == Some(cmp(a, b))`.\n- `max(a, b) == max_by(a, b, cmp)` (ensured by the default implementation).\n- `min(a, b) == min_by(a, b, cmp)` (ensured by the default implementation).\n- For `a.clamp(min, max)`, see the [method docs](#method.clamp)\n (ensured by the default implementation).\n\nIt's easy to accidentally make `cmp` and `partial_cmp` disagree by\nderiving some of the traits and manually implementing others.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nFrom the above and the requirements of `PartialOrd`, it follows that for\nall `a`, `b` and `c`:\n\n- exactly one of `a < b`, `a == b` or `a > b` is true; and\n- `<` is transitive: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n\nMathematically speaking, the `<` operator defines a strict [weak order]. In\ncases where `==` conforms to mathematical equality, it also defines a\nstrict [total order].\n\n[weak order]: https://en.wikipedia.org/wiki/Weak_ordering\n[total order]: https://en.wikipedia.org/wiki/Total_order\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, Eq, PartialOrd, Ord)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## Lexicographical comparison\n\nLexicographical comparison is an operation with the following properties:\n - Two sequences are compared element by element.\n - The first mismatching element defines which sequence is lexicographically less or greater than the other.\n - If one sequence is a prefix of another, the shorter sequence is lexicographically less than the other.\n - If two sequences have equivalent elements and are of the same length, then the sequences are lexicographically equal.\n - An empty sequence is lexicographically less than any non-empty sequence.\n - Two empty sequences are lexicographically equal.\n\n## How can I implement `Ord`?\n\n`Ord` requires that the type also be [`PartialOrd`] and [`Eq`] (which requires [`PartialEq`]).\n\nThen you must define an implementation for [`cmp`]. You may find it useful to use\n[`cmp`] on your type's fields.\n\nHere's an example where you want to sort people by height only, disregarding `id`\nand `name`:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n[`cmp`]: Ord::cmp"},"filterText":"Ord","kind":8,"label":"Ord (alias <, >, <=, >=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Ord","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for comparisons using the equality operator.\n\nImplementing this trait for types provides the `==` and `!=` operators for\nthose types.\n\n`x.eq(y)` can also be written `x == y`, and `x.ne(y)` can be written `x != y`.\nWe use the easier-to-read infix notation in the remainder of this documentation.\n\nThis trait allows for comparisons using the equality operator, for types\nthat do not have a full equivalence relation. For example, in floating point\nnumbers `NaN != NaN`, so floating point types implement `PartialEq` but not\n[`trait@Eq`]. Formally speaking, when `Rhs == Self`, this trait corresponds\nto a [partial equivalence relation].\n\n[partial equivalence relation]: https://en.wikipedia.org/wiki/Partial_equivalence_relation\n\nImplementations must ensure that `eq` and `ne` are consistent with each other:\n\n- `a != b` if and only if `!(a == b)`.\n\nThe default implementation of `ne` provides this consistency and is almost\nalways sufficient. It should not be overridden without very good reason.\n\nIf [`PartialOrd`] or [`Ord`] are also implemented for `Self` and `Rhs`, their methods must also\nbe consistent with `PartialEq` (see the documentation of those traits for the exact\nrequirements). It's easy to accidentally make them disagree by deriving some of the traits and\nmanually implementing others.\n\nThe equality relation `==` must satisfy the following conditions\n(for all `a`, `b`, `c` of type `A`, `B`, `C`):\n\n- **Symmetric**: if `A: PartialEq` and `B: PartialEq`, then **`a == b`\n implies `b == a`**; and\n\n- **Transitive**: if `A: PartialEq` and `B: PartialEq` and `A:\n PartialEq`, then **`a == b` and `b == c` implies `a == c`**.\n\nNote that the `B: PartialEq` (symmetric) and `A: PartialEq`\n(transitive) impls are not forced to exist, but these requirements apply\nwhenever they do exist.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Derivable\n\nThis trait can be used with `#[derive]`. When `derive`d on structs, two\ninstances are equal if all fields are equal, and not equal if any fields\nare not equal. When `derive`d on enums, two instances are equal if they\nare the same variant and all fields are equal.\n\n## How can I implement `PartialEq`?\n\nAn example implementation for a domain in which two books are considered\nthe same book if their ISBN matches, even if the formats differ:\n\n```rust\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &Self) -> bool {\n self.isbn == other.isbn\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\nlet b2 = Book { isbn: 3, format: BookFormat::Ebook };\nlet b3 = Book { isbn: 10, format: BookFormat::Paperback };\n\nassert!(b1 == b2);\nassert!(b1 != b3);\n```\n\n## How can I compare two different types?\n\nThe type you can compare with is controlled by `PartialEq`'s type parameter.\nFor example, let's tweak our previous code a bit:\n\n```rust\n// The derive implements == comparisons\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\n// Implement == comparisons\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\n// Implement == comparisons\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nlet b1 = Book { isbn: 3, format: BookFormat::Paperback };\n\nassert!(b1 == BookFormat::Paperback);\nassert!(BookFormat::Ebook != b1);\n```\n\nBy changing `impl PartialEq for Book` to `impl PartialEq for Book`,\nwe allow `BookFormat`s to be compared with `Book`s.\n\nA comparison like the one above, which ignores some fields of the struct,\ncan be dangerous. It can easily lead to an unintended violation of the\nrequirements for a partial equivalence relation. For example, if we kept\nthe above implementation of `PartialEq` for `BookFormat` and added an\nimplementation of `PartialEq` for `Book` (either via a `#[derive]` or\nvia the manual implementation from the first example) then the result would\nviolate transitivity:\n\n```rust\n#[derive(PartialEq)]\nenum BookFormat {\n Paperback,\n Hardback,\n Ebook,\n}\n\n#[derive(PartialEq)]\nstruct Book {\n isbn: i32,\n format: BookFormat,\n}\n\nimpl PartialEq for Book {\n fn eq(&self, other: &BookFormat) -> bool {\n self.format == *other\n }\n}\n\nimpl PartialEq for BookFormat {\n fn eq(&self, other: &Book) -> bool {\n *self == other.format\n }\n}\n\nfn main() {\n let b1 = Book { isbn: 1, format: BookFormat::Paperback };\n let b2 = Book { isbn: 2, format: BookFormat::Paperback };\n\n assert!(b1 == BookFormat::Paperback);\n assert!(BookFormat::Paperback == b2);\n\n // The following should hold by transitivity but doesn't.\n assert!(b1 == b2); // <-- PANICS\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x == y, false);\nassert_eq!(x.eq(&y), false);\n```\n\n[`eq`]: PartialEq::eq\n[`ne`]: PartialEq::ne"},"filterText":"PartialEq","kind":8,"label":"PartialEq (alias ==, !=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"PartialEq","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Trait for types that form a [partial order](https://en.wikipedia.org/wiki/Partial_order).\n\nThe `lt`, `le`, `gt`, and `ge` methods of this trait can be called using\nthe `<`, `<=`, `>`, and `>=` operators, respectively.\n\nThe methods of this trait must be consistent with each other and with those of [`PartialEq`].\nThe following conditions must hold:\n\n1. `a == b` if and only if `partial_cmp(a, b) == Some(Equal)`.\n2. `a < b` if and only if `partial_cmp(a, b) == Some(Less)`\n3. `a > b` if and only if `partial_cmp(a, b) == Some(Greater)`\n4. `a <= b` if and only if `a < b || a == b`\n5. `a >= b` if and only if `a > b || a == b`\n6. `a != b` if and only if `!(a == b)`.\n\nConditions 2–5 above are ensured by the default implementation.\nCondition 6 is already ensured by [`PartialEq`].\n\nIf [`Ord`] is also implemented for `Self` and `Rhs`, it must also be consistent with\n`partial_cmp` (see the documentation of that trait for the exact requirements). It's\neasy to accidentally make them disagree by deriving some of the traits and manually\nimplementing others.\n\nThe comparison must satisfy, for all `a`, `b` and `c`:\n\n- transitivity: `a < b` and `b < c` implies `a < c`. The same must hold for both `==` and `>`.\n- duality: `a < b` if and only if `b > a`.\n\nNote that these requirements mean that the trait itself must be implemented symmetrically and\ntransitively: if `T: PartialOrd` and `U: PartialOrd` then `U: PartialOrd` and `T:\nPartialOrd`.\n\nViolating these requirements is a logic error. The behavior resulting from a logic error is not\nspecified, but users of the trait must ensure that such logic errors do *not* result in\nundefined behavior. This means that `unsafe` code **must not** rely on the correctness of these\nmethods.\n\n## Corollaries\n\nThe following corollaries follow from the above requirements:\n\n- irreflexivity of `<` and `>`: `!(a < a)`, `!(a > a)`\n- transitivity of `>`: if `a > b` and `b > c` then `a > c`\n- duality of `partial_cmp`: `partial_cmp(a, b) == partial_cmp(b, a).map(Ordering::reverse)`\n\n## Strict and non-strict partial orders\n\nThe `<` and `>` operators behave according to a *strict* partial order.\nHowever, `<=` and `>=` do **not** behave according to a *non-strict*\npartial order.\nThat is because mathematically, a non-strict partial order would require\nreflexivity, i.e. `a <= a` would need to be true for every `a`. This isn't\nalways the case for types that implement `PartialOrd`, for example:\n\n```rust\nlet a = f64::sqrt(-1.0);\nassert_eq!(a <= a, false);\n```\n\n## Derivable\n\nThis trait can be used with `#[derive]`.\n\nWhen `derive`d on structs, it will produce a\n[lexicographic](https://en.wikipedia.org/wiki/Lexicographic_order) ordering\nbased on the top-to-bottom declaration order of the struct's members.\n\nWhen `derive`d on enums, variants are ordered by their discriminants.\nBy default, the discriminant is smallest for variants at the top, and\nlargest for variants at the bottom. Here's an example:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top,\n Bottom,\n}\n\nassert!(E::Top < E::Bottom);\n```\n\nHowever, manually setting the discriminants can override this default\nbehavior:\n\n```rust\n#[derive(PartialEq, PartialOrd)]\nenum E {\n Top = 2,\n Bottom = 1,\n}\n\nassert!(E::Bottom < E::Top);\n```\n\n## How can I implement `PartialOrd`?\n\n`PartialOrd` only requires implementation of the [`partial_cmp`] method, with the others\ngenerated from default implementations.\n\nHowever it remains possible to implement the others separately for types which do not have a\ntotal order. For example, for floating point numbers, `NaN < 0 == false` and `NaN >= 0 ==\nfalse` (cf. IEEE 754-2008 section 5.11).\n\n`PartialOrd` requires your type to be [`PartialEq`].\n\nIf your type is [`Ord`], you can implement [`partial_cmp`] by using [`cmp`]:\n\n```rust\nuse std::cmp::Ordering;\n\n#[derive(Eq)]\nstruct Person {\n id: u32,\n name: String,\n height: u32,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n Some(self.cmp(other))\n }\n}\n\nimpl Ord for Person {\n fn cmp(&self, other: &Self) -> Ordering {\n self.height.cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\nYou may also find it useful to use [`partial_cmp`] on your type's fields. Here\nis an example of `Person` types who have a floating-point `height` field that\nis the only field to be used for sorting:\n\n```rust\nuse std::cmp::Ordering;\n\nstruct Person {\n id: u32,\n name: String,\n height: f64,\n}\n\nimpl PartialOrd for Person {\n fn partial_cmp(&self, other: &Self) -> Option {\n self.height.partial_cmp(&other.height)\n }\n}\n\nimpl PartialEq for Person {\n fn eq(&self, other: &Self) -> bool {\n self.height == other.height\n }\n}\n```\n\n# Examples\n\n```rust\nlet x: u32 = 0;\nlet y: u32 = 1;\n\nassert_eq!(x < y, true);\nassert_eq!(x.lt(&y), true);\n```\n\n[`partial_cmp`]: PartialOrd::partial_cmp\n[`cmp`]: Ord::cmp"},"filterText":"PartialOrd","kind":8,"label":"PartialOrd (alias >, <, <=, >=)","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"PartialOrd","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"`Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]).\n\nSee the [module documentation](self) for details."},"filterText":"Result","kind":13,"label":"Result","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Result","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"RustcDecodable","kind":18,"label":"RustcDecodable","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"RustcDecodable","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"RustcEncodable","kind":18,"label":"RustcEncodable","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"RustcEncodable","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"Some(T)","documentation":{"kind":"markdown","value":"Some value of type `T`."},"filterText":"Some()","insertTextFormat":2,"kind":20,"label":"Some(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Some(${1:()})$0","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A UTF-8–encoded, growable string.\n\nThe `String` type is the most common string type that has ownership over the\ncontents of the string. It has a close relationship with its borrowed\ncounterpart, the primitive [`str`].\n\n# Examples\n\nYou can create a `String` from [a literal string][`&str`] with [`String::from`]:\n\n[`String::from`]: From::from\n\n```rust\nlet hello = String::from(\"Hello, world!\");\n```\n\nYou can append a [`char`] to a `String` with the [`push`] method, and\nappend a [`&str`] with the [`push_str`] method:\n\n```rust\nlet mut hello = String::from(\"Hello, \");\n\nhello.push('w');\nhello.push_str(\"orld!\");\n```\n\n[`push`]: String::push\n[`push_str`]: String::push_str\n\nIf you have a vector of UTF-8 bytes, you can create a `String` from it with\nthe [`from_utf8`] method:\n\n```rust\n// some bytes, in a vector\nlet sparkle_heart = vec![240, 159, 146, 150];\n\n// We know these bytes are valid, so we'll use `unwrap()`.\nlet sparkle_heart = String::from_utf8(sparkle_heart).unwrap();\n\nassert_eq!(\"💖\", sparkle_heart);\n```\n\n[`from_utf8`]: String::from_utf8\n\n# UTF-8\n\n`String`s are always valid UTF-8. If you need a non-UTF-8 string, consider\n[`OsString`]. It is similar, but without the UTF-8 constraint. Because UTF-8\nis a variable width encoding, `String`s are typically smaller than an array of\nthe same `chars`:\n\n```rust\nuse std::mem;\n\n// `s` is ASCII which represents each `char` as one byte\nlet s = \"hello\";\nassert_eq!(s.len(), 5);\n\n// A `char` array with the same contents would be longer because\n// every `char` is four bytes\nlet s = ['h', 'e', 'l', 'l', 'o'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n\n// However, for non-ASCII strings, the difference will be smaller\n// and sometimes they are the same\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.len(), 20);\n\nlet s = ['💖', '💖', '💖', '💖', '💖'];\nlet size: usize = s.into_iter().map(|c| mem::size_of_val(&c)).sum();\nassert_eq!(size, 20);\n```\n\nThis raises interesting questions as to how `s[i]` should work.\nWhat should `i` be here? Several options include byte indices and\n`char` indices but, because of UTF-8 encoding, only byte indices\nwould provide constant time indexing. Getting the `i`th `char`, for\nexample, is available using [`chars`]:\n\n```rust\nlet s = \"hello\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('l'));\n\nlet s = \"💖💖💖💖💖\";\nlet third_character = s.chars().nth(2);\nassert_eq!(third_character, Some('💖'));\n```\n\nNext, what should `s[i]` return? Because indexing returns a reference\nto underlying data it could be `&u8`, `&[u8]`, or something else similar.\nSince we're only providing one index, `&u8` makes the most sense but that\nmight not be what the user expects and can be explicitly achieved with\n[`as_bytes()`]:\n\n```rust\n// The first byte is 104 - the byte value of `'h'`\nlet s = \"hello\";\nassert_eq!(s.as_bytes()[0], 104);\n// or\nassert_eq!(s.as_bytes()[0], b'h');\n\n// The first byte is 240 which isn't obviously useful\nlet s = \"💖💖💖💖💖\";\nassert_eq!(s.as_bytes()[0], 240);\n```\n\nDue to these ambiguities/restrictions, indexing with a `usize` is simply\nforbidden:\n\n```rust\nlet s = \"hello\";\n\n// The following will not compile!\nprintln!(\"The first letter of s is {}\", s[0]);\n```\n\nIt is more clear, however, how `&s[i..j]` should work (that is,\nindexing with a range). It should accept byte indices (to be constant-time)\nand return a `&str` which is UTF-8 encoded. This is also called \"string slicing\".\nNote this will panic if the byte indices provided are not character\nboundaries - see [`is_char_boundary`] for more details. See the implementations\nfor [`SliceIndex`] for more details on string slicing. For a non-panicking\nversion of string slicing, see [`get`].\n\n[`OsString`]: ../../std/ffi/struct.OsString.html \"ffi::OsString\"\n[`SliceIndex`]: core::slice::SliceIndex\n[`as_bytes()`]: str::as_bytes\n[`get`]: str::get\n[`is_char_boundary`]: str::is_char_boundary\n\nThe [`bytes`] and [`chars`] methods return iterators over the bytes and\ncodepoints of the string, respectively. To iterate over codepoints along\nwith byte indices, use [`char_indices`].\n\n[`bytes`]: str::bytes\n[`chars`]: str::chars\n[`char_indices`]: str::char_indices\n\n# Deref\n\n`String` implements [Deref], and so inherits all of [`str`]'s\nmethods. In addition, this means that you can pass a `String` to a\nfunction which takes a [`&str`] by using an ampersand (`&`):\n\n```rust\nfn takes_str(s: &str) { }\n\nlet s = String::from(\"Hello\");\n\ntakes_str(&s);\n```\n\nThis will create a [`&str`] from the `String` and pass it in. This\nconversion is very inexpensive, and so generally, functions will accept\n[`&str`]s as arguments unless they need a `String` for some specific\nreason.\n\nIn certain cases Rust doesn't have enough information to make this\nconversion, known as [`Deref`] coercion. In the following example a string\nslice [`&'a str`][`&str`] implements the trait `TraitExample`, and the function\n`example_func` takes anything that implements the trait. In this case Rust\nwould need to make two implicit conversions, which Rust doesn't have the\nmeans to do. For that reason, the following example will not compile.\n\n```rust\ntrait TraitExample {}\n\nimpl<'a> TraitExample for &'a str {}\n\nfn example_func(example_arg: A) {}\n\nlet example_string = String::from(\"example_string\");\nexample_func(&example_string);\n```\n\nThere are two options that would work instead. The first would be to\nchange the line `example_func(&example_string);` to\n`example_func(example_string.as_str());`, using the method [`as_str()`]\nto explicitly extract the string slice containing the string. The second\nway changes `example_func(&example_string);` to\n`example_func(&*example_string);`. In this case we are dereferencing a\n`String` to a [`str`], then referencing the [`str`] back to\n[`&str`]. The second way is more idiomatic, however both work to do the\nconversion explicitly rather than relying on the implicit conversion.\n\n# Representation\n\nA `String` is made up of three components: a pointer to some bytes, a\nlength, and a capacity. The pointer points to an internal buffer `String`\nuses to store its data. The length is the number of bytes currently stored\nin the buffer, and the capacity is the size of the buffer in bytes. As such,\nthe length will always be less than or equal to the capacity.\n\nThis buffer is always stored on the heap.\n\nYou can look at these with the [`as_ptr`], [`len`], and [`capacity`]\nmethods:\n\n```rust\nuse std::mem;\n\nlet story = String::from(\"Once upon a time...\");\n\n// Prevent automatically dropping the String's data\nlet mut story = mem::ManuallyDrop::new(story);\n\nlet ptr = story.as_mut_ptr();\nlet len = story.len();\nlet capacity = story.capacity();\n\n// story has nineteen bytes\nassert_eq!(19, len);\n\n// We can re-build a String out of ptr, len, and capacity. This is all\n// unsafe because we are responsible for making sure the components are\n// valid:\nlet s = unsafe { String::from_raw_parts(ptr, len, capacity) } ;\n\nassert_eq!(String::from(\"Once upon a time...\"), s);\n```\n\n[`as_ptr`]: str::as_ptr\n[`len`]: String::len\n[`capacity`]: String::capacity\n\nIf a `String` has enough capacity, adding elements to it will not\nre-allocate. For example, consider this program:\n\n```rust\nlet mut s = String::new();\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\nThis will output the following:\n\n```text\n0\n8\n16\n16\n32\n32\n```\n\nAt first, we have no memory allocated at all, but as we append to the\nstring, it increases its capacity appropriately. If we instead use the\n[`with_capacity`] method to allocate the correct capacity initially:\n\n```rust\nlet mut s = String::with_capacity(25);\n\nprintln!(\"{}\", s.capacity());\n\nfor _ in 0..5 {\n s.push_str(\"hello\");\n println!(\"{}\", s.capacity());\n}\n```\n\n[`with_capacity`]: String::with_capacity\n\nWe end up with a different output:\n\n```text\n25\n25\n25\n25\n25\n25\n```\n\nHere, there's no need to allocate more memory inside the loop.\n\n[str]: prim@str \"str\"\n[`str`]: prim@str \"str\"\n[`&str`]: prim@str \"&str\"\n[Deref]: core::ops::Deref \"ops::Deref\"\n[`Deref`]: core::ops::Deref \"ops::Deref\"\n[`as_str()`]: String::as_str"},"filterText":"String","kind":22,"label":"String","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"String","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A generalization of `Clone` to borrowed data.\n\nSome types make it possible to go from borrowed to owned, usually by\nimplementing the `Clone` trait. But `Clone` works only for going from `&T`\nto `T`. The `ToOwned` trait generalizes `Clone` to construct owned data\nfrom any borrow of a given type."},"filterText":"ToOwned","kind":8,"label":"ToOwned","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"ToOwned","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A trait for converting a value to a `String`.\n\nThis trait is automatically implemented for any type which implements the\n[`Display`] trait. As such, `ToString` shouldn't be implemented directly:\n[`Display`] should be implemented instead, and you get the `ToString`\nimplementation for free.\n\n[`Display`]: fmt::Display"},"filterText":"ToString","kind":8,"label":"ToString","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"ToString","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"Simple and safe type conversions that may fail in a controlled\nway under some circumstances. It is the reciprocal of [`TryInto`].\n\nThis is useful when you are doing a type conversion that may\ntrivially succeed but may also need special handling.\nFor example, there is no way to convert an [`i64`] into an [`i32`]\nusing the [`From`] trait, because an [`i64`] may contain a value\nthat an [`i32`] cannot represent and so the conversion would lose data.\nThis might be handled by truncating the [`i64`] to an [`i32`] or by\nsimply returning [`i32::MAX`], or by some other method. The [`From`]\ntrait is intended for perfect conversions, so the `TryFrom` trait\ninforms the programmer when a type conversion could go bad and lets\nthem decide how to handle it.\n\n# Generic Implementations\n\n- `TryFrom for U` implies [`TryInto`]` for T`\n- [`try_from`] is reflexive, which means that `TryFrom for T`\nis implemented and cannot fail -- the associated `Error` type for\ncalling `T::try_from()` on a value of type `T` is [`Infallible`].\nWhen the [`!`] type is stabilized [`Infallible`] and [`!`] will be\nequivalent.\n\n`TryFrom` can be implemented as follows:\n\n```rust\nstruct GreaterThanZero(i32);\n\nimpl TryFrom for GreaterThanZero {\n type Error = &'static str;\n\n fn try_from(value: i32) -> Result {\n if value <= 0 {\n Err(\"GreaterThanZero only accepts values greater than zero!\")\n } else {\n Ok(GreaterThanZero(value))\n }\n }\n}\n```\n\n# Examples\n\nAs described, [`i32`] implements `TryFrom<`[`i64`]`>`:\n\n```rust\nlet big_number = 1_000_000_000_000i64;\n// Silently truncates `big_number`, requires detecting\n// and handling the truncation after the fact.\nlet smaller_number = big_number as i32;\nassert_eq!(smaller_number, -727379968);\n\n// Returns an error because `big_number` is too big to\n// fit in an `i32`.\nlet try_smaller_number = i32::try_from(big_number);\nassert!(try_smaller_number.is_err());\n\n// Returns `Ok(3)`.\nlet try_successful_smaller_number = i32::try_from(3);\nassert!(try_successful_smaller_number.is_ok());\n```\n\n[`try_from`]: TryFrom::try_from"},"filterText":"TryFrom","kind":8,"label":"TryFrom","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"TryFrom","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"An attempted conversion that consumes `self`, which may or may not be\nexpensive.\n\nLibrary authors should usually not directly implement this trait,\nbut should prefer implementing the [`TryFrom`] trait, which offers\ngreater flexibility and provides an equivalent `TryInto`\nimplementation for free, thanks to a blanket implementation in the\nstandard library. For more information on this, see the\ndocumentation for [`Into`].\n\n# Implementing `TryInto`\n\nThis suffers the same restrictions and reasoning as implementing\n[`Into`], see there for details."},"filterText":"TryInto","kind":8,"label":"TryInto","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"TryInto","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"documentation":{"kind":"markdown","value":"A contiguous growable array type, written as `Vec`, short for 'vector'.\n\n# Examples\n\n```rust\nlet mut vec = Vec::new();\nvec.push(1);\nvec.push(2);\n\nassert_eq!(vec.len(), 2);\nassert_eq!(vec[0], 1);\n\nassert_eq!(vec.pop(), Some(2));\nassert_eq!(vec.len(), 1);\n\nvec[0] = 7;\nassert_eq!(vec[0], 7);\n\nvec.extend([1, 2, 3]);\n\nfor x in &vec {\n println!(\"{x}\");\n}\nassert_eq!(vec, [7, 1, 2, 3]);\n```\n\nThe [`vec!`] macro is provided for convenient initialization:\n\n```rust\nlet mut vec1 = vec![1, 2, 3];\nvec1.push(4);\nlet vec2 = Vec::from([1, 2, 3, 4]);\nassert_eq!(vec1, vec2);\n```\n\nIt can also initialize each element of a `Vec` with a given value.\nThis may be more efficient than performing allocation and initialization\nin separate steps, especially when initializing a vector of zeros:\n\n```rust\nlet vec = vec![0; 5];\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n\n// The following is equivalent, but potentially slower:\nlet mut vec = Vec::with_capacity(5);\nvec.resize(5, 0);\nassert_eq!(vec, [0, 0, 0, 0, 0]);\n```\n\nFor more information, see\n[Capacity and Reallocation](#capacity-and-reallocation).\n\nUse a `Vec` as an efficient stack:\n\n```rust\nlet mut stack = Vec::new();\n\nstack.push(1);\nstack.push(2);\nstack.push(3);\n\nwhile let Some(top) = stack.pop() {\n // Prints 3, 2, 1\n println!(\"{top}\");\n}\n```\n\n# Indexing\n\nThe `Vec` type allows access to values by index, because it implements the\n[`Index`] trait. An example will be more explicit:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[1]); // it will display '2'\n```\n\nHowever be careful: if you try to access an index which isn't in the `Vec`,\nyour software will panic! You cannot do this:\n\n```rust\nlet v = vec![0, 2, 4, 6];\nprintln!(\"{}\", v[6]); // it will panic!\n```\n\nUse [`get`] and [`get_mut`] if you want to check whether the index is in\nthe `Vec`.\n\n# Slicing\n\nA `Vec` can be mutable. On the other hand, slices are read-only objects.\nTo get a [slice][prim@slice], use [`&`]. Example:\n\n```rust\nfn read_slice(slice: &[usize]) {\n // ...\n}\n\nlet v = vec![0, 1];\nread_slice(&v);\n\n// ... and that's all!\n// you can also do it like this:\nlet u: &[usize] = &v;\n// or like this:\nlet u: &[_] = &v;\n```\n\nIn Rust, it's more common to pass slices as arguments rather than vectors\nwhen you just want to provide read access. The same goes for [`String`] and\n[`&str`].\n\n# Capacity and reallocation\n\nThe capacity of a vector is the amount of space allocated for any future\nelements that will be added onto the vector. This is not to be confused with\nthe *length* of a vector, which specifies the number of actual elements\nwithin the vector. If a vector's length exceeds its capacity, its capacity\nwill automatically be increased, but its elements will have to be\nreallocated.\n\nFor example, a vector with capacity 10 and length 0 would be an empty vector\nwith space for 10 more elements. Pushing 10 or fewer elements onto the\nvector will not change its capacity or cause reallocation to occur. However,\nif the vector's length is increased to 11, it will have to reallocate, which\ncan be slow. For this reason, it is recommended to use [`Vec::with_capacity`]\nwhenever possible to specify how big the vector is expected to get.\n\n# Guarantees\n\nDue to its incredibly fundamental nature, `Vec` makes a lot of guarantees\nabout its design. This ensures that it's as low-overhead as possible in\nthe general case, and can be correctly manipulated in primitive ways\nby unsafe code. Note that these guarantees refer to an unqualified `Vec`.\nIf additional type parameters are added (e.g., to support custom allocators),\noverriding their defaults may change the behavior.\n\nMost fundamentally, `Vec` is and always will be a (pointer, capacity, length)\ntriplet. No more, no less. The order of these fields is completely\nunspecified, and you should use the appropriate methods to modify these.\nThe pointer will never be null, so this type is null-pointer-optimized.\n\nHowever, the pointer might not actually point to allocated memory. In particular,\nif you construct a `Vec` with capacity 0 via [`Vec::new`], [`vec![]`][`vec!`],\n[`Vec::with_capacity(0)`][`Vec::with_capacity`], or by calling [`shrink_to_fit`]\non an empty Vec, it will not allocate memory. Similarly, if you store zero-sized\ntypes inside a `Vec`, it will not allocate space for them. *Note that in this case\nthe `Vec` might not report a [`capacity`] of 0*. `Vec` will allocate if and only\nif [mem::size_of::\\]\\() * [capacity]\\() > 0. In general, `Vec`'s allocation\ndetails are very subtle --- if you intend to allocate memory using a `Vec`\nand use it for something else (either to pass to unsafe code, or to build your\nown memory-backed collection), be sure to deallocate this memory by using\n`from_raw_parts` to recover the `Vec` and then dropping it.\n\nIf a `Vec` *has* allocated memory, then the memory it points to is on the heap\n(as defined by the allocator Rust is configured to use by default), and its\npointer points to [`len`] initialized, contiguous elements in order (what\nyou would see if you coerced it to a slice), followed by [capacity] - [len]\nlogically uninitialized, contiguous elements.\n\nA vector containing the elements `'a'` and `'b'` with capacity 4 can be\nvisualized as below. The top part is the `Vec` struct, it contains a\npointer to the head of the allocation in the heap, length and capacity.\nThe bottom part is the allocation on the heap, a contiguous memory block.\n\n```text\n ptr len capacity\n +--------+--------+--------+\n | 0x0123 | 2 | 4 |\n +--------+--------+--------+\n |\n v\nHeap +--------+--------+--------+--------+\n | 'a' | 'b' | uninit | uninit |\n +--------+--------+--------+--------+\n```\n\n- **uninit** represents memory that is not initialized, see [`MaybeUninit`].\n- Note: the ABI is not stable and `Vec` makes no guarantees about its memory\n layout (including the order of fields).\n\n`Vec` will never perform a \"small optimization\" where elements are actually\nstored on the stack for two reasons:\n\n* It would make it more difficult for unsafe code to correctly manipulate\n a `Vec`. The contents of a `Vec` wouldn't have a stable address if it were\n only moved, and it would be more difficult to determine if a `Vec` had\n actually allocated memory.\n\n* It would penalize the general case, incurring an additional branch\n on every access.\n\n`Vec` will never automatically shrink itself, even if completely empty. This\nensures no unnecessary allocations or deallocations occur. Emptying a `Vec`\nand then filling it back up to the same [`len`] should incur no calls to\nthe allocator. If you wish to free up unused memory, use\n[`shrink_to_fit`] or [`shrink_to`].\n\n[`push`] and [`insert`] will never (re)allocate if the reported capacity is\nsufficient. [`push`] and [`insert`] *will* (re)allocate if\n[len] == [capacity]. That is, the reported capacity is completely\naccurate, and can be relied on. It can even be used to manually free the memory\nallocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even\nwhen not necessary.\n\n`Vec` does not guarantee any particular growth strategy when reallocating\nwhen full, nor when [`reserve`] is called. The current strategy is basic\nand it may prove desirable to use a non-constant growth factor. Whatever\nstrategy is used will of course guarantee *O*(1) amortized [`push`].\n\n`vec![x; n]`, `vec![a, b, c, d]`, and\n[`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`\nwith exactly the requested capacity. If [len] == [capacity],\n(as is the case for the [`vec!`] macro), then a `Vec` can be converted to\nand from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.\n\n`Vec` will not specifically overwrite any data that is removed from it,\nbut also won't specifically preserve it. Its uninitialized memory is\nscratch space that it may use however it wants. It will generally just do\nwhatever is most efficient or otherwise easy to implement. Do not rely on\nremoved data to be erased for security purposes. Even if you drop a `Vec`, its\nbuffer may simply be reused by another allocation. Even if you zero a `Vec`'s memory\nfirst, that might not actually happen because the optimizer does not consider\nthis a side-effect that must be preserved. There is one case which we will\nnot break, however: using `unsafe` code to write to the excess capacity,\nand then increasing the length to match, is always valid.\n\nCurrently, `Vec` does not guarantee the order in which elements are dropped.\nThe order has changed in the past and may change again.\n\n[`get`]: slice::get\n[`get_mut`]: slice::get_mut\n[`String`]: crate::string::String\n[`&str`]: type@str\n[`shrink_to_fit`]: Vec::shrink_to_fit\n[`shrink_to`]: Vec::shrink_to\n[capacity]: Vec::capacity\n[`capacity`]: Vec::capacity\n[mem::size_of::\\]: core::mem::size_of\n[len]: Vec::len\n[`len`]: Vec::len\n[`push`]: Vec::push\n[`insert`]: Vec::insert\n[`reserve`]: Vec::reserve\n[`MaybeUninit`]: core::mem::MaybeUninit\n[owned slice]: Box"},"filterText":"Vec","kind":22,"label":"Vec","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"Vec","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"alloc_error_handler","kind":18,"label":"alloc_error_handler","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"alloc_error_handler","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"command":{"command":"rust-analyzer.triggerParameterHints","title":"triggerParameterHints"},"deprecated":false,"detail":"fn(T)","documentation":{"kind":"markdown","value":"Disposes of a value.\n\nThis does so by calling the argument's implementation of [`Drop`][drop].\n\nThis effectively does nothing for types which implement `Copy`, e.g.\nintegers. Such values are copied and _then_ moved into the function, so the\nvalue persists after this function call.\n\nThis function is not magic; it is literally defined as\n\n```rust\npub fn drop(_x: T) {}\n```\n\nBecause `_x` is moved into the function, it is automatically dropped before\nthe function returns.\n\n[drop]: Drop\n\n# Examples\n\nBasic usage:\n\n```rust\nlet v = vec![1, 2, 3];\n\ndrop(v); // explicitly drop the vector\n```\n\nSince [`RefCell`] enforces the borrow rules at runtime, `drop` can\nrelease a [`RefCell`] borrow:\n\n```rust\nuse std::cell::RefCell;\n\nlet x = RefCell::new(1);\n\nlet mut mutable_borrow = x.borrow_mut();\n*mutable_borrow = 1;\n\ndrop(mutable_borrow); // relinquish the mutable borrow on this slot\n\nlet borrow = x.borrow();\nprintln!(\"{}\", *borrow);\n```\n\nIntegers and other types implementing [`Copy`] are unaffected by `drop`.\n\n```rust\n#[derive(Copy, Clone)]\nstruct Foo(u8);\n\nlet x = 1;\nlet y = Foo(2);\ndrop(x); // a copy of `x` is moved and dropped\ndrop(y); // a copy of `y` is moved and dropped\n\nprintln!(\"x: {}, y: {}\", x, y.0); // still available\n```\n\n[`RefCell`]: crate::cell::RefCell"},"filterText":"drop","insertTextFormat":2,"kind":3,"label":"drop(…)","preselect":true,"sortText":"ffffffec","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"drop(${1:x})$0","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"type_ascribe","kind":18,"label":"type_ascribe","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"type_ascribe","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"unsafe","insertTextFormat":2,"kind":14,"label":"unsafe","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"unsafe {\n $0\n};","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"match","insertTextFormat":2,"kind":14,"label":"match","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"match $1 {\n $0\n};","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"while","insertTextFormat":2,"kind":14,"label":"while","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"while $1 {\n $0\n};","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"while let","insertTextFormat":2,"kind":14,"label":"while let","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"while let $1 = $2 {\n $0\n};","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"loop","insertTextFormat":2,"kind":14,"label":"loop","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"loop {\n $0\n};","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"if","insertTextFormat":2,"kind":14,"label":"if","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"if $1 {\n $0\n};","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"if let","insertTextFormat":2,"kind":14,"label":"if let","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"if let $1 = $2 {\n $0\n};","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"for","insertTextFormat":2,"kind":14,"label":"for","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"for $1 in $2 {\n $0\n};","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"true","insertTextFormat":2,"kind":14,"label":"true","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"true","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"false","insertTextFormat":2,"kind":14,"label":"false","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"false","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}},{"additionalTextEdits":[],"deprecated":false,"filterText":"return","insertTextFormat":2,"kind":14,"label":"return","sortText":"ffffffef","textEdit":{"insert":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}},"newText":"return","replace":{"end":{"character":25,"line":1},"start":{"character":12,"line":1}}}}]} 2023-12-27T20:29:13.809 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"shutdown","id":6} 2023-12-27T20:29:13.809 helix_lsp::transport [INFO] rust-analyzer <- {"jsonrpc":"2.0","id":6,"result":null} 2023-12-27T20:29:13.809 helix_lsp::transport [INFO] rust-analyzer <- null 2023-12-27T20:29:13.809 helix_lsp::transport [INFO] rust-analyzer -> {"jsonrpc":"2.0","method":"exit"}