[{"data":1,"prerenderedAt":1206},["ShallowReactive",2],{"page-\u002Frust\u002F02-hello-world-and-cargo":3},{"id":4,"title":5,"body":6,"description":27,"extension":1200,"meta":1201,"navigation":700,"path":1202,"seo":1203,"stem":1204,"__hash__":1205},"content\u002Frust\u002F02-hello-world-and-cargo.md","02 — Hello World & Cargo Deep Dive",{"type":7,"value":8,"toc":1178},"minimark",[9,13,18,77,85,110,122,129,143,392,397,446,453,477,499,557,567,578,635,642,802,806,848,852,925,929,936,966,972,998,1002,1009,1044,1051,1055,1156,1160,1167,1171,1174],[10,11,5],"h1",{"id":12},"_02-hello-world-cargo-deep-dive",[14,15,17],"h2",{"id":16},"the-minimal-program","The Minimal Program",[19,20,22],"code-wrapper",{"language":21},"rust",[23,24,28],"pre",{"className":25,"code":26,"language":21,"meta":27,"style":27},"language-rust shiki shiki-themes github-light github-dark","\u002F\u002F src\u002Fmain.rs\nfn main() {\n    println!(\"Hello, world!\");\n}\n","",[29,30,31,40,55,71],"code",{"__ignoreMap":27},[32,33,36],"span",{"class":34,"line":35},"line",1,[32,37,39],{"class":38},"sdCPZ","\u002F\u002F src\u002Fmain.rs\n",[32,41,43,47,51],{"class":34,"line":42},2,[32,44,46],{"class":45},"svdQ7","fn",[32,48,50],{"class":49},"sIsaT"," main",[32,52,54],{"class":53},"ssxIu","() {\n",[32,56,58,61,64,68],{"class":34,"line":57},3,[32,59,60],{"class":49},"    println!",[32,62,63],{"class":53},"(",[32,65,67],{"class":66},"sJ6F3","\"Hello, world!\"",[32,69,70],{"class":53},");\n",[32,72,74],{"class":34,"line":73},4,[32,75,76],{"class":53},"}\n",[78,79,80,81,84],"p",{},"Compile and run directly with ",[29,82,83],{},"rustc",":",[19,86,88],{"language":87},"bash",[23,89,92],{"className":90,"code":91,"language":87,"meta":27,"style":27},"language-bash shiki shiki-themes github-light github-dark","rustc src\u002Fmain.rs && .\u002Fmain      # produces .\u002Fmain (or main.exe)\n",[29,93,94],{"__ignoreMap":27},[32,95,96,98,101,104,107],{"class":34,"line":35},[32,97,83],{"class":49},[32,99,100],{"class":66}," src\u002Fmain.rs",[32,102,103],{"class":53}," && ",[32,105,106],{"class":49},".\u002Fmain",[32,108,109],{"class":38},"      # produces .\u002Fmain (or main.exe)\n",[78,111,112,114,115,118,119,121],{},[29,113,83],{}," is the compiler. In practice you use ",[29,116,117],{},"cargo"," instead, but understanding ",[29,120,83],{}," helps you read compiler errors.",[14,123,125,128],{"id":124},"println-is-a-macro-not-a-function",[29,126,127],{},"println!"," is a Macro, Not a Function",[78,130,131,133,134,137,138,142],{},[29,132,127],{}," ends with ",[29,135,136],{},"!"," because it's a ",[139,140,141],"strong",{},"macro",". It can't be a function because it validates format strings at compile time and takes a variadic number of arguments.",[19,144,145],{"language":21},[23,146,148],{"className":25,"code":147,"language":21,"meta":27,"style":27},"let name = \"Ada\";\nlet age = 36;\nprintln!(\"{name} is {age}\");            \u002F\u002F implicit named args (edition 2021+)\nprintln!(\"{0} is {1}\", name, age);      \u002F\u002F positional\nprintln!(\"{name} is {age}\", name=name, age=age); \u002F\u002F explicit named\nprintln!(\"{name:>10}\");                  \u002F\u002F right-align width 10\nprintln!(\"{name:^10}\");                  \u002F\u002F center\nprintln!(\"{age:0>5}\");                   \u002F\u002F zero-padded: 00036\nprintln!(\"{age:#x}\", 255u32);            \u002F\u002F hex with 0x prefix -> 0xff\nprintln!(\"{:b}\", 10u8);                  \u002F\u002F binary -> 1010\nprintln!(\"{:e}\", 12345.678f64);          \u002F\u002F scientific\nprintln!(\"{:#?}\", some_struct);          \u002F\u002F pretty-print debug\nprintln!(\"{:>10.2}\", 3.14159);           \u002F\u002F width 10, 2 decimals\n",[29,149,150,167,182,197,212,237,253,268,284,308,331,355,371],{"__ignoreMap":27},[32,151,152,155,158,161,164],{"class":34,"line":35},[32,153,154],{"class":45},"let",[32,156,157],{"class":53}," name ",[32,159,160],{"class":45},"=",[32,162,163],{"class":66}," \"Ada\"",[32,165,166],{"class":53},";\n",[32,168,169,171,174,176,180],{"class":34,"line":42},[32,170,154],{"class":45},[32,172,173],{"class":53}," age ",[32,175,160],{"class":45},[32,177,179],{"class":178},"snvgF"," 36",[32,181,166],{"class":53},[32,183,184,186,188,191,194],{"class":34,"line":57},[32,185,127],{"class":49},[32,187,63],{"class":53},[32,189,190],{"class":66},"\"{name} is {age}\"",[32,192,193],{"class":53},");            ",[32,195,196],{"class":38},"\u002F\u002F implicit named args (edition 2021+)\n",[32,198,199,201,203,206,209],{"class":34,"line":73},[32,200,127],{"class":49},[32,202,63],{"class":53},[32,204,205],{"class":66},"\"{0} is {1}\"",[32,207,208],{"class":53},", name, age);      ",[32,210,211],{"class":38},"\u002F\u002F positional\n",[32,213,215,217,219,221,224,226,229,231,234],{"class":34,"line":214},5,[32,216,127],{"class":49},[32,218,63],{"class":53},[32,220,190],{"class":66},[32,222,223],{"class":53},", name",[32,225,160],{"class":45},[32,227,228],{"class":53},"name, age",[32,230,160],{"class":45},[32,232,233],{"class":53},"age); ",[32,235,236],{"class":38},"\u002F\u002F explicit named\n",[32,238,240,242,244,247,250],{"class":34,"line":239},6,[32,241,127],{"class":49},[32,243,63],{"class":53},[32,245,246],{"class":66},"\"{name:>10}\"",[32,248,249],{"class":53},");                  ",[32,251,252],{"class":38},"\u002F\u002F right-align width 10\n",[32,254,256,258,260,263,265],{"class":34,"line":255},7,[32,257,127],{"class":49},[32,259,63],{"class":53},[32,261,262],{"class":66},"\"{name:^10}\"",[32,264,249],{"class":53},[32,266,267],{"class":38},"\u002F\u002F center\n",[32,269,271,273,275,278,281],{"class":34,"line":270},8,[32,272,127],{"class":49},[32,274,63],{"class":53},[32,276,277],{"class":66},"\"{age:0>5}\"",[32,279,280],{"class":53},");                   ",[32,282,283],{"class":38},"\u002F\u002F zero-padded: 00036\n",[32,285,287,289,291,294,297,300,303,305],{"class":34,"line":286},9,[32,288,127],{"class":49},[32,290,63],{"class":53},[32,292,293],{"class":66},"\"{age:#x}\"",[32,295,296],{"class":53},", ",[32,298,299],{"class":178},"255",[32,301,302],{"class":49},"u32",[32,304,193],{"class":53},[32,306,307],{"class":38},"\u002F\u002F hex with 0x prefix -> 0xff\n",[32,309,311,313,315,318,320,323,326,328],{"class":34,"line":310},10,[32,312,127],{"class":49},[32,314,63],{"class":53},[32,316,317],{"class":66},"\"{:b}\"",[32,319,296],{"class":53},[32,321,322],{"class":178},"10",[32,324,325],{"class":49},"u8",[32,327,249],{"class":53},[32,329,330],{"class":38},"\u002F\u002F binary -> 1010\n",[32,332,334,336,338,341,343,346,349,352],{"class":34,"line":333},11,[32,335,127],{"class":49},[32,337,63],{"class":53},[32,339,340],{"class":66},"\"{:e}\"",[32,342,296],{"class":53},[32,344,345],{"class":178},"12345.678",[32,347,348],{"class":49},"f64",[32,350,351],{"class":53},");          ",[32,353,354],{"class":38},"\u002F\u002F scientific\n",[32,356,358,360,362,365,368],{"class":34,"line":357},12,[32,359,127],{"class":49},[32,361,63],{"class":53},[32,363,364],{"class":66},"\"{:#?}\"",[32,366,367],{"class":53},", some_struct);          ",[32,369,370],{"class":38},"\u002F\u002F pretty-print debug\n",[32,372,374,376,378,381,383,386,389],{"class":34,"line":373},13,[32,375,127],{"class":49},[32,377,63],{"class":53},[32,379,380],{"class":66},"\"{:>10.2}\"",[32,382,296],{"class":53},[32,384,385],{"class":178},"3.14159",[32,387,388],{"class":53},");           ",[32,390,391],{"class":38},"\u002F\u002F width 10, 2 decimals\n",[393,394,396],"h3",{"id":395},"format-trait-hierarchy","Format Trait Hierarchy",[78,398,399,402,403,406,407,410,411,414,415,418,419,414,421,296,424,296,427,296,430,296,433,296,436,439,440,442,443,445],{},[29,400,401],{},"{}"," uses the ",[29,404,405],{},"Display"," trait; ",[29,408,409],{},"{:?}"," uses ",[29,412,413],{},"Debug","; ",[29,416,417],{},"{:#?}"," is pretty ",[29,420,413],{},[29,422,423],{},"{o}",[29,425,426],{},"{x}",[29,428,429],{},"{X}",[29,431,432],{},"{b}",[29,434,435],{},"{e}",[29,437,438],{},"{E}"," select integer\u002Ffloat formatting. You implement ",[29,441,405],{}," manually for user-facing output; ",[29,444,413],{}," can be derived.",[14,447,449,450],{"id":448},"anatomy-of-main","Anatomy of ",[29,451,452],{},"main",[19,454,455],{"language":21},[23,456,458],{"className":25,"code":457,"language":21,"meta":27,"style":27},"fn main() {\n    \u002F\u002F program entry point\n}\n",[29,459,460,468,473],{"__ignoreMap":27},[32,461,462,464,466],{"class":34,"line":35},[32,463,46],{"class":45},[32,465,50],{"class":49},[32,467,54],{"class":53},[32,469,470],{"class":34,"line":42},[32,471,472],{"class":38},"    \u002F\u002F program entry point\n",[32,474,475],{"class":34,"line":57},[32,476,76],{"class":53},[478,479,480,490],"ul",{},[481,482,483,485,486,489],"li",{},[29,484,452],{}," never takes arguments and never returns a value (returns unit ",[29,487,488],{},"()",").",[481,491,492,493,496,497,84],{},"To exit with a code, use ",[29,494,495],{},"std::process::exit(code)"," (skips destructors!) or return from ",[29,498,452],{},[19,500,501],{"language":21},[23,502,504],{"className":25,"code":503,"language":21,"meta":27,"style":27},"fn main() -> std::process::ExitCode {\n    std::process::ExitCode::SUCCESS\n}\n",[29,505,506,535,553],{"__ignoreMap":27},[32,507,508,510,512,515,518,521,524,527,529,532],{"class":34,"line":35},[32,509,46],{"class":45},[32,511,50],{"class":49},[32,513,514],{"class":53},"() ",[32,516,517],{"class":45},"->",[32,519,520],{"class":49}," std",[32,522,523],{"class":45},"::",[32,525,526],{"class":49},"process",[32,528,523],{"class":45},[32,530,531],{"class":49},"ExitCode",[32,533,534],{"class":53}," {\n",[32,536,537,540,542,544,546,548,550],{"class":34,"line":42},[32,538,539],{"class":49},"    std",[32,541,523],{"class":45},[32,543,526],{"class":49},[32,545,523],{"class":45},[32,547,531],{"class":49},[32,549,523],{"class":45},[32,551,552],{"class":178},"SUCCESS\n",[32,554,555],{"class":34,"line":57},[32,556,76],{"class":53},[78,558,559,560,562,563,566],{},"(Stable ",[29,561,531],{}," and ",[29,564,565],{},"Termination"," trait are available since 1.61.)",[14,568,570,571,574,575],{"id":569},"cargo-new-vs-init","Cargo: ",[29,572,573],{},"new"," vs ",[29,576,577],{},"init",[19,579,580],{"language":87},[23,581,583],{"className":90,"code":582,"language":87,"meta":27,"style":27},"cargo new my_app          # creates new directory with a binary project\ncargo new my_lib --lib    # library project (lib.rs, no main)\ncargo init                # scaffolds in the current directory (existing git repo preserved)\ncargo init --name custom_name\n",[29,584,585,598,613,623],{"__ignoreMap":27},[32,586,587,589,592,595],{"class":34,"line":35},[32,588,117],{"class":49},[32,590,591],{"class":66}," new",[32,593,594],{"class":66}," my_app",[32,596,597],{"class":38},"          # creates new directory with a binary project\n",[32,599,600,602,604,607,610],{"class":34,"line":42},[32,601,117],{"class":49},[32,603,591],{"class":66},[32,605,606],{"class":66}," my_lib",[32,608,609],{"class":178}," --lib",[32,611,612],{"class":38},"    # library project (lib.rs, no main)\n",[32,614,615,617,620],{"class":34,"line":57},[32,616,117],{"class":49},[32,618,619],{"class":66}," init",[32,621,622],{"class":38},"                # scaffolds in the current directory (existing git repo preserved)\n",[32,624,625,627,629,632],{"class":34,"line":73},[32,626,117],{"class":49},[32,628,619],{"class":66},[32,630,631],{"class":178}," --name",[32,633,634],{"class":66}," custom_name\n",[14,636,638,641],{"id":637},"cargotoml-anatomy",[29,639,640],{},"Cargo.toml"," Anatomy",[19,643,645],{"language":644},"toml",[23,646,649],{"className":647,"code":648,"language":644,"meta":27,"style":27},"language-toml shiki shiki-themes github-light github-dark","[package]\nname = \"my_app\"\nversion = \"0.1.0\"\nedition = \"2021\"\nauthors = [\"You \u003Cyou@example.com>\"]\nlicense = \"MIT OR Apache-2.0\"\ndescription = \"...\"\nrust-version = \"1.75\"          # MSRV\npublish = false                 # don't accidentally publish to crates.io\n\n[dependencies]\nserde = { version = \"1.0\", features = [\"derive\"] }\ntokio = { version = \"1\", features = [\"full\"] }\nrand = \"0.8\"\n\n[dev-dependencies]\npretty_assertions = \"1\"        # only for tests\u002Fbenches\n\n[build-dependencies]\nanyhow = \"1\"                   # for build.rs\n\n[[bin]]\nname = \"my_app\"\npath = \"src\u002Fmain.rs\"\n\n[features]\ndefault = [\"json\"]\njson = [\"serde\"]\n",[29,650,651,656,661,666,671,676,681,686,691,696,702,707,712,717,723,728,734,740,745,751,757,762,768,773,779,784,790,796],{"__ignoreMap":27},[32,652,653],{"class":34,"line":35},[32,654,655],{},"[package]\n",[32,657,658],{"class":34,"line":42},[32,659,660],{},"name = \"my_app\"\n",[32,662,663],{"class":34,"line":57},[32,664,665],{},"version = \"0.1.0\"\n",[32,667,668],{"class":34,"line":73},[32,669,670],{},"edition = \"2021\"\n",[32,672,673],{"class":34,"line":214},[32,674,675],{},"authors = [\"You \u003Cyou@example.com>\"]\n",[32,677,678],{"class":34,"line":239},[32,679,680],{},"license = \"MIT OR Apache-2.0\"\n",[32,682,683],{"class":34,"line":255},[32,684,685],{},"description = \"...\"\n",[32,687,688],{"class":34,"line":270},[32,689,690],{},"rust-version = \"1.75\"          # MSRV\n",[32,692,693],{"class":34,"line":286},[32,694,695],{},"publish = false                 # don't accidentally publish to crates.io\n",[32,697,698],{"class":34,"line":310},[32,699,701],{"emptyLinePlaceholder":700},true,"\n",[32,703,704],{"class":34,"line":333},[32,705,706],{},"[dependencies]\n",[32,708,709],{"class":34,"line":357},[32,710,711],{},"serde = { version = \"1.0\", features = [\"derive\"] }\n",[32,713,714],{"class":34,"line":373},[32,715,716],{},"tokio = { version = \"1\", features = [\"full\"] }\n",[32,718,720],{"class":34,"line":719},14,[32,721,722],{},"rand = \"0.8\"\n",[32,724,726],{"class":34,"line":725},15,[32,727,701],{"emptyLinePlaceholder":700},[32,729,731],{"class":34,"line":730},16,[32,732,733],{},"[dev-dependencies]\n",[32,735,737],{"class":34,"line":736},17,[32,738,739],{},"pretty_assertions = \"1\"        # only for tests\u002Fbenches\n",[32,741,743],{"class":34,"line":742},18,[32,744,701],{"emptyLinePlaceholder":700},[32,746,748],{"class":34,"line":747},19,[32,749,750],{},"[build-dependencies]\n",[32,752,754],{"class":34,"line":753},20,[32,755,756],{},"anyhow = \"1\"                   # for build.rs\n",[32,758,760],{"class":34,"line":759},21,[32,761,701],{"emptyLinePlaceholder":700},[32,763,765],{"class":34,"line":764},22,[32,766,767],{},"[[bin]]\n",[32,769,771],{"class":34,"line":770},23,[32,772,660],{},[32,774,776],{"class":34,"line":775},24,[32,777,778],{},"path = \"src\u002Fmain.rs\"\n",[32,780,782],{"class":34,"line":781},25,[32,783,701],{"emptyLinePlaceholder":700},[32,785,787],{"class":34,"line":786},26,[32,788,789],{},"[features]\n",[32,791,793],{"class":34,"line":792},27,[32,794,795],{},"default = [\"json\"]\n",[32,797,799],{"class":34,"line":798},28,[32,800,801],{},"json = [\"serde\"]\n",[393,803,805],{"id":804},"version-requirement-syntax","Version Requirement Syntax",[478,807,808,822,828,836,842],{},[481,809,810,813,814,817,818,821],{},[29,811,812],{},"\"1.0\""," → ",[29,815,816],{},"^1.0"," → compatible up to ",[29,819,820],{},"\u003C2.0.0"," (caret, default)",[481,823,824,827],{},[29,825,826],{},"\"=1.0.0\""," → exact",[481,829,830,813,833],{},[29,831,832],{},"\"~1.0.0\"",[29,834,835],{},">=1.0.0, \u003C1.1.0",[481,837,838,841],{},[29,839,840],{},"\">=1.0, \u003C2.0\""," → explicit range",[481,843,844,847],{},[29,845,846],{},"\"*\""," → any (avoid)",[14,849,851],{"id":850},"dependency-sources","Dependency Sources",[19,853,854],{"language":644},[23,855,857],{"className":647,"code":856,"language":644,"meta":27,"style":27},"[dependencies]\n# crates.io\nserde = \"1.0\"\n\n# git\nmy_crate = { git = \"https:\u002F\u002Fgithub.com\u002Fuser\u002Fcrate\", branch = \"dev\" }\nmy_crate2 = { git = \"...\", tag = \"v1.2.3\" }\nmy_crate3 = { git = \"...\", rev = \"abc123\" }\n\n# path (local)\nmy_local = { path = \"..\u002Fmy_local\" }\n\n# optional dependency behind a feature\nextra = { version = \"1.0\", optional = true }\n",[29,858,859,863,868,873,877,882,887,892,897,901,906,911,915,920],{"__ignoreMap":27},[32,860,861],{"class":34,"line":35},[32,862,706],{},[32,864,865],{"class":34,"line":42},[32,866,867],{},"# crates.io\n",[32,869,870],{"class":34,"line":57},[32,871,872],{},"serde = \"1.0\"\n",[32,874,875],{"class":34,"line":73},[32,876,701],{"emptyLinePlaceholder":700},[32,878,879],{"class":34,"line":214},[32,880,881],{},"# git\n",[32,883,884],{"class":34,"line":239},[32,885,886],{},"my_crate = { git = \"https:\u002F\u002Fgithub.com\u002Fuser\u002Fcrate\", branch = \"dev\" }\n",[32,888,889],{"class":34,"line":255},[32,890,891],{},"my_crate2 = { git = \"...\", tag = \"v1.2.3\" }\n",[32,893,894],{"class":34,"line":270},[32,895,896],{},"my_crate3 = { git = \"...\", rev = \"abc123\" }\n",[32,898,899],{"class":34,"line":286},[32,900,701],{"emptyLinePlaceholder":700},[32,902,903],{"class":34,"line":310},[32,904,905],{},"# path (local)\n",[32,907,908],{"class":34,"line":333},[32,909,910],{},"my_local = { path = \"..\u002Fmy_local\" }\n",[32,912,913],{"class":34,"line":357},[32,914,701],{"emptyLinePlaceholder":700},[32,916,917],{"class":34,"line":373},[32,918,919],{},"# optional dependency behind a feature\n",[32,921,922],{"class":34,"line":719},[32,923,924],{},"extra = { version = \"1.0\", optional = true }\n",[14,926,928],{"id":927},"features","Features",[78,930,931,932,935],{},"Features enable ",[139,933,934],{},"conditional compilation",". Avoid exposing features of dependencies (this causes \"feature unification\" surprises). Use direct deps + optional features instead.",[19,937,938],{"language":21},[23,939,941],{"className":25,"code":940,"language":21,"meta":27,"style":27},"#[cfg(feature = \"json\")]\nmod json;\n",[29,942,943,956],{"__ignoreMap":27},[32,944,945,948,950,953],{"class":34,"line":35},[32,946,947],{"class":53},"#[cfg(feature ",[32,949,160],{"class":45},[32,951,952],{"class":66}," \"json\"",[32,954,955],{"class":53},")]\n",[32,957,958,961,964],{"class":34,"line":42},[32,959,960],{"class":45},"mod",[32,962,963],{"class":49}," json",[32,965,166],{"class":53},[14,967,969],{"id":968},"cargolock",[29,970,971],{},"Cargo.lock",[478,973,974,977,988],{},[481,975,976],{},"Pin exact versions resolved for your dependency graph.",[481,978,979,980,983,984,987],{},"Always commit for ",[139,981,982],{},"binaries",". For ",[139,985,986],{},"libraries"," the official recommendation is also to commit it, but it's commonly gitignored.",[481,989,990,993,994,997],{},[29,991,992],{},"cargo update"," bumps within semver-compatible range; ",[29,995,996],{},"cargo update -p serde --precise 1.0.150"," pins a single crate.",[14,999,1001],{"id":1000},"workspaces","Workspaces",[78,1003,1004,1005,1008],{},"When multiple crates share a workspace, dependency versions unify and ",[29,1006,1007],{},"target\u002F"," is shared:",[19,1010,1011],{"language":644},[23,1012,1014],{"className":647,"code":1013,"language":644,"meta":27,"style":27},"# Cargo.toml (workspace root)\n[workspace]\nmembers = [\"crates\u002F*\", \"app\"]\n\n[workspace.dependencies]\nserde = \"1.0\"\n",[29,1015,1016,1021,1026,1031,1035,1040],{"__ignoreMap":27},[32,1017,1018],{"class":34,"line":35},[32,1019,1020],{},"# Cargo.toml (workspace root)\n",[32,1022,1023],{"class":34,"line":42},[32,1024,1025],{},"[workspace]\n",[32,1027,1028],{"class":34,"line":57},[32,1029,1030],{},"members = [\"crates\u002F*\", \"app\"]\n",[32,1032,1033],{"class":34,"line":73},[32,1034,701],{"emptyLinePlaceholder":700},[32,1036,1037],{"class":34,"line":214},[32,1038,1039],{},"[workspace.dependencies]\n",[32,1041,1042],{"class":34,"line":239},[32,1043,872],{},[78,1045,1046,1047,1050],{},"Members then reference with ",[29,1048,1049],{},"serde.workspace = true",".",[14,1052,1054],{"id":1053},"edge-cases","Edge Cases",[478,1056,1057,1077,1096,1114,1129,1138],{},[481,1058,1059,1065,1066,1069,1070,1073,1074,1050],{},[139,1060,1061,1062],{},"Binaries from ",[29,1063,1064],{},"src\u002Fbin\u002F*.rs",": each ",[29,1067,1068],{},".rs"," file in ",[29,1071,1072],{},"src\u002Fbin\u002F"," becomes a separate binary target automatically. Run with ",[29,1075,1076],{},"cargo run --bin extra",[481,1078,1079,1088,1089,1092,1093,1050],{},[139,1080,1081,1084,1085],{},[29,1082,1083],{},"cargo run"," passes args after ",[29,1086,1087],{},"--",": ",[29,1090,1091],{},"cargo run -- --flag"," runs your binary with ",[29,1094,1095],{},"--flag",[481,1097,1098,1105,1106,1109,1110,1113],{},[139,1099,1100,1101,1104],{},"Multiple ",[29,1102,1103],{},"[[bin]]"," targets"," can share a ",[29,1107,1108],{},"src\u002Flib.rs"," for logic and have thin ",[29,1111,1112],{},"src\u002Fbin\u002F*"," shells.",[481,1115,1116,1088,1121,1124,1125,1128],{},[139,1117,1118,1120],{},[29,1119,83],{}," error codes",[29,1122,1123],{},"E0382"," etc. Search ",[29,1126,1127],{},"rustc --explain E0382"," or online for detailed explanations.",[481,1130,1131,1088,1134,1137],{},[139,1132,1133],{},"Build scripts",[29,1135,1136],{},"build.rs"," runs before compilation; use for linking C libs, generating code at build time.",[481,1139,1140,1088,1146,296,1149,1152,1153,1050],{},[139,1141,1142,1145],{},[29,1143,1144],{},"CARGO_*"," env vars",[29,1147,1148],{},"CARGO_PKG_VERSION",[29,1150,1151],{},"CARGO_MANIFEST_DIR",", etc., useful in build scripts and via ",[29,1154,1155],{},"env!",[14,1157,1159],{"id":1158},"reading-compiler-errors","Reading Compiler Errors",[78,1161,1162,1163,1166],{},"Rust errors are structured: the message, an ",[29,1164,1165],{},"-->"," pointing at the code, and often a help\u002Fnote. Multi-error cascades are common — fix the first error, then re-run; later ones often vanish.",[14,1168,1170],{"id":1169},"summary","Summary",[78,1172,1173],{},"You can scaffold, build, run, format, lint, and document a project. Next: the type system starts with variables and mutability.",[1175,1176,1177],"style",{},"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 .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 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":27,"searchDepth":42,"depth":42,"links":1179},[1180,1181,1185,1187,1189,1193,1194,1195,1196,1197,1198,1199],{"id":16,"depth":42,"text":17},{"id":124,"depth":42,"text":1182,"children":1183},"println! is a Macro, Not a Function",[1184],{"id":395,"depth":57,"text":396},{"id":448,"depth":42,"text":1186},"Anatomy of main",{"id":569,"depth":42,"text":1188},"Cargo: new vs init",{"id":637,"depth":42,"text":1190,"children":1191},"Cargo.toml Anatomy",[1192],{"id":804,"depth":57,"text":805},{"id":850,"depth":42,"text":851},{"id":927,"depth":42,"text":928},{"id":968,"depth":42,"text":971},{"id":1000,"depth":42,"text":1001},{"id":1053,"depth":42,"text":1054},{"id":1158,"depth":42,"text":1159},{"id":1169,"depth":42,"text":1170},"md",{},"\u002Frust\u002F02-hello-world-and-cargo",{"title":5,"description":27},"rust\u002F02-hello-world-and-cargo","NjzXAwkdN2nXwWhkuzIeub350sn4YhKHSswEM7W7yzQ",1785944093183]