[{"data":1,"prerenderedAt":1358},["ShallowReactive",2],{"page-\u002Frust\u002F32-documentation":3},{"id":4,"title":5,"body":6,"description":1350,"extension":1351,"meta":1352,"navigation":1353,"path":1354,"seo":1355,"stem":1356,"__hash__":1357},"content\u002Frust\u002F32-documentation.md","32 — Documentation",{"type":7,"value":8,"toc":1325},"minimark",[9,13,26,31,173,188,210,214,315,318,322,344,347,364,368,438,445,449,472,510,534,538,621,625,662,668,672,720,723,730,759,762,766,803,807,812,921,925,964,968,1003,1010,1014,1070,1077,1083,1119,1133,1137,1148,1177,1196,1200,1217,1223,1227,1291,1295,1318,1321],[10,11,5],"h1",{"id":12},"_32-documentation",[14,15,16,17,21,22,25],"p",{},"Documentation is part of the Rust culture. ",[18,19,20],"code",{},"rustdoc"," produces HTML docs from ",[18,23,24],{},"\u002F\u002F\u002F"," comments; doc-tests run examples.",[27,28,30],"h2",{"id":29},"doc-comments","Doc Comments",[32,33,35],"code-wrapper",{"language":34},"rust",[36,37,41],"pre",{"className":38,"code":39,"language":34,"meta":40,"style":40},"language-rust shiki shiki-themes github-light github-dark","\u002F\u002F\u002F Adds two integers.\n\u002F\u002F\u002F\n\u002F\u002F\u002F Returns `a + b`, panicking on overflow in debug builds.\n\u002F\u002F\u002F\n\u002F\u002F\u002F # Examples\n\u002F\u002F\u002F\n\u002F\u002F\u002F ```\n\u002F\u002F\u002F use my_crate::add;\n\u002F\u002F\u002F assert_eq!(add(2, 2), 4);\n\u002F\u002F\u002F ```\n\u002F\u002F\u002F\n\u002F\u002F\u002F # Panics\n\u002F\u002F\u002F\n\u002F\u002F\u002F Panics if `a + b` overflows in debug mode.\npub fn add(a: i32, b: i32) -> i32 { a + b }\n","",[18,42,43,52,58,64,69,75,80,86,92,98,103,108,114,119,125],{"__ignoreMap":40},[44,45,48],"span",{"class":46,"line":47},"line",1,[44,49,51],{"class":50},"sdCPZ","\u002F\u002F\u002F Adds two integers.\n",[44,53,55],{"class":46,"line":54},2,[44,56,57],{"class":50},"\u002F\u002F\u002F\n",[44,59,61],{"class":46,"line":60},3,[44,62,63],{"class":50},"\u002F\u002F\u002F Returns `a + b`, panicking on overflow in debug builds.\n",[44,65,67],{"class":46,"line":66},4,[44,68,57],{"class":50},[44,70,72],{"class":46,"line":71},5,[44,73,74],{"class":50},"\u002F\u002F\u002F # Examples\n",[44,76,78],{"class":46,"line":77},6,[44,79,57],{"class":50},[44,81,83],{"class":46,"line":82},7,[44,84,85],{"class":50},"\u002F\u002F\u002F ```\n",[44,87,89],{"class":46,"line":88},8,[44,90,91],{"class":50},"\u002F\u002F\u002F use my_crate::add;\n",[44,93,95],{"class":46,"line":94},9,[44,96,97],{"class":50},"\u002F\u002F\u002F assert_eq!(add(2, 2), 4);\n",[44,99,101],{"class":46,"line":100},10,[44,102,85],{"class":50},[44,104,106],{"class":46,"line":105},11,[44,107,57],{"class":50},[44,109,111],{"class":46,"line":110},12,[44,112,113],{"class":50},"\u002F\u002F\u002F # Panics\n",[44,115,117],{"class":46,"line":116},13,[44,118,57],{"class":50},[44,120,122],{"class":46,"line":121},14,[44,123,124],{"class":50},"\u002F\u002F\u002F Panics if `a + b` overflows in debug mode.\n",[44,126,128,132,135,139,143,146,149,152,154,156,159,162,164,167,170],{"class":46,"line":127},15,[44,129,131],{"class":130},"svdQ7","pub",[44,133,134],{"class":130}," fn",[44,136,138],{"class":137},"sIsaT"," add",[44,140,142],{"class":141},"ssxIu","(a",[44,144,145],{"class":130},":",[44,147,148],{"class":137}," i32",[44,150,151],{"class":141},", b",[44,153,145],{"class":130},[44,155,148],{"class":137},[44,157,158],{"class":141},") ",[44,160,161],{"class":130},"->",[44,163,148],{"class":137},[44,165,166],{"class":141}," { a ",[44,168,169],{"class":130},"+",[44,171,172],{"class":141}," b }\n",[174,175,176,182],"ul",{},[177,178,179,181],"li",{},[18,180,24],{}," for items (functions, types, modules).",[177,183,184,187],{},[18,185,186],{},"\u002F\u002F!"," for the enclosing item (crate root, module — used for top-level docs).",[32,189,190],{"language":34},[36,191,193],{"className":38,"code":192,"language":34,"meta":40,"style":40},"\u002F\u002F! # My Crate\n\u002F\u002F!\n\u002F\u002F! This crate provides wonderful things.\n",[18,194,195,200,205],{"__ignoreMap":40},[44,196,197],{"class":46,"line":47},[44,198,199],{"class":50},"\u002F\u002F! # My Crate\n",[44,201,202],{"class":46,"line":54},[44,203,204],{"class":50},"\u002F\u002F!\n",[44,206,207],{"class":46,"line":60},[44,208,209],{"class":50},"\u002F\u002F! This crate provides wonderful things.\n",[27,211,213],{"id":212},"standard-sections","Standard Sections",[215,216,217,230],"table",{},[218,219,220],"thead",{},[221,222,223,227],"tr",{},[224,225,226],"th",{},"Section",[224,228,229],{},"Purpose",[231,232,233,244,254,272,285,295,305],"tbody",{},[221,234,235,241],{},[236,237,238],"td",{},[18,239,240],{},"# Examples",[236,242,243],{},"Usage examples (run as doc tests).",[221,245,246,251],{},[236,247,248],{},[18,249,250],{},"# Panics",[236,252,253],{},"When the function panics.",[221,255,256,261],{},[236,257,258],{},[18,259,260],{},"# Errors",[236,262,263,264,267,268,271],{},"For ",[18,265,266],{},"Result","-returning functions: which ",[18,269,270],{},"Err"," variants.",[221,273,274,279],{},[236,275,276],{},[18,277,278],{},"# Safety",[236,280,263,281,284],{},[18,282,283],{},"unsafe"," functions: required invariants.",[221,286,287,292],{},[236,288,289],{},[18,290,291],{},"# Arguments",[236,293,294],{},"Parameter docs (sometimes redundant with prose).",[221,296,297,302],{},[236,298,299],{},[18,300,301],{},"# Returns",[236,303,304],{},"Return value docs.",[221,306,307,312],{},[236,308,309],{},[18,310,311],{},"# Notes",[236,313,314],{},"Extra info.",[14,316,317],{},"The order convention: Examples, Panics, Errors, Safety.",[27,319,321],{"id":320},"cross-references","Cross-References",[32,323,324],{"language":34},[36,325,327],{"className":38,"code":326,"language":34,"meta":40,"style":40},"\u002F\u002F\u002F See [`std::fs::read`] for reading a file.\n\u002F\u002F\u002F Uses [`OtherType::method`] internally.\n\u002F\u002F\u002F Implements [`MyTrait`].\n",[18,328,329,334,339],{"__ignoreMap":40},[44,330,331],{"class":46,"line":47},[44,332,333],{"class":50},"\u002F\u002F\u002F See [`std::fs::read`] for reading a file.\n",[44,335,336],{"class":46,"line":54},[44,337,338],{"class":50},"\u002F\u002F\u002F Uses [`OtherType::method`] internally.\n",[44,340,341],{"class":46,"line":60},[44,342,343],{"class":50},"\u002F\u002F\u002F Implements [`MyTrait`].\n",[14,345,346],{},"Backticks create hyperlinks. rustdoc resolves intra-doc links.",[32,348,349],{"language":34},[36,350,352],{"className":38,"code":351,"language":34,"meta":40,"style":40},"\u002F\u002F\u002F [`OtherType`] is in scope.\n\u002F\u002F\u002F [`crate::sub::Thing`]\n",[18,353,354,359],{"__ignoreMap":40},[44,355,356],{"class":46,"line":47},[44,357,358],{"class":50},"\u002F\u002F\u002F [`OtherType`] is in scope.\n",[44,360,361],{"class":46,"line":54},[44,362,363],{"class":50},"\u002F\u002F\u002F [`crate::sub::Thing`]\n",[27,365,367],{"id":366},"building-docs","Building Docs",[32,369,371],{"language":370},"bash",[36,372,375],{"className":373,"code":374,"language":370,"meta":40,"style":40},"language-bash shiki shiki-themes github-light github-dark","cargo doc                  # generate for the crate\ncargo doc --open           # generate and open in browser\ncargo doc --no-deps        # skip dependencies\ncargo doc --workspace      # all crates in workspace\ncargo doc --document-private-items  # include private items (rare)\n",[18,376,377,389,402,414,426],{"__ignoreMap":40},[44,378,379,382,386],{"class":46,"line":47},[44,380,381],{"class":137},"cargo",[44,383,385],{"class":384},"sJ6F3"," doc",[44,387,388],{"class":50},"                  # generate for the crate\n",[44,390,391,393,395,399],{"class":46,"line":54},[44,392,381],{"class":137},[44,394,385],{"class":384},[44,396,398],{"class":397},"snvgF"," --open",[44,400,401],{"class":50},"           # generate and open in browser\n",[44,403,404,406,408,411],{"class":46,"line":60},[44,405,381],{"class":137},[44,407,385],{"class":384},[44,409,410],{"class":397}," --no-deps",[44,412,413],{"class":50},"        # skip dependencies\n",[44,415,416,418,420,423],{"class":46,"line":66},[44,417,381],{"class":137},[44,419,385],{"class":384},[44,421,422],{"class":397}," --workspace",[44,424,425],{"class":50},"      # all crates in workspace\n",[44,427,428,430,432,435],{"class":46,"line":71},[44,429,381],{"class":137},[44,431,385],{"class":384},[44,433,434],{"class":397}," --document-private-items",[44,436,437],{"class":50},"  # include private items (rare)\n",[14,439,440,441,444],{},"Output goes to ",[18,442,443],{},"target\u002Fdoc\u002F",".",[27,446,448],{"id":447},"doc-tests-recap","Doc Tests (Recap)",[32,450,451],{"language":34},[36,452,454],{"className":38,"code":453,"language":34,"meta":40,"style":40},"\u002F\u002F\u002F ```\n\u002F\u002F\u002F use my_crate::add;\n\u002F\u002F\u002F assert_eq!(add(2, 2), 4);\n\u002F\u002F\u002F ```\n",[18,455,456,460,464,468],{"__ignoreMap":40},[44,457,458],{"class":46,"line":47},[44,459,85],{"class":50},[44,461,462],{"class":46,"line":54},[44,463,91],{"class":50},[44,465,466],{"class":46,"line":60},[44,467,97],{"class":50},[44,469,470],{"class":46,"line":66},[44,471,85],{"class":50},[174,473,474,480,486,492,498,504],{},[177,475,476,479],{},[18,477,478],{},"cargo test"," runs them.",[177,481,482,485],{},[18,483,484],{},"no_run",": compile but don't execute.",[177,487,488,491],{},[18,489,490],{},"ignore",": skip.",[177,493,494,497],{},[18,495,496],{},"compile_fail",": assert it doesn't compile (negative test).",[177,499,500,503],{},[18,501,502],{},"rust,edition2018",": pin edition.",[177,505,506,509],{},[18,507,508],{},"# use ..."," lines are hidden in rendered docs but executed in tests.",[32,511,512],{"language":34},[36,513,515],{"className":38,"code":514,"language":34,"meta":40,"style":40},"\u002F\u002F\u002F ```\n\u002F\u002F\u002F # use my_crate::add;\n\u002F\u002F\u002F assert_eq!(add(2, 2), 4);\n\u002F\u002F\u002F ```\n",[18,516,517,521,526,530],{"__ignoreMap":40},[44,518,519],{"class":46,"line":47},[44,520,85],{"class":50},[44,522,523],{"class":46,"line":54},[44,524,525],{"class":50},"\u002F\u002F\u002F # use my_crate::add;\n",[44,527,528],{"class":46,"line":60},[44,529,97],{"class":50},[44,531,532],{"class":46,"line":66},[44,533,85],{"class":50},[27,535,537],{"id":536},"doc-attributes","Doc Attributes",[32,539,540],{"language":34},[36,541,543],{"className":38,"code":542,"language":34,"meta":40,"style":40},"#[doc(hidden)]            \u002F\u002F hide from docs (still public)\n#[doc(alias = \"another\")] \u002F\u002F search alias\n#[doc = \"raw text\"]      \u002F\u002F alternative to \u002F\u002F\u002F for non-string content\n#[doc(inline)]           \u002F\u002F inline re-exports\n#[doc(no_inline)]        \u002F\u002F don't inline\n#[doc(cfg(feature = \"...\"))]  \u002F\u002F show \"Available on feature only\" banner\n",[18,544,545,553,570,589,597,605],{"__ignoreMap":40},[44,546,547,550],{"class":46,"line":47},[44,548,549],{"class":141},"#[doc(hidden)]            ",[44,551,552],{"class":50},"\u002F\u002F hide from docs (still public)\n",[44,554,555,558,561,564,567],{"class":46,"line":54},[44,556,557],{"class":141},"#[doc(alias ",[44,559,560],{"class":130},"=",[44,562,563],{"class":384}," \"another\"",[44,565,566],{"class":141},")] ",[44,568,569],{"class":50},"\u002F\u002F search alias\n",[44,571,572,575,577,580,583,586],{"class":46,"line":60},[44,573,574],{"class":141},"#[doc ",[44,576,560],{"class":130},[44,578,579],{"class":384}," \"raw text\"",[44,581,582],{"class":141},"]      ",[44,584,585],{"class":50},"\u002F\u002F alternative to",[44,587,588],{"class":50}," \u002F\u002F\u002F for non-string content\n",[44,590,591,594],{"class":46,"line":66},[44,592,593],{"class":141},"#[doc(inline)]           ",[44,595,596],{"class":50},"\u002F\u002F inline re-exports\n",[44,598,599,602],{"class":46,"line":71},[44,600,601],{"class":141},"#[doc(no_inline)]        ",[44,603,604],{"class":50},"\u002F\u002F don't inline\n",[44,606,607,610,612,615,618],{"class":46,"line":77},[44,608,609],{"class":141},"#[doc(cfg(feature ",[44,611,560],{"class":130},[44,613,614],{"class":384}," \"...\"",[44,616,617],{"class":141},"))]  ",[44,619,620],{"class":50},"\u002F\u002F show \"Available on feature only\" banner\n",[27,622,624],{"id":623},"lints","Lints",[32,626,627],{"language":34},[36,628,630],{"className":38,"code":629,"language":34,"meta":40,"style":40},"#![warn(missing_docs)]\n#![warn(missing_debug_implementations)]\n#![warn(rustdoc::broken_intra_doc_links)]\n#![warn(rustdoc::missing_crate_level_docs)]\n",[18,631,632,637,642,653],{"__ignoreMap":40},[44,633,634],{"class":46,"line":47},[44,635,636],{"class":141},"#![warn(missing_docs)]\n",[44,638,639],{"class":46,"line":54},[44,640,641],{"class":141},"#![warn(missing_debug_implementations)]\n",[44,643,644,647,650],{"class":46,"line":60},[44,645,646],{"class":141},"#![warn(rustdoc",[44,648,649],{"class":130},"::",[44,651,652],{"class":141},"broken_intra_doc_links)]\n",[44,654,655,657,659],{"class":46,"line":66},[44,656,646],{"class":141},[44,658,649],{"class":130},[44,660,661],{"class":141},"missing_crate_level_docs)]\n",[14,663,664,667],{},[18,665,666],{},"missing_docs"," forces every public item to have docs — good for libraries.",[27,669,671],{"id":670},"crate-level-docs","Crate-Level Docs",[32,673,674],{"language":34},[36,675,677],{"className":38,"code":676,"language":34,"meta":40,"style":40},"\u002F\u002F src\u002Flib.rs\n\u002F\u002F! # My Crate\n\u002F\u002F!\n\u002F\u002F! This crate does X for Y.\n\u002F\u002F!\n\u002F\u002F! ## Quick Start\n\u002F\u002F! ```\n\u002F\u002F! use my_crate::*;\n\u002F\u002F! ```\n",[18,678,679,684,688,692,697,701,706,711,716],{"__ignoreMap":40},[44,680,681],{"class":46,"line":47},[44,682,683],{"class":50},"\u002F\u002F src\u002Flib.rs\n",[44,685,686],{"class":46,"line":54},[44,687,199],{"class":50},[44,689,690],{"class":46,"line":60},[44,691,204],{"class":50},[44,693,694],{"class":46,"line":66},[44,695,696],{"class":50},"\u002F\u002F! This crate does X for Y.\n",[44,698,699],{"class":46,"line":71},[44,700,204],{"class":50},[44,702,703],{"class":46,"line":77},[44,704,705],{"class":50},"\u002F\u002F! ## Quick Start\n",[44,707,708],{"class":46,"line":82},[44,709,710],{"class":50},"\u002F\u002F! ```\n",[44,712,713],{"class":46,"line":88},[44,714,715],{"class":50},"\u002F\u002F! use my_crate::*;\n",[44,717,718],{"class":46,"line":94},[44,719,710],{"class":50},[14,721,722],{},"Include a quick-start at the crate root.",[27,724,726,729],{"id":725},"readmemd-inclusion",[18,727,728],{},"README.md"," Inclusion",[32,731,732],{"language":34},[36,733,735],{"className":38,"code":734,"language":34,"meta":40,"style":40},"#![doc = include_str!(\"..\u002FREADME.md\")]\n",[18,736,737],{"__ignoreMap":40},[44,738,739,742,744,747,750,753,756],{"class":46,"line":47},[44,740,741],{"class":141},"#![doc ",[44,743,560],{"class":130},[44,745,746],{"class":141}," include_str",[44,748,749],{"class":130},"!",[44,751,752],{"class":141},"(",[44,754,755],{"class":384},"\"..\u002FREADME.md\"",[44,757,758],{"class":141},")]\n",[14,760,761],{},"Treats the README as crate-level docs. Common for projects that want one source of truth.",[27,763,765],{"id":764},"style-guide","Style Guide",[174,767,768,771,782,785,794,797,800],{},[177,769,770],{},"Write prose, not telegrams. Sentences with verbs.",[177,772,773,774,778,779,444],{},"Document the ",[775,776,777],"em",{},"why",", not just the ",[775,780,781],{},"what",[177,783,784],{},"Examples for every public function that's not obvious.",[177,786,787,788,790,791,793],{},"Use ",[18,789,250],{}," and ",[18,792,260],{}," sections consistently.",[177,795,796],{},"Cross-reference related items.",[177,798,799],{},"Keep examples small and self-contained.",[177,801,802],{},"Avoid docs on trivial getters\u002Fsetters; document the field instead.",[27,804,806],{"id":805},"examples","Examples",[808,809,811],"h3",{"id":810},"good","Good",[32,813,814],{"language":34},[36,815,817],{"className":38,"code":816,"language":34,"meta":40,"style":40},"\u002F\u002F\u002F Computes the Fibonacci number at position `n`.\n\u002F\u002F\u002F\n\u002F\u002F\u002F Uses an iterative algorithm with O(n) time and O(1) space.\n\u002F\u002F\u002F\n\u002F\u002F\u002F # Examples\n\u002F\u002F\u002F\n\u002F\u002F\u002F ```\n\u002F\u002F\u002F use my_crate::fib;\n\u002F\u002F\u002F assert_eq!(fib(0), 0);\n\u002F\u002F\u002F assert_eq!(fib(10), 55);\n\u002F\u002F\u002F ```\n\u002F\u002F\u002F\n\u002F\u002F\u002F # Panics\n\u002F\u002F\u002F\n\u002F\u002F\u002F Panics if `n` is large enough to overflow `u64`.\npub fn fib(n: u64) -> u64 { \u002F* ... *\u002F 0 }\n",[18,818,819,824,828,833,837,841,845,849,854,859,864,868,872,876,880,885],{"__ignoreMap":40},[44,820,821],{"class":46,"line":47},[44,822,823],{"class":50},"\u002F\u002F\u002F Computes the Fibonacci number at position `n`.\n",[44,825,826],{"class":46,"line":54},[44,827,57],{"class":50},[44,829,830],{"class":46,"line":60},[44,831,832],{"class":50},"\u002F\u002F\u002F Uses an iterative algorithm with O(n) time and O(1) space.\n",[44,834,835],{"class":46,"line":66},[44,836,57],{"class":50},[44,838,839],{"class":46,"line":71},[44,840,74],{"class":50},[44,842,843],{"class":46,"line":77},[44,844,57],{"class":50},[44,846,847],{"class":46,"line":82},[44,848,85],{"class":50},[44,850,851],{"class":46,"line":88},[44,852,853],{"class":50},"\u002F\u002F\u002F use my_crate::fib;\n",[44,855,856],{"class":46,"line":94},[44,857,858],{"class":50},"\u002F\u002F\u002F assert_eq!(fib(0), 0);\n",[44,860,861],{"class":46,"line":100},[44,862,863],{"class":50},"\u002F\u002F\u002F assert_eq!(fib(10), 55);\n",[44,865,866],{"class":46,"line":105},[44,867,85],{"class":50},[44,869,870],{"class":46,"line":110},[44,871,57],{"class":50},[44,873,874],{"class":46,"line":116},[44,875,113],{"class":50},[44,877,878],{"class":46,"line":121},[44,879,57],{"class":50},[44,881,882],{"class":46,"line":127},[44,883,884],{"class":50},"\u002F\u002F\u002F Panics if `n` is large enough to overflow `u64`.\n",[44,886,888,890,892,895,898,900,903,905,907,909,912,915,918],{"class":46,"line":887},16,[44,889,131],{"class":130},[44,891,134],{"class":130},[44,893,894],{"class":137}," fib",[44,896,897],{"class":141},"(n",[44,899,145],{"class":130},[44,901,902],{"class":137}," u64",[44,904,158],{"class":141},[44,906,161],{"class":130},[44,908,902],{"class":137},[44,910,911],{"class":141}," { ",[44,913,914],{"class":50},"\u002F* ... *\u002F",[44,916,917],{"class":397}," 0",[44,919,920],{"class":141}," }\n",[808,922,924],{"id":923},"bad","Bad",[32,926,927],{"language":34},[36,928,930],{"className":38,"code":929,"language":34,"meta":40,"style":40},"\u002F\u002F\u002F fib function\npub fn fib(n: u64) -> u64 { 0 }\n",[18,931,932,937],{"__ignoreMap":40},[44,933,934],{"class":46,"line":47},[44,935,936],{"class":50},"\u002F\u002F\u002F fib function\n",[44,938,939,941,943,945,947,949,951,953,955,957,959,962],{"class":46,"line":54},[44,940,131],{"class":130},[44,942,134],{"class":130},[44,944,894],{"class":137},[44,946,897],{"class":141},[44,948,145],{"class":130},[44,950,902],{"class":137},[44,952,158],{"class":141},[44,954,161],{"class":130},[44,956,902],{"class":137},[44,958,911],{"class":141},[44,960,961],{"class":397},"0",[44,963,920],{"class":141},[27,965,967],{"id":966},"hidden-examples-for-complex-setup","Hidden Examples for Complex Setup",[32,969,970],{"language":34},[36,971,973],{"className":38,"code":972,"language":34,"meta":40,"style":40},"\u002F\u002F\u002F ```\n\u002F\u002F\u002F # use std::sync::Arc;\n\u002F\u002F\u002F # use std::sync::Mutex;\n\u002F\u002F\u002F # let state = Arc::new(Mutex::new(0));\n\u002F\u002F\u002F let _v = state.lock().unwrap();\n\u002F\u002F\u002F ```\n",[18,974,975,979,984,989,994,999],{"__ignoreMap":40},[44,976,977],{"class":46,"line":47},[44,978,85],{"class":50},[44,980,981],{"class":46,"line":54},[44,982,983],{"class":50},"\u002F\u002F\u002F # use std::sync::Arc;\n",[44,985,986],{"class":46,"line":60},[44,987,988],{"class":50},"\u002F\u002F\u002F # use std::sync::Mutex;\n",[44,990,991],{"class":46,"line":66},[44,992,993],{"class":50},"\u002F\u002F\u002F # let state = Arc::new(Mutex::new(0));\n",[44,995,996],{"class":46,"line":71},[44,997,998],{"class":50},"\u002F\u002F\u002F let _v = state.lock().unwrap();\n",[44,1000,1001],{"class":46,"line":77},[44,1002,85],{"class":50},[14,1004,1005,1006,1009],{},"Setup lines prefixed with ",[18,1007,1008],{},"#"," are hidden in the rendered doc but executed.",[27,1011,1013],{"id":1012},"doc-test-pitfalls","Doc Test Pitfalls",[174,1015,1016,1031,1040,1047,1061],{},[177,1017,1018,1022,1023,1026,1027,1030],{},[1019,1020,1021],"strong",{},"External crate imports",": doc tests need ",[18,1024,1025],{},"extern crate"," or ",[18,1028,1029],{},"use"," lines.",[177,1032,1033,1039],{},[1019,1034,1035,1036,1038],{},"Top-level ",[18,1037,1029],{}," shadowing",": each doc test is its own crate.",[177,1041,1042,1046],{},[1019,1043,1044],{},[18,1045,496],{}," must be on a fenced block, and the block must actually fail to compile.",[177,1048,1049,1057,1058,1060],{},[1019,1050,1051,1053,1054],{},[18,1052,484],{}," with ",[18,1055,1056],{},"main",": works; ",[18,1059,484],{}," compiles but skips execution.",[177,1062,1063,1066,1067,444],{},[1019,1064,1065],{},"Doc tests are slow",": skip in CI with ",[18,1068,1069],{},"cargo test --lib --bins --tests",[27,1071,1073,1076],{"id":1072},"mdbook-for-standalone-docs",[18,1074,1075],{},"mdbook"," for Standalone Docs",[14,1078,1079,1080,1082],{},"For guides\u002Fbooks, ",[18,1081,1075],{}," is the standard tool:",[32,1084,1085],{"language":370},[36,1086,1088],{"className":373,"code":1087,"language":370,"meta":40,"style":40},"cargo install mdbook\nmdbook init docs\nmdbook serve docs\n",[18,1089,1090,1100,1110],{"__ignoreMap":40},[44,1091,1092,1094,1097],{"class":46,"line":47},[44,1093,381],{"class":137},[44,1095,1096],{"class":384}," install",[44,1098,1099],{"class":384}," mdbook\n",[44,1101,1102,1104,1107],{"class":46,"line":54},[44,1103,1075],{"class":137},[44,1105,1106],{"class":384}," init",[44,1108,1109],{"class":384}," docs\n",[44,1111,1112,1114,1117],{"class":46,"line":60},[44,1113,1075],{"class":137},[44,1115,1116],{"class":384}," serve",[44,1118,1109],{"class":384},[14,1120,1121,1122,1125,1126,1125,1129,1132],{},"Many major Rust projects (",[18,1123,1124],{},"rust-lang\u002Frust",", ",[18,1127,1128],{},"tokio",[18,1130,1131],{},"bevy",") have mdbook guides alongside rustdoc.",[27,1134,1136],{"id":1135},"publishing-docs","Publishing Docs",[174,1138,1139],{},[177,1140,1141,1144,1145,145],{},[1019,1142,1143],{},"docs.rs",": auto-builds and hosts docs for crates published to crates.io. Configure with ",[18,1146,1147],{},"[package.metadata.docs.rs]",[32,1149,1151],{"language":1150},"toml",[36,1152,1155],{"className":1153,"code":1154,"language":1150,"meta":40,"style":40},"language-toml shiki shiki-themes github-light github-dark","[package.metadata.docs.rs]\nfeatures = [\"full\", \"all-feature-flags\"]\nall-features = true\nrustdoc-args = [\"--cfg\", \"docsrs\"]\n",[18,1156,1157,1162,1167,1172],{"__ignoreMap":40},[44,1158,1159],{"class":46,"line":47},[44,1160,1161],{},"[package.metadata.docs.rs]\n",[44,1163,1164],{"class":46,"line":54},[44,1165,1166],{},"features = [\"full\", \"all-feature-flags\"]\n",[44,1168,1169],{"class":46,"line":60},[44,1170,1171],{},"all-features = true\n",[44,1173,1174],{"class":46,"line":66},[44,1175,1176],{},"rustdoc-args = [\"--cfg\", \"docsrs\"]\n",[174,1178,1179,1188],{},[177,1180,1181,1184,1185,1187],{},[1019,1182,1183],{},"GitHub Pages",": deploy ",[18,1186,443],{}," via Actions.",[177,1189,1190,1195],{},[1019,1191,1192],{},[18,1193,1194],{},"cargo-docs-rs",": preview docs.rs rendering locally.",[27,1197,1199],{"id":1198},"cross-crate-doc-links","Cross-Crate Doc Links",[32,1201,1202],{"language":34},[36,1203,1205],{"className":38,"code":1204,"language":34,"meta":40,"style":40},"\u002F\u002F\u002F See the [`serde`] crate for serialization.\n\u002F\u002F\u002F See [`tokio::sync::mpsc`] for channels.\n",[18,1206,1207,1212],{"__ignoreMap":40},[44,1208,1209],{"class":46,"line":47},[44,1210,1211],{"class":50},"\u002F\u002F\u002F See the [`serde`] crate for serialization.\n",[44,1213,1214],{"class":46,"line":54},[44,1215,1216],{"class":50},"\u002F\u002F\u002F See [`tokio::sync::mpsc`] for channels.\n",[14,1218,1219,1220,444],{},"rustdoc can resolve links to external crates if they're in your ",[18,1221,1222],{},"Cargo.toml",[27,1224,1226],{"id":1225},"common-pitfalls","Common Pitfalls",[174,1228,1229,1238,1247,1253,1262,1275,1283],{},[177,1230,1231,1234,1235,444],{},[1019,1232,1233],{},"Broken intra-doc links",": rustdoc warns; turn into errors with ",[18,1236,1237],{},"#![warn(rustdoc::broken_intra_doc_links)]",[177,1239,1240,1243,1244,444],{},[1019,1241,1242],{},"Missing crate-level docs",": ",[18,1245,1246],{},"#![warn(rustdoc::missing_crate_level_docs)]",[177,1248,1249,1252],{},[1019,1250,1251],{},"Examples don't compile",": CI runs doc tests; broken examples break releases.",[177,1254,1255,1261],{},[1019,1256,1257,1260],{},[18,1258,1259],{},"#[doc(hidden)]"," on re-exports",": hides the re-export but not the original.",[177,1263,1264,1270,1271,1274],{},[1019,1265,1266,1267,1269],{},"Hidden ",[18,1268,1008],{}," lines visible in source",": they're hidden in HTML but visible in ",[18,1272,1273],{},".rs"," source.",[177,1276,1277,1282],{},[1019,1278,1279],{},[18,1280,1281],{},"#![doc(html_logo_url = \"...\")]",": branding on docs.",[177,1284,1285,1290],{},[1019,1286,1287],{},[18,1288,1289],{},"#![doc(html_root_url = \"https:\u002F\u002Fdocs.rs\u002Fcrate\u002F1.0\")]",": helps intra-doc link resolution.",[27,1292,1294],{"id":1293},"summary","Summary",[14,1296,1297,1298,1125,1300,1302,1303,790,1306,1308,1309,1311,1312,1314,1315,1317],{},"Write doc comments (",[18,1299,24],{},[18,1301,186],{},") with standard sections (Examples, Panics, Errors, Safety). Run ",[18,1304,1305],{},"cargo doc",[18,1307,478],{}," (doc tests). Use hidden ",[18,1310,1008],{}," lines for setup. Cross-reference with backticks. Enable ",[18,1313,666],{}," for libraries. Publish to docs.rs. Use ",[18,1316,1075],{}," for guides.",[14,1319,1320],{},"Next: Rust ecosystem tour.",[1322,1323,1324],"style",{},"html pre.shiki code .sdCPZ, html code.shiki .sdCPZ{--shiki-default:#6A737D;--shiki-github-dark:#6A737D}html pre.shiki code .svdQ7, html code.shiki .svdQ7{--shiki-default:#D73A49;--shiki-github-dark:#F97583}html pre.shiki code .sIsaT, html code.shiki .sIsaT{--shiki-default:#6F42C1;--shiki-github-dark:#B392F0}html pre.shiki code .ssxIu, html code.shiki .ssxIu{--shiki-default:#24292E;--shiki-github-dark:#E1E4E8}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .github-dark .shiki span {color: var(--shiki-github-dark);background: var(--shiki-github-dark-bg);font-style: var(--shiki-github-dark-font-style);font-weight: var(--shiki-github-dark-font-weight);text-decoration: var(--shiki-github-dark-text-decoration);}html.github-dark .shiki span {color: var(--shiki-github-dark);background: var(--shiki-github-dark-bg);font-style: var(--shiki-github-dark-font-style);font-weight: var(--shiki-github-dark-font-weight);text-decoration: var(--shiki-github-dark-text-decoration);}html pre.shiki code .sJ6F3, html code.shiki .sJ6F3{--shiki-default:#032F62;--shiki-github-dark:#9ECBFF}html pre.shiki code .snvgF, html code.shiki .snvgF{--shiki-default:#005CC5;--shiki-github-dark:#79B8FF}",{"title":40,"searchDepth":54,"depth":54,"links":1326},[1327,1328,1329,1330,1331,1332,1333,1334,1335,1337,1338,1342,1343,1344,1346,1347,1348,1349],{"id":29,"depth":54,"text":30},{"id":212,"depth":54,"text":213},{"id":320,"depth":54,"text":321},{"id":366,"depth":54,"text":367},{"id":447,"depth":54,"text":448},{"id":536,"depth":54,"text":537},{"id":623,"depth":54,"text":624},{"id":670,"depth":54,"text":671},{"id":725,"depth":54,"text":1336},"README.md Inclusion",{"id":764,"depth":54,"text":765},{"id":805,"depth":54,"text":806,"children":1339},[1340,1341],{"id":810,"depth":60,"text":811},{"id":923,"depth":60,"text":924},{"id":966,"depth":54,"text":967},{"id":1012,"depth":54,"text":1013},{"id":1072,"depth":54,"text":1345},"mdbook for Standalone Docs",{"id":1135,"depth":54,"text":1136},{"id":1198,"depth":54,"text":1199},{"id":1225,"depth":54,"text":1226},{"id":1293,"depth":54,"text":1294},"Documentation is part of the Rust culture. rustdoc produces HTML docs from \u002F\u002F\u002F comments; doc-tests run examples.","md",{},true,"\u002Frust\u002F32-documentation",{"title":5,"description":1350},"rust\u002F32-documentation","z53wj3OlMqx9_sEqcAVpf2ucaZ6W0ChSS8Tb019h6yk",1785944093282]