[{"data":1,"prerenderedAt":3865},["ShallowReactive",2],{"/blog/learning-rust-with-a-little-help-from-ai-code-suggestions-getting-started":3,"navigation-en-us":3083,"banner-en-us":3508,"footer-en-us":3518,"blog-post-authors-en-us-Michael Friedrich":3762,"blog-related-posts-en-us-learning-rust-with-a-little-help-from-ai-code-suggestions-getting-started":3777,"blog-promotions-en-us":3802,"next-steps-en-us":3855},{"id":4,"title":5,"authors":6,"body":8,"category":3060,"date":3061,"description":3062,"extension":3063,"externalUrl":3064,"faq":3064,"featured":3065,"heroImage":3066,"meta":3067,"navigation":322,"path":3068,"seo":3069,"slug":3073,"stem":3074,"tags":3075,"template":3081,"updatedDate":3064,"__hash__":3082},"blogPosts/en-us/blog/learning-rust-with-a-little-help-from-ai-code-suggestions-getting-started.md","Learning Rust with a little help from AI",[7],"Michael Friedrich",{"type":9,"value":10,"toc":3037},"minimark",[11,15,130,134,155,158,166,170,179,209,225,228,231,244,247,255,280,283,286,301,346,356,359,403,406,420,450,453,456,468,483,490,496,504,510,521,532,535,556,562,578,581,589,592,604,619,681,686,709,712,741,750,753,782,943,961,1029,1037,1040,1046,1049,1062,1077,1083,1089,1111,1117,1125,1128,1140,1147,1153,1164,1178,1184,1187,1238,1244,1250,1256,1259,1268,1284,1314,1324,1332,1335,1423,1433,1439,1448,1462,1474,1624,1633,1639,1874,1885,1909,1916,1923,1930,1938,1941,1948,1960,2055,2063,2201,2206,2392,2395,2609,2615,2624,2630,2633,2662,2853,2860,2872,2878,2885,2903,2906,2909,2912,2948,2951,2959,2988,3009,3012,3020,3033],[12,13,14],"p",{},"Learning a new programming language can help broaden your software development expertise, open career opportunities, or create fun challenges. However, it can be difficult to decide on one specific approach to learning a new language. Artificial intelligence (AI) can help. In this tutorial, you'll learn how to leverage AI-powered GitLab Duo Code Suggestions for a guided experience in learning the Rust programming language.",[16,17,18,40,60,66,72,110],"ul",{},[19,20,21,26],"li",{},[22,23,25],"a",{"href":24},"#preparations","Preparations",[16,27,28,34],{},[19,29,30],{},[22,31,33],{"href":32},"#vs-code","VS Code",[19,35,36],{},[22,37,39],{"href":38},"#code-suggestions","Code Suggestions",[19,41,42,46],{},[22,43,45],{"href":44},"#learning-a-new-programming-language-rust","Learning a new programming language: Rust",[16,47,48,54],{},[19,49,50],{},[22,51,53],{"href":52},"#development-environment-for-rust","Development environment for Rust",[19,55,56],{},[22,57,59],{"href":58},"#hello-world","Hello, World",[19,61,62],{},[22,63,65],{"href":64},"#cargo-bringing-structure-into-rust","Cargo: Bringing structure into Rust",[19,67,68],{},[22,69,71],{"href":70},"#automation-configure-cicd-pipeline-for-rust","Automation: Configure CI/CD pipeline for Rust",[19,73,74,78],{},[22,75,77],{"href":76},"#continue-learning-rust","Continue learning Rust",[16,79,80,86,92,98,104],{},[19,81,82],{},[22,83,85],{"href":84},"#define-variables-and-print-them","Define variables and print them",[19,87,88],{},[22,89,91],{"href":90},"#explore-variable-types","Explore variable types",[19,93,94],{},[22,95,97],{"href":96},"#flow-control-conditions-and-loops","Flow control: Conditions and loops",[19,99,100],{},[22,101,103],{"href":102},"#functions","Functions",[19,105,106],{},[22,107,109],{"href":108},"#testing","Testing",[19,111,112,116],{},[22,113,115],{"href":114},"#what-is-next","What is next",[16,117,118,124],{},[19,119,120],{},[22,121,123],{"href":122},"#async-learning-exercises","Async learning exercises",[19,125,126],{},[22,127,129],{"href":128},"#share-your-feedback","Share your feedback",[131,132,25],"h2",{"id":133},"preparations",[12,135,136,137,142,143,148,149,154],{},"Choose your ",[22,138,141],{"href":139,"rel":140},"https://docs.gitlab.com/user/project/repository/code_suggestions/#enable-code-suggestions-in-other-ides-and-editors",[],"preferred and supported IDE",", and follow the documentation to enable code suggestions for ",[22,144,147],{"href":145,"rel":146},"https://docs.gitlab.com/user/project/repository/code_suggestions/#enable-code-suggestions-on-gitlab-saas",[],"GitLab.com SaaS"," or ",[22,150,153],{"href":151,"rel":152},"https://docs.gitlab.com/user/project/repository/code_suggestions/#enable-code-suggestions-on-self-managed-gitlab",[],"GitLab self-managed instances",".",[12,156,157],{},"Programming languages can require an install of the language interpreter command-line tools or compilers that generate binaries from source code to build and run the application.",[12,159,160,161,165],{},"Tip: You can also use ",[22,162,164],{"href":163},"/blog/quick-start-guide-for-gitlab-workspaces/","GitLab Remote Development workspaces"," to create your own cloud development environments, instead of local development environments. This blog post focuses on using VS Code and the GitLab Web IDE.",[167,168,33],"h3",{"id":169},"vs-code",[12,171,172,173,178],{},"On macOS, you can ",[22,174,177],{"href":175,"rel":176},"https://code.visualstudio.com/download",[],"install VS Code"," as a Homebrew cask or manually download and install it.",[180,181,186],"pre",{"className":182,"code":183,"language":184,"meta":185,"style":185},"language-shell shiki shiki-themes github-light","brew install --cask visual-studio-code\n","shell","",[187,188,189],"code",{"__ignoreMap":185},[190,191,194,198,202,206],"span",{"class":192,"line":193},"line",1,[190,195,197],{"class":196},"s7eDp","brew",[190,199,201],{"class":200},"sYBdl"," install",[190,203,205],{"class":204},"sYu0t"," --cask",[190,207,208],{"class":200}," visual-studio-code\n",[12,210,211,212,215,216,219,220,154],{},"Navigate to the ",[187,213,214],{},"Extensions"," menu and search for ",[187,217,218],{},"gitlab workflow",". Install the ",[22,221,224],{"href":222,"rel":223},"https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow",[],"GitLab workflow extension for VS Code",[12,226,227],{},"Tip: VS Code will also detect the programming languages, and offer to install additional plugins for syntax highlighting and development experience.",[167,229,39],{"id":230},"code-suggestions",[12,232,233,234,237,238,243],{},"It can help to familiarize yourself with suggestions before actually verifying the suggestions. GitLab Code Suggestions are provided as you type, so you do not need use specific keyboard shortcuts. To accept a code suggestion, press the ",[187,235,236],{},"tab"," key. Also note that writing new code works more reliably than refactoring existing code. AI is non-deterministic, which means that the same suggestion may not be repeated after deleting the code suggestion. While Code Suggestions is in Beta, we are working on improving the accuracy of generated content overall. Please review the ",[22,239,242],{"href":240,"rel":241},"https://docs.gitlab.com/user/project/repository/code_suggestions/#known-limitations",[],"known limitations",", as this could affect your learning experience.",[131,245,45],{"id":246},"learning-a-new-programming-language-rust",[12,248,249,250,154],{},"Now, let's dig into learning Rust, which is one of the ",[22,251,254],{"href":252,"rel":253},"https://docs.gitlab.com/user/project/repository/code_suggestions/#supported-languages",[],"supported languages in Code Suggestions",[12,256,257,262,263,268,269,274,275,154],{},[22,258,261],{"href":259,"rel":260},"https://doc.rust-lang.org/rust-by-example/",[],"Rust by Example"," provides a great tutorial for beginners, together with the official ",[22,264,267],{"href":265,"rel":266},"https://doc.rust-lang.org/book/",[],"Rust book",". The ",[22,270,273],{"href":271,"rel":272},"https://hands-on-rust.com/",[],"Hands-on Rust book"," shows how to build a 2D game as a more practical approach. More examples are shared in ",[22,276,279],{"href":277,"rel":278},"https://github.com/sger/RustBooks",[],"this Rust book list",[12,281,282],{},"Before diving into the source code, make sure to set up your development environment.",[167,284,53],{"id":285},"development-environment-for-rust",[287,288,289],"ol",{},[19,290,291,292,295,296,154],{},"Create a new project ",[187,293,294],{},"learn-rust-ai"," in GitLab, and clone the project into your development environment. All code snippets are available in ",[22,297,300],{"href":298,"rel":299},"https://gitlab.com/gitlab-da/use-cases/ai/learn-with-ai/learn-rust-ai",[],"this \"Learn Rust with AI\" project",[180,302,304],{"className":182,"code":303,"language":184,"meta":185,"style":185},"git clone https://gitlab.com/NAMESPACE/learn-rust-ai.git\n\ncd learn-rust-ai\n\ngit status\n",[187,305,306,317,324,333,338],{"__ignoreMap":185},[190,307,308,311,314],{"class":192,"line":193},[190,309,310],{"class":196},"git",[190,312,313],{"class":200}," clone",[190,315,316],{"class":200}," https://gitlab.com/NAMESPACE/learn-rust-ai.git\n",[190,318,320],{"class":192,"line":319},2,[190,321,323],{"emptyLinePlaceholder":322},true,"\n",[190,325,327,330],{"class":192,"line":326},3,[190,328,329],{"class":204},"cd",[190,331,332],{"class":200}," learn-rust-ai\n",[190,334,336],{"class":192,"line":335},4,[190,337,323],{"emptyLinePlaceholder":322},[190,339,341,343],{"class":192,"line":340},5,[190,342,310],{"class":196},[190,344,345],{"class":200}," status\n",[287,347,348],{"start":319},[19,349,350,351,154],{},"Install Rust and the build toolchain. Fortunately, this is straightforward ",[22,352,355],{"href":353,"rel":354},"https://www.rust-lang.org/tools/install",[],"following the Rust install documentation",[12,357,358],{},"Tip for using the generic installer: Download the script and run it after review.",[180,360,362],{"className":182,"code":361,"language":184,"meta":185,"style":185},"# Download and print the script before running it\ncurl -Lvs https://sh.rustup.rs -o rustup-init.sh\n\n# Run the Rust installer script\nsh rustup-init.sh\n",[187,363,364,370,387,391,396],{"__ignoreMap":185},[190,365,366],{"class":192,"line":193},[190,367,369],{"class":368},"sAwPA","# Download and print the script before running it\n",[190,371,372,375,378,381,384],{"class":192,"line":319},[190,373,374],{"class":196},"curl",[190,376,377],{"class":204}," -Lvs",[190,379,380],{"class":200}," https://sh.rustup.rs",[190,382,383],{"class":204}," -o",[190,385,386],{"class":200}," rustup-init.sh\n",[190,388,389],{"class":192,"line":326},[190,390,323],{"emptyLinePlaceholder":322},[190,392,393],{"class":192,"line":335},[190,394,395],{"class":368},"# Run the Rust installer script\n",[190,397,398,401],{"class":192,"line":340},[190,399,400],{"class":196},"sh",[190,402,386],{"class":200},[12,404,405],{},"Example on macOS using Homebrew:",[180,407,409],{"className":182,"code":408,"language":184,"meta":185,"style":185},"brew install rust\n",[187,410,411],{"__ignoreMap":185},[190,412,413,415,417],{"class":192,"line":193},[190,414,197],{"class":196},[190,416,201],{"class":200},[190,418,419],{"class":200}," rust\n",[287,421,422,430],{},[19,423,424,425,154],{},"Optional: Install the ",[22,426,429],{"href":427,"rel":428},"https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer",[],"rust-analyzer VS Code extension",[19,431,432,433,441,442,154],{},"Each exercise will invite you to compile the code with the ",[22,434,437,440],{"href":435,"rel":436},"https://doc.rust-lang.org/rustc/what-is-rustc.html",[],[187,438,439],{},"rustc"," command",", and later using ",[22,443,446,449],{"href":444,"rel":445},"https://doc.rust-lang.org/cargo/index.html",[],[187,447,448],{},"cargo"," as build tool and package manager",[12,451,452],{},"You are all set to learn Rust!",[167,454,59],{"id":455},"hello-world",[12,457,458,459,462,463,154],{},"We will start with ",[22,460,261],{"href":259,"rel":461},[],", and follow the ",[22,464,467],{"href":465,"rel":466},"https://doc.rust-lang.org/rust-by-example/hello.html",[],"Hello, World exercise",[12,469,470,471,474,475,478,479,482],{},"Create a new file ",[187,472,473],{},"hello.rs"," in the root directory of the project and start with a comment saying ",[187,476,477],{},"// Hello world",". Next, start writing the ",[187,480,481],{},"main"," function, and verify the code suggestion.",[12,484,485],{},[486,487],"img",{"alt":488,"src":489},"VS Code hello.rs Rust code suggestion, asking to accept","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398635/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_hello_world_suggested.png",[12,491,492,493,495],{},"Accept the suggestion by pressing the ",[187,494,236],{}," key and save the file (keyboard shortcut: cmd s).",[180,497,502],{"className":498,"code":500,"language":501,"meta":185},[499],"language-text","// Hello world\n\nfn main() {\n    println!(\"Hello, world!\");\n}\n","text",[187,503,500],{"__ignoreMap":185},[12,505,506],{},[486,507],{"alt":508,"src":509},"VS Code hello.rs Rust code suggestion, accepted","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398634/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_hello_world_accepted.png",[12,511,512,513,516,517,520],{},"Commit the change to the Git repository. In VS Code, use the keyboard shortcut ",[187,514,515],{},"ctrl shift G",", add a commit message, and hit ",[187,518,519],{},"cmd enter"," to submit.",[12,522,523,524,527,528,531],{},"Use the command palette (",[187,525,526],{},"cmd shift p",") and search for ",[187,529,530],{},"create terminal"," to open a new terminal.",[12,533,534],{},"Build and run the code.",[180,536,538],{"className":182,"code":537,"language":184,"meta":185,"style":185},"rustc hello.rs\n\n./hello\n",[187,539,540,547,551],{"__ignoreMap":185},[190,541,542,544],{"class":192,"line":193},[190,543,439],{"class":196},[190,545,546],{"class":200}," hello.rs\n",[190,548,549],{"class":192,"line":319},[190,550,323],{"emptyLinePlaceholder":322},[190,552,553],{"class":192,"line":326},[190,554,555],{"class":196},"./hello\n",[12,557,558],{},[486,559],{"alt":560,"src":561},"hello.rs Rust code suggestion, accepted, compiled, run","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398634/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_hello_world_cli_build.png",[12,563,564,565,574,575,577],{},"Tip: Adding ",[22,566,569,570,573],{"href":567,"rel":568},"https://doc.rust-lang.org/reference/comments.html",[],"code comments in Rust (",[187,571,572],{},"//",")"," before you start writing a function or algorithm will help Code Suggestions with more context to provide better suggestions. In the example above, we did that with ",[187,576,477],{},", and will continue doing so in the next exercises.",[131,579,65],{"id":580},"cargo-bringing-structure-into-rust",[12,582,583,588],{},[22,584,587],{"href":585,"rel":586},"https://doc.rust-lang.org/rust-by-example/cargo.html",[],"Cargo"," is the official Rust package management tool. It is more than that - you can run build and test commands because Cargo understands them as well.",[12,590,591],{},"You can initialize a new Cargo configuration in the current directory tree with the following command:",[180,593,595],{"className":182,"code":594,"language":184,"meta":185,"style":185},"cargo init\n",[187,596,597],{"__ignoreMap":185},[190,598,599,601],{"class":192,"line":193},[190,600,448],{"class":196},[190,602,603],{"class":200}," init\n",[12,605,606,607,610,611,614,615,618],{},"The directory tree invites you to add the source code into the ",[187,608,609],{},"src/"," directory, while ",[187,612,613],{},"Cargo.toml"," manages the dependencies and used compiler versions. The ",[187,616,617],{},".gitignore"," file is also added including best practices.",[180,620,622],{"className":182,"code":621,"language":184,"meta":185,"style":185},"tree\n.\n├── Cargo.toml\n├── README.md\n├── hello\n├── hello.rs\n└── src\n    └── main.rs\n\n",[187,623,624,629,634,642,649,656,663,672],{"__ignoreMap":185},[190,625,626],{"class":192,"line":193},[190,627,628],{"class":196},"tree\n",[190,630,631],{"class":192,"line":319},[190,632,633],{"class":204},".\n",[190,635,636,639],{"class":192,"line":326},[190,637,638],{"class":196},"├──",[190,640,641],{"class":200}," Cargo.toml\n",[190,643,644,646],{"class":192,"line":335},[190,645,638],{"class":196},[190,647,648],{"class":200}," README.md\n",[190,650,651,653],{"class":192,"line":340},[190,652,638],{"class":196},[190,654,655],{"class":200}," hello\n",[190,657,659,661],{"class":192,"line":658},6,[190,660,638],{"class":196},[190,662,546],{"class":200},[190,664,666,669],{"class":192,"line":665},7,[190,667,668],{"class":196},"└──",[190,670,671],{"class":200}," src\n",[190,673,675,678],{"class":192,"line":674},8,[190,676,677],{"class":196},"    └──",[190,679,680],{"class":200}," main.rs\n",[12,682,683,684,154],{},"Try building the code and running it using ",[187,685,448],{},[180,687,689],{"className":182,"code":688,"language":184,"meta":185,"style":185},"cargo build\n\ncargo run\n",[187,690,691,698,702],{"__ignoreMap":185},[190,692,693,695],{"class":192,"line":193},[190,694,448],{"class":196},[190,696,697],{"class":200}," build\n",[190,699,700],{"class":192,"line":319},[190,701,323],{"emptyLinePlaceholder":322},[190,703,704,706],{"class":192,"line":326},[190,705,448],{"class":196},[190,707,708],{"class":200}," run\n",[12,710,711],{},"Commit all changes and push them to your GitLab project.",[180,713,715],{"className":182,"code":714,"language":184,"meta":185,"style":185},"git commit -avm \"Initialize Cargo\"\n\ngit push\n",[187,716,717,730,734],{"__ignoreMap":185},[190,718,719,721,724,727],{"class":192,"line":193},[190,720,310],{"class":196},[190,722,723],{"class":200}," commit",[190,725,726],{"class":204}," -avm",[190,728,729],{"class":200}," \"Initialize Cargo\"\n",[190,731,732],{"class":192,"line":319},[190,733,323],{"emptyLinePlaceholder":322},[190,735,736,738],{"class":192,"line":326},[190,737,310],{"class":196},[190,739,740],{"class":200}," push\n",[12,742,743,744,749],{},"After exploring Cargo, let's make sure that our code is continuously tested while learning Rust. The next section explains how to set up ",[22,745,748],{"href":746,"rel":747},"https://about.gitlab.com/topics/ci-cd/",[],"GitLab CI/CD"," for Rust.",[131,751,71],{"id":752},"automation-configure-cicd-pipeline-for-rust",[12,754,755,756,761,762,767,768,771,772,777,778,781],{},"The ",[22,757,760],{"href":758,"rel":759},"https://docs.gitlab.com/ci/",[],"CI/CD pipeline"," should run two jobs in two stages: Build and test the code. The default container ",[22,763,766],{"href":764,"rel":765},"https://docs.gitlab.com/ci/yaml/#image",[],"image",", ",[187,769,770],{},"rust:latest",", works in the first iteration. In order to save resources, the CI/CD configuration also supports ",[22,773,776],{"href":774,"rel":775},"https://docs.gitlab.com/ci/caching/",[],"caching"," for downloaded dependencies and build objects. The ",[187,779,780],{},"CARGO_HOME"," variable is set to the CI/CD job home directory to ensure everything gets appropriately cached.",[180,783,787],{"className":784,"code":785,"language":786,"meta":185,"style":185},"language-yaml shiki shiki-themes github-light","stages:\n  - build\n  - test\n\ndefault:\n  image: rust:latest\n  cache:\n    key: ${CI_COMMIT_REF_SLUG}\n    paths:\n      - .cargo/bin\n      - .cargo/registry/index\n      - .cargo/registry/cache\n      - target/debug/deps\n      - target/debug/build\n    policy: pull-push\n\n# Cargo data needs to be in the project directory to be cached.\nvariables:\n  CARGO_HOME: ${CI_PROJECT_DIR}/.cargo\n\n","yaml",[187,788,789,799,807,814,818,825,836,843,853,861,870,878,886,894,902,913,918,924,932],{"__ignoreMap":185},[190,790,791,795],{"class":192,"line":193},[190,792,794],{"class":793},"shJU0","stages",[190,796,798],{"class":797},"sgsFI",":\n",[190,800,801,804],{"class":192,"line":319},[190,802,803],{"class":797},"  - ",[190,805,806],{"class":200},"build\n",[190,808,809,811],{"class":192,"line":326},[190,810,803],{"class":797},[190,812,813],{"class":200},"test\n",[190,815,816],{"class":192,"line":335},[190,817,323],{"emptyLinePlaceholder":322},[190,819,820,823],{"class":192,"line":340},[190,821,822],{"class":793},"default",[190,824,798],{"class":797},[190,826,827,830,833],{"class":192,"line":658},[190,828,829],{"class":793},"  image",[190,831,832],{"class":797},": ",[190,834,835],{"class":200},"rust:latest\n",[190,837,838,841],{"class":192,"line":665},[190,839,840],{"class":793},"  cache",[190,842,798],{"class":797},[190,844,845,848,850],{"class":192,"line":674},[190,846,847],{"class":793},"    key",[190,849,832],{"class":797},[190,851,852],{"class":200},"${CI_COMMIT_REF_SLUG}\n",[190,854,856,859],{"class":192,"line":855},9,[190,857,858],{"class":793},"    paths",[190,860,798],{"class":797},[190,862,864,867],{"class":192,"line":863},10,[190,865,866],{"class":797},"      - ",[190,868,869],{"class":200},".cargo/bin\n",[190,871,873,875],{"class":192,"line":872},11,[190,874,866],{"class":797},[190,876,877],{"class":200},".cargo/registry/index\n",[190,879,881,883],{"class":192,"line":880},12,[190,882,866],{"class":797},[190,884,885],{"class":200},".cargo/registry/cache\n",[190,887,889,891],{"class":192,"line":888},13,[190,890,866],{"class":797},[190,892,893],{"class":200},"target/debug/deps\n",[190,895,897,899],{"class":192,"line":896},14,[190,898,866],{"class":797},[190,900,901],{"class":200},"target/debug/build\n",[190,903,905,908,910],{"class":192,"line":904},15,[190,906,907],{"class":793},"    policy",[190,909,832],{"class":797},[190,911,912],{"class":200},"pull-push\n",[190,914,916],{"class":192,"line":915},16,[190,917,323],{"emptyLinePlaceholder":322},[190,919,921],{"class":192,"line":920},17,[190,922,923],{"class":368},"# Cargo data needs to be in the project directory to be cached.\n",[190,925,927,930],{"class":192,"line":926},18,[190,928,929],{"class":793},"variables",[190,931,798],{"class":797},[190,933,935,938,940],{"class":192,"line":934},19,[190,936,937],{"class":793},"  CARGO_HOME",[190,939,832],{"class":797},[190,941,942],{"class":200},"${CI_PROJECT_DIR}/.cargo\n",[12,944,945,946,952,953,154],{},"The CI/CD jobs inherit the ",[22,947,950],{"href":948,"rel":949},"https://docs.gitlab.com/ci/yaml/#default",[],[187,951,822],{}," values, and specify the cargo commands in the ",[22,954,957,960],{"href":955,"rel":956},"https://docs.gitlab.com/ci/yaml/#script",[],[187,958,959],{},"script"," section",[180,962,964],{"className":784,"code":963,"language":786,"meta":185,"style":185},"build-latest:\n  stage: build\n  script:\n    - cargo build --verbose\n\ntest-latest:\n  stage: build\n  script:\n    - cargo test --verbose\n\n",[187,965,966,973,982,989,997,1001,1008,1016,1022],{"__ignoreMap":185},[190,967,968,971],{"class":192,"line":193},[190,969,970],{"class":793},"build-latest",[190,972,798],{"class":797},[190,974,975,978,980],{"class":192,"line":319},[190,976,977],{"class":793},"  stage",[190,979,832],{"class":797},[190,981,806],{"class":200},[190,983,984,987],{"class":192,"line":326},[190,985,986],{"class":793},"  script",[190,988,798],{"class":797},[190,990,991,994],{"class":192,"line":335},[190,992,993],{"class":797},"    - ",[190,995,996],{"class":200},"cargo build --verbose\n",[190,998,999],{"class":192,"line":340},[190,1000,323],{"emptyLinePlaceholder":322},[190,1002,1003,1006],{"class":192,"line":658},[190,1004,1005],{"class":793},"test-latest",[190,1007,798],{"class":797},[190,1009,1010,1012,1014],{"class":192,"line":665},[190,1011,977],{"class":793},[190,1013,832],{"class":797},[190,1015,806],{"class":200},[190,1017,1018,1020],{"class":192,"line":674},[190,1019,986],{"class":793},[190,1021,798],{"class":797},[190,1023,1024,1026],{"class":192,"line":855},[190,1025,993],{"class":797},[190,1027,1028],{"class":200},"cargo test --verbose\n",[12,1030,1031,1032,154],{},"You can see an example in ",[22,1033,1036],{"href":1034,"rel":1035},"https://gitlab.com/gitlab-da/use-cases/ai/learn-with-ai/learn-rust-ai/-/merge_requests/1/diffs",[],"this MR",[131,1038,77],{"id":1039},"continue-learning-rust",[12,1041,1042,1043,1045],{},"Make sure to add new source code into the ",[187,1044,609],{}," directory.",[167,1047,85],{"id":1048},"define-variables-and-print-them",[12,1050,1051,1052,1057,1058,1061],{},"Practice adding a few more ",[22,1053,1056],{"href":1054,"rel":1055},"https://doc.rust-lang.org/rust-by-example/hello/print.html",[],"print"," statements into ",[187,1059,1060],{},"src/main.rs",", and then build and run the code again.",[287,1063,1064,1071],{},[19,1065,1066,1067,1070],{},"Define a variable called ",[187,1068,1069],{},"name"," and assign your name as string value.",[19,1072,1073,1074,154],{},"Print the name, including a string prefix saying ",[187,1075,1076],{},"Hello, ",[12,1078,1079],{},[486,1080],{"alt":1081,"src":1082},"VS Code main.rs Rust code suggestion, first step in print","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398636/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_print_variable_first.png",[12,1084,1085],{},[486,1086],{"alt":1087,"src":1088},"VS Code main.rs Rust code suggestion, second step in print","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398637/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_print_variable_second.png",[287,1090,1091,1100],{},[19,1092,1093,1094,527,1097,154],{},"Open a new terminal in VS Code using the command palette (keyboard shortcut ",[187,1095,1096],{},"cmd + shift + p",[187,1098,1099],{},"terminal",[19,1101,1102,1103,1106,1107,1110],{},"Build and run the code with the ",[187,1104,1105],{},"cargo build"," and ",[187,1108,1109],{},"cargo run"," commands.",[12,1112,1113],{},[486,1114],{"alt":1115,"src":1116},"VS Code terminal with cargo build and run output","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398636/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_print_variable_cargo_build_run_terminal.png",[12,1118,1119,1120,154],{},"An example solution can be found ",[22,1121,1124],{"href":1122,"rel":1123},"https://gitlab.com/gitlab-da/use-cases/ai/learn-with-ai/learn-rust-ai/-/blob/main/solutions/variable_print.rs",[],"here",[167,1126,91],{"id":1127},"explore-variable-types",[12,1129,1130,1131,1136,1137,1139],{},"Define different variable value types (",[22,1132,1135],{"href":1133,"rel":1134},"https://doc.rust-lang.org/rust-by-example/primitives.html",[],"primitives",") and embed them into the ",[187,1138,1056],{}," statements. Maybe they feel familiar with other programming languages?",[12,1141,1142,1143,1146],{},"Tip: Use code comments to see which code suggestions can be useful to learn. Start with typing ",[187,1144,1145],{},"// Integer addition"," and see what code suggestions you can add.",[12,1148,1149],{},[486,1150],{"alt":1151,"src":1152},"VS Code main.rs Rust code suggestion, primitive types with literals and expressions","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398636/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_primitive_types_literals_operators.png",[12,1154,1155,1156,1159,1160,1163],{},"Experiment with GitLab Duo Code Suggestions. The shown examples are non-deterministic, but you may be able to add additions, subscriptions, multiplications, etc., and the corresponding ",[187,1157,1158],{},"println"," statements just by accepting code suggestions and continuing the flow with ",[187,1161,1162],{},"enter"," or completing the code statements. This workflow can create a chain of code suggestions that can help you learn the Rust language.",[12,1165,1166,1170,1174],{},[486,1167],{"alt":1168,"src":1169},"Literals and expressions, first suggestion","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398635/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_literals_expressions_01.png",[486,1171],{"alt":1172,"src":1173},"Literals and expressions, second suggestion","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398635/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_literals_expressions_02.png",[486,1175],{"alt":1176,"src":1177},"Literals and expressions, third suggestion","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398636/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_literals_expressions_03.png",[12,1179,1119,1180,154],{},[22,1181,1124],{"href":1182,"rel":1183},"https://gitlab.com/gitlab-da/use-cases/ai/learn-with-ai/learn-rust-ai/-/blob/main/solutions/literals_expressions.rs",[],[12,1185,1186],{},"The code suggestions are not perfect. Sometimes there are errors that require you to fix the problems. When writing this blog post, I had to fix two missing semicolons at the end of the code lines. The great thing about the Rust compiler is that the error messages tell you exactly where the problem happens with suggestions to fix them. Code Suggestions and the Rust-provided build chain make writing Rust code more efficient.",[180,1188,1192],{"className":1189,"code":1190,"language":1191,"meta":185,"style":185},"language-rust shiki shiki-themes github-light","println!(\"Hello, {}!\", name)\n\n// Integer subtraction\nlet y = 9 - 4\n","rust",[187,1193,1194,1208,1212,1217],{"__ignoreMap":185},[190,1195,1196,1199,1202,1205],{"class":192,"line":193},[190,1197,1198],{"class":196},"println!",[190,1200,1201],{"class":797},"(",[190,1203,1204],{"class":200},"\"Hello, {}!\"",[190,1206,1207],{"class":797},", name)\n",[190,1209,1210],{"class":192,"line":319},[190,1211,323],{"emptyLinePlaceholder":322},[190,1213,1214],{"class":192,"line":326},[190,1215,1216],{"class":368},"// Integer subtraction\n",[190,1218,1219,1223,1226,1229,1232,1235],{"class":192,"line":335},[190,1220,1222],{"class":1221},"sD7c4","let",[190,1224,1225],{"class":797}," y ",[190,1227,1228],{"class":1221},"=",[190,1230,1231],{"class":204}," 9",[190,1233,1234],{"class":1221}," -",[190,1236,1237],{"class":204}," 4\n",[12,1239,1240],{},[486,1241],{"alt":1242,"src":1243},"Terminal build, errors, Rust compiler help","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398637/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_terminal_errors_rust_help.png",[12,1245,1246,1247,1249],{},"You can try to provoke the same error by removing a semicolon at the end of a statement and then running ",[187,1248,1105],{}," in the terminal again. The Rust compiler will also warn you about unused variables to help with better code quality. The screenshot shows warnings for variable definitions, and also a CLI command to fix them.",[12,1251,1252],{},[486,1253],{"alt":1254,"src":1255},"Terminal build, warnings, Rust compiler help","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398638/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_terminal_warnings_rust_help.png",[167,1257,97],{"id":1258},"flow-control-conditions-and-loops",[12,1260,1261,1262,1267],{},"Next, let's focus on ",[22,1263,1266],{"href":1264,"rel":1265},"https://doc.rust-lang.org/rust-by-example/flow_control.html",[],"flow control"," with conditions, loops, etc., and how to implement them.",[287,1269,1270,1277],{},[19,1271,1272,1273,1276],{},"Start typing ",[187,1274,1275],{},"// Flow control"," and see which suggestions are provided.",[19,1278,1279,1280,1283],{},"Experiment with the code, and continue defining a boolean variable ",[187,1281,1282],{},"v"," which is set to true.",[180,1285,1287],{"className":1189,"code":1286,"language":1191,"meta":185,"style":185},"\n  // Flow control\n  let v = true;\n\n",[187,1288,1289,1293,1298],{"__ignoreMap":185},[190,1290,1291],{"class":192,"line":193},[190,1292,323],{"emptyLinePlaceholder":322},[190,1294,1295],{"class":192,"line":319},[190,1296,1297],{"class":368},"  // Flow control\n",[190,1299,1300,1303,1306,1308,1311],{"class":192,"line":326},[190,1301,1302],{"class":1221},"  let",[190,1304,1305],{"class":797}," v ",[190,1307,1228],{"class":1221},[190,1309,1310],{"class":204}," true",[190,1312,1313],{"class":797},";\n",[12,1315,1316,1320],{},[486,1317],{"alt":1318,"src":1319},"Conditions, boolean variable","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398631/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_flow_control_conditions_01.png",[486,1321],{"alt":1322,"src":1323},"Conditions, boolean variable, if condition","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398632/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_flow_control_conditions_02.png",[287,1325,1326],{},[19,1327,1272,1328,1331],{},[187,1329,1330],{},"// Loops"," and experiment with the code suggestions.",[12,1333,1334],{},"Let's assume the loop looks the like following snippet. It does not have a loop counter which gets printed on every loop execution.",[180,1336,1338],{"className":1189,"code":1337,"language":1191,"meta":185,"style":185},"// Loops\nlet mut count = 0;\n\nloop {\n    count += 1;\n\n    if count == 10 {\n        break;\n    }\n}\n",[187,1339,1340,1345,1362,1366,1374,1387,1391,1406,1413,1418],{"__ignoreMap":185},[190,1341,1342],{"class":192,"line":193},[190,1343,1344],{"class":368},"// Loops\n",[190,1346,1347,1349,1352,1355,1357,1360],{"class":192,"line":319},[190,1348,1222],{"class":1221},[190,1350,1351],{"class":1221}," mut",[190,1353,1354],{"class":797}," count ",[190,1356,1228],{"class":1221},[190,1358,1359],{"class":204}," 0",[190,1361,1313],{"class":797},[190,1363,1364],{"class":192,"line":326},[190,1365,323],{"emptyLinePlaceholder":322},[190,1367,1368,1371],{"class":192,"line":335},[190,1369,1370],{"class":1221},"loop",[190,1372,1373],{"class":797}," {\n",[190,1375,1376,1379,1382,1385],{"class":192,"line":340},[190,1377,1378],{"class":797},"    count ",[190,1380,1381],{"class":1221},"+=",[190,1383,1384],{"class":204}," 1",[190,1386,1313],{"class":797},[190,1388,1389],{"class":192,"line":658},[190,1390,323],{"emptyLinePlaceholder":322},[190,1392,1393,1396,1398,1401,1404],{"class":192,"line":665},[190,1394,1395],{"class":1221},"    if",[190,1397,1354],{"class":797},[190,1399,1400],{"class":1221},"==",[190,1402,1403],{"class":204}," 10",[190,1405,1373],{"class":797},[190,1407,1408,1411],{"class":192,"line":674},[190,1409,1410],{"class":1221},"        break",[190,1412,1313],{"class":797},[190,1414,1415],{"class":192,"line":855},[190,1416,1417],{"class":797},"    }\n",[190,1419,1420],{"class":192,"line":863},[190,1421,1422],{"class":797},"}\n",[287,1424,1425],{"start":319},[19,1426,1272,1427,1429,1430,154],{},[187,1428,1198],{}," and see which code suggestions are provided, for example ",[187,1431,1432],{},"println!(\"Count: {}\", count);",[12,1434,1435],{},[486,1436],{"alt":1437,"src":1438},"Loops, loop counter print suggestion","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398633/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_flow_control_loops_print_counter.png",[287,1440,1441],{"start":326},[19,1442,1443,1444,1447],{},"Apply the suggestions, and execute ",[187,1445,1446],{},"cargo build && cargo run"," on the terminal again.",[12,1449,1450,1451,767,1456,1461],{},"Let's learn more: Rust supports different loop types, for example ",[22,1452,1455],{"href":1453,"rel":1454},"https://doc.rust-lang.org/rust-by-example/flow_control/while.html",[],"while loops",[22,1457,1460],{"href":1458,"rel":1459},"https://doc.rust-lang.org/rust-by-example/flow_control/for.html",[],"for loops",", etc.",[287,1463,1464],{},[19,1465,1466,1467,1470,1471,154],{},"Type ",[187,1468,1469],{},"// While loop"," and verify the code suggestions. Repeat the same for ",[187,1472,1473],{},"// For loop",[180,1475,1477],{"className":1189,"code":1476,"language":1191,"meta":185,"style":185},"// While loops\nlet mut count = 0;\n\nwhile count \u003C 10 {\n    count += 1;\n    println!(\"Count: {}\", count);\n}\n\n// For loops\nlet a = [10, 2, 3, 4, 5];\n\nfor element in a {\n    println!(\"Element: {}\", element);\n}\n",[187,1478,1479,1484,1498,1502,1516,1526,1539,1543,1547,1552,1590,1594,1608,1620],{"__ignoreMap":185},[190,1480,1481],{"class":192,"line":193},[190,1482,1483],{"class":368},"// While loops\n",[190,1485,1486,1488,1490,1492,1494,1496],{"class":192,"line":319},[190,1487,1222],{"class":1221},[190,1489,1351],{"class":1221},[190,1491,1354],{"class":797},[190,1493,1228],{"class":1221},[190,1495,1359],{"class":204},[190,1497,1313],{"class":797},[190,1499,1500],{"class":192,"line":326},[190,1501,323],{"emptyLinePlaceholder":322},[190,1503,1504,1507,1509,1512,1514],{"class":192,"line":335},[190,1505,1506],{"class":1221},"while",[190,1508,1354],{"class":797},[190,1510,1511],{"class":1221},"\u003C",[190,1513,1403],{"class":204},[190,1515,1373],{"class":797},[190,1517,1518,1520,1522,1524],{"class":192,"line":340},[190,1519,1378],{"class":797},[190,1521,1381],{"class":1221},[190,1523,1384],{"class":204},[190,1525,1313],{"class":797},[190,1527,1528,1531,1533,1536],{"class":192,"line":658},[190,1529,1530],{"class":196},"    println!",[190,1532,1201],{"class":797},[190,1534,1535],{"class":200},"\"Count: {}\"",[190,1537,1538],{"class":797},", count);\n",[190,1540,1541],{"class":192,"line":665},[190,1542,1422],{"class":797},[190,1544,1545],{"class":192,"line":674},[190,1546,323],{"emptyLinePlaceholder":322},[190,1548,1549],{"class":192,"line":855},[190,1550,1551],{"class":368},"// For loops\n",[190,1553,1554,1556,1559,1561,1564,1567,1569,1572,1574,1577,1579,1582,1584,1587],{"class":192,"line":863},[190,1555,1222],{"class":1221},[190,1557,1558],{"class":797}," a ",[190,1560,1228],{"class":1221},[190,1562,1563],{"class":797}," [",[190,1565,1566],{"class":204},"10",[190,1568,767],{"class":797},[190,1570,1571],{"class":204},"2",[190,1573,767],{"class":797},[190,1575,1576],{"class":204},"3",[190,1578,767],{"class":797},[190,1580,1581],{"class":204},"4",[190,1583,767],{"class":797},[190,1585,1586],{"class":204},"5",[190,1588,1589],{"class":797},"];\n",[190,1591,1592],{"class":192,"line":872},[190,1593,323],{"emptyLinePlaceholder":322},[190,1595,1596,1599,1602,1605],{"class":192,"line":880},[190,1597,1598],{"class":1221},"for",[190,1600,1601],{"class":797}," element ",[190,1603,1604],{"class":1221},"in",[190,1606,1607],{"class":797}," a {\n",[190,1609,1610,1612,1614,1617],{"class":192,"line":888},[190,1611,1530],{"class":196},[190,1613,1201],{"class":797},[190,1615,1616],{"class":200},"\"Element: {}\"",[190,1618,1619],{"class":797},", element);\n",[190,1621,1622],{"class":192,"line":896},[190,1623,1422],{"class":797},[12,1625,1626,1627,1106,1630,154],{},"There is more to learn with loops and conditions: Iterate over arrays, lists, maps, slices. Practice with writing comments for ",[187,1628,1629],{},"// Maps and sets",[187,1631,1632],{},"// Vectors and strings",[12,1634,1635],{},[486,1636],{"alt":1637,"src":1638},"Vectors, strings","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398633/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_flow_control_vectors_strings.png",[180,1640,1642],{"className":1189,"code":1641,"language":1191,"meta":185,"style":185},"\n  // Maps and sets\n  let mut scores = HashMap::new();\n\n  scores.insert(String::from(\"Blue\"), 10);\n  scores.insert(String::from(\"Yellow\"), 50);\n\n  for (key, value ) in &scores {\n      println!(\"{}: {}\", key, value);\n  }\n\n  // Vectors and strings\n  let mut v = Vec::new();\n\n  v.push(1);\n  v.push(2);\n\n  for element in &v {\n      println!(\"Element: {}\", element);\n  }\n\n",[187,1643,1644,1648,1653,1676,1680,1713,1741,1745,1761,1774,1779,1783,1788,1807,1811,1828,1842,1846,1859,1869],{"__ignoreMap":185},[190,1645,1646],{"class":192,"line":193},[190,1647,323],{"emptyLinePlaceholder":322},[190,1649,1650],{"class":192,"line":319},[190,1651,1652],{"class":368},"  // Maps and sets\n",[190,1654,1655,1657,1659,1662,1664,1667,1670,1673],{"class":192,"line":326},[190,1656,1302],{"class":1221},[190,1658,1351],{"class":1221},[190,1660,1661],{"class":797}," scores ",[190,1663,1228],{"class":1221},[190,1665,1666],{"class":196}," HashMap",[190,1668,1669],{"class":1221},"::",[190,1671,1672],{"class":196},"new",[190,1674,1675],{"class":797},"();\n",[190,1677,1678],{"class":192,"line":335},[190,1679,323],{"emptyLinePlaceholder":322},[190,1681,1682,1685,1687,1690,1692,1695,1697,1700,1702,1705,1708,1710],{"class":192,"line":340},[190,1683,1684],{"class":797},"  scores",[190,1686,154],{"class":1221},[190,1688,1689],{"class":196},"insert",[190,1691,1201],{"class":797},[190,1693,1694],{"class":196},"String",[190,1696,1669],{"class":1221},[190,1698,1699],{"class":196},"from",[190,1701,1201],{"class":797},[190,1703,1704],{"class":200},"\"Blue\"",[190,1706,1707],{"class":797},"), ",[190,1709,1566],{"class":204},[190,1711,1712],{"class":797},");\n",[190,1714,1715,1717,1719,1721,1723,1725,1727,1729,1731,1734,1736,1739],{"class":192,"line":658},[190,1716,1684],{"class":797},[190,1718,154],{"class":1221},[190,1720,1689],{"class":196},[190,1722,1201],{"class":797},[190,1724,1694],{"class":196},[190,1726,1669],{"class":1221},[190,1728,1699],{"class":196},[190,1730,1201],{"class":797},[190,1732,1733],{"class":200},"\"Yellow\"",[190,1735,1707],{"class":797},[190,1737,1738],{"class":204},"50",[190,1740,1712],{"class":797},[190,1742,1743],{"class":192,"line":665},[190,1744,323],{"emptyLinePlaceholder":322},[190,1746,1747,1750,1753,1755,1758],{"class":192,"line":674},[190,1748,1749],{"class":1221},"  for",[190,1751,1752],{"class":797}," (key, value ) ",[190,1754,1604],{"class":1221},[190,1756,1757],{"class":1221}," &",[190,1759,1760],{"class":797},"scores {\n",[190,1762,1763,1766,1768,1771],{"class":192,"line":855},[190,1764,1765],{"class":196},"      println!",[190,1767,1201],{"class":797},[190,1769,1770],{"class":200},"\"{}: {}\"",[190,1772,1773],{"class":797},", key, value);\n",[190,1775,1776],{"class":192,"line":863},[190,1777,1778],{"class":797},"  }\n",[190,1780,1781],{"class":192,"line":872},[190,1782,323],{"emptyLinePlaceholder":322},[190,1784,1785],{"class":192,"line":880},[190,1786,1787],{"class":368},"  // Vectors and strings\n",[190,1789,1790,1792,1794,1796,1798,1801,1803,1805],{"class":192,"line":888},[190,1791,1302],{"class":1221},[190,1793,1351],{"class":1221},[190,1795,1305],{"class":797},[190,1797,1228],{"class":1221},[190,1799,1800],{"class":196}," Vec",[190,1802,1669],{"class":1221},[190,1804,1672],{"class":196},[190,1806,1675],{"class":797},[190,1808,1809],{"class":192,"line":896},[190,1810,323],{"emptyLinePlaceholder":322},[190,1812,1813,1816,1818,1821,1823,1826],{"class":192,"line":904},[190,1814,1815],{"class":797},"  v",[190,1817,154],{"class":1221},[190,1819,1820],{"class":196},"push",[190,1822,1201],{"class":797},[190,1824,1825],{"class":204},"1",[190,1827,1712],{"class":797},[190,1829,1830,1832,1834,1836,1838,1840],{"class":192,"line":915},[190,1831,1815],{"class":797},[190,1833,154],{"class":1221},[190,1835,1820],{"class":196},[190,1837,1201],{"class":797},[190,1839,1571],{"class":204},[190,1841,1712],{"class":797},[190,1843,1844],{"class":192,"line":920},[190,1845,323],{"emptyLinePlaceholder":322},[190,1847,1848,1850,1852,1854,1856],{"class":192,"line":926},[190,1849,1749],{"class":1221},[190,1851,1601],{"class":797},[190,1853,1604],{"class":1221},[190,1855,1757],{"class":1221},[190,1857,1858],{"class":797},"v {\n",[190,1860,1861,1863,1865,1867],{"class":192,"line":934},[190,1862,1765],{"class":196},[190,1864,1201],{"class":797},[190,1866,1616],{"class":200},[190,1868,1619],{"class":797},[190,1870,1872],{"class":192,"line":1871},20,[190,1873,1778],{"class":797},[12,1875,1876,1877,1880,1881,1884],{},"This snippet will fail because the ",[187,1878,1879],{},"HashMap"," type needs to be imported from ",[187,1882,1883],{},"std::collections::HashMap",". Add the following line on top before the main function definition:",[180,1886,1888],{"className":1189,"code":1887,"language":1191,"meta":185,"style":185},"use std::collections::HashMap;\n",[187,1889,1890],{"__ignoreMap":185},[190,1891,1892,1895,1898,1900,1903,1905,1907],{"class":192,"line":193},[190,1893,1894],{"class":1221},"use",[190,1896,1897],{"class":196}," std",[190,1899,1669],{"class":1221},[190,1901,1902],{"class":196},"collections",[190,1904,1669],{"class":1221},[190,1906,1879],{"class":196},[190,1908,1313],{"class":797},[287,1910,1911],{"start":319},[19,1912,1913,1914,154],{},"Build and run the code with ",[187,1915,1446],{},[12,1917,1918,1919,154],{},"An example solution is provided ",[22,1920,1124],{"href":1921,"rel":1922},"https://gitlab.com/gitlab-da/use-cases/ai/learn-with-ai/learn-rust-ai/-/blob/main/solutions/flow_control.rs",[],[12,1924,1925,1929],{},[1926,1927,1928],"strong",{},"Async exercise",":",[287,1931,1932,1935],{},[19,1933,1934],{},"Modify the input values for the different data types, and build and run the code again.",[19,1936,1937],{},"Add a condition into the loops that print the items only when a specific condition is met (for example, the number is odd or even).",[167,1939,103],{"id":1940},"functions",[12,1942,1943,1947],{},[22,1944,103],{"href":1945,"rel":1946},"https://doc.rust-lang.org/rust-by-example/fn.html",[]," help increase code readability and testability with unit tests. Practice creating functions with the following steps:",[287,1949,1950],{},[19,1951,1952,1953,1106,1956,1959],{},"Two functions ",[187,1954,1955],{},"isEven",[187,1957,1958],{},"isOdd"," to evaluate whether a number is even or odd.",[180,1961,1963],{"className":1189,"code":1962,"language":1191,"meta":185,"style":185},"fn isEven(x: i32) -> bool {\n    x % 2 == 0\n}\n\nfn isOdd(x: i32) -> bool {\n    x % 2 != 0\n}\n",[187,1964,1965,1992,2009,2013,2017,2038,2051],{"__ignoreMap":185},[190,1966,1967,1970,1973,1976,1978,1981,1984,1987,1990],{"class":192,"line":193},[190,1968,1969],{"class":1221},"fn",[190,1971,1972],{"class":196}," isEven",[190,1974,1975],{"class":797},"(x",[190,1977,1929],{"class":1221},[190,1979,1980],{"class":196}," i32",[190,1982,1983],{"class":797},") ",[190,1985,1986],{"class":1221},"->",[190,1988,1989],{"class":196}," bool",[190,1991,1373],{"class":797},[190,1993,1994,1997,2000,2003,2006],{"class":192,"line":319},[190,1995,1996],{"class":797},"    x ",[190,1998,1999],{"class":1221},"%",[190,2001,2002],{"class":204}," 2",[190,2004,2005],{"class":1221}," ==",[190,2007,2008],{"class":204}," 0\n",[190,2010,2011],{"class":192,"line":326},[190,2012,1422],{"class":797},[190,2014,2015],{"class":192,"line":335},[190,2016,323],{"emptyLinePlaceholder":322},[190,2018,2019,2021,2024,2026,2028,2030,2032,2034,2036],{"class":192,"line":340},[190,2020,1969],{"class":1221},[190,2022,2023],{"class":196}," isOdd",[190,2025,1975],{"class":797},[190,2027,1929],{"class":1221},[190,2029,1980],{"class":196},[190,2031,1983],{"class":797},[190,2033,1986],{"class":1221},[190,2035,1989],{"class":196},[190,2037,1373],{"class":797},[190,2039,2040,2042,2044,2046,2049],{"class":192,"line":658},[190,2041,1996],{"class":797},[190,2043,1999],{"class":1221},[190,2045,2002],{"class":204},[190,2047,2048],{"class":1221}," !=",[190,2050,2008],{"class":204},[190,2052,2053],{"class":192,"line":665},[190,2054,1422],{"class":797},[287,2056,2057],{"start":319},[19,2058,2059,2062],{},[187,2060,2061],{},"isPrime"," function to check whether a given integer value is a prime number.",[180,2064,2066],{"className":1189,"code":2065,"language":1191,"meta":185,"style":185},"fn isPrime(x: i32) -> bool {\n    let mut i = 2;\n\n    while i * i \u003C= x {\n        if x % i == 0 {\n            return false;\n        } else {\n            i += 1;\n        }\n    }\n\n    return true\n}\n",[187,2067,2068,2089,2105,2109,2127,2145,2155,2165,2176,2181,2185,2189,2197],{"__ignoreMap":185},[190,2069,2070,2072,2075,2077,2079,2081,2083,2085,2087],{"class":192,"line":193},[190,2071,1969],{"class":1221},[190,2073,2074],{"class":196}," isPrime",[190,2076,1975],{"class":797},[190,2078,1929],{"class":1221},[190,2080,1980],{"class":196},[190,2082,1983],{"class":797},[190,2084,1986],{"class":1221},[190,2086,1989],{"class":196},[190,2088,1373],{"class":797},[190,2090,2091,2094,2096,2099,2101,2103],{"class":192,"line":319},[190,2092,2093],{"class":1221},"    let",[190,2095,1351],{"class":1221},[190,2097,2098],{"class":797}," i ",[190,2100,1228],{"class":1221},[190,2102,2002],{"class":204},[190,2104,1313],{"class":797},[190,2106,2107],{"class":192,"line":326},[190,2108,323],{"emptyLinePlaceholder":322},[190,2110,2111,2114,2116,2119,2121,2124],{"class":192,"line":335},[190,2112,2113],{"class":1221},"    while",[190,2115,2098],{"class":797},[190,2117,2118],{"class":1221},"*",[190,2120,2098],{"class":797},[190,2122,2123],{"class":1221},"\u003C=",[190,2125,2126],{"class":797}," x {\n",[190,2128,2129,2132,2135,2137,2139,2141,2143],{"class":192,"line":340},[190,2130,2131],{"class":1221},"        if",[190,2133,2134],{"class":797}," x ",[190,2136,1999],{"class":1221},[190,2138,2098],{"class":797},[190,2140,1400],{"class":1221},[190,2142,1359],{"class":204},[190,2144,1373],{"class":797},[190,2146,2147,2150,2153],{"class":192,"line":658},[190,2148,2149],{"class":1221},"            return",[190,2151,2152],{"class":204}," false",[190,2154,1313],{"class":797},[190,2156,2157,2160,2163],{"class":192,"line":665},[190,2158,2159],{"class":797},"        } ",[190,2161,2162],{"class":1221},"else",[190,2164,1373],{"class":797},[190,2166,2167,2170,2172,2174],{"class":192,"line":674},[190,2168,2169],{"class":797},"            i ",[190,2171,1381],{"class":1221},[190,2173,1384],{"class":204},[190,2175,1313],{"class":797},[190,2177,2178],{"class":192,"line":855},[190,2179,2180],{"class":797},"        }\n",[190,2182,2183],{"class":192,"line":863},[190,2184,1417],{"class":797},[190,2186,2187],{"class":192,"line":872},[190,2188,323],{"emptyLinePlaceholder":322},[190,2190,2191,2194],{"class":192,"line":880},[190,2192,2193],{"class":1221},"    return",[190,2195,2196],{"class":204}," true\n",[190,2198,2199],{"class":192,"line":888},[190,2200,1422],{"class":797},[287,2202,2203],{"start":326},[19,2204,2205],{},"Create an array of integer values, loop over it, and call the functions. Let GitLab Code Suggestions guide you with the implementation by starting to type the if conditions followed by the function name.",[180,2207,2209],{"className":1189,"code":2208,"language":1191,"meta":185,"style":185},"\n  // Functions\n  let mut integers = vec![1, 2, 3, 4, 5];\n\n  for i in integers.iter() {\n\n      if (isEven(i)) {\n          println!(\"{} is even\", i);\n      }\n\n      if (isOdd(i)) {\n          println!(\"{} is odd\", i);\n      }\n\n      if (isPrime(i)) {\n          println!(\"{} is prime\", i);\n      }\n\n      println!(\"{}\", i);\n  }\n\n",[187,2210,2211,2215,2220,2257,2261,2280,2284,2297,2310,2315,2319,2329,2340,2344,2348,2358,2369,2373,2377,2388],{"__ignoreMap":185},[190,2212,2213],{"class":192,"line":193},[190,2214,323],{"emptyLinePlaceholder":322},[190,2216,2217],{"class":192,"line":319},[190,2218,2219],{"class":368},"  // Functions\n",[190,2221,2222,2224,2226,2229,2231,2234,2237,2239,2241,2243,2245,2247,2249,2251,2253,2255],{"class":192,"line":326},[190,2223,1302],{"class":1221},[190,2225,1351],{"class":1221},[190,2227,2228],{"class":797}," integers ",[190,2230,1228],{"class":1221},[190,2232,2233],{"class":196}," vec!",[190,2235,2236],{"class":797},"[",[190,2238,1825],{"class":204},[190,2240,767],{"class":797},[190,2242,1571],{"class":204},[190,2244,767],{"class":797},[190,2246,1576],{"class":204},[190,2248,767],{"class":797},[190,2250,1581],{"class":204},[190,2252,767],{"class":797},[190,2254,1586],{"class":204},[190,2256,1589],{"class":797},[190,2258,2259],{"class":192,"line":335},[190,2260,323],{"emptyLinePlaceholder":322},[190,2262,2263,2265,2267,2269,2272,2274,2277],{"class":192,"line":340},[190,2264,1749],{"class":1221},[190,2266,2098],{"class":797},[190,2268,1604],{"class":1221},[190,2270,2271],{"class":797}," integers",[190,2273,154],{"class":1221},[190,2275,2276],{"class":196},"iter",[190,2278,2279],{"class":797},"() {\n",[190,2281,2282],{"class":192,"line":658},[190,2283,323],{"emptyLinePlaceholder":322},[190,2285,2286,2289,2292,2294],{"class":192,"line":665},[190,2287,2288],{"class":1221},"      if",[190,2290,2291],{"class":797}," (",[190,2293,1955],{"class":196},[190,2295,2296],{"class":797},"(i)) {\n",[190,2298,2299,2302,2304,2307],{"class":192,"line":674},[190,2300,2301],{"class":196},"          println!",[190,2303,1201],{"class":797},[190,2305,2306],{"class":200},"\"{} is even\"",[190,2308,2309],{"class":797},", i);\n",[190,2311,2312],{"class":192,"line":855},[190,2313,2314],{"class":797},"      }\n",[190,2316,2317],{"class":192,"line":863},[190,2318,323],{"emptyLinePlaceholder":322},[190,2320,2321,2323,2325,2327],{"class":192,"line":872},[190,2322,2288],{"class":1221},[190,2324,2291],{"class":797},[190,2326,1958],{"class":196},[190,2328,2296],{"class":797},[190,2330,2331,2333,2335,2338],{"class":192,"line":880},[190,2332,2301],{"class":196},[190,2334,1201],{"class":797},[190,2336,2337],{"class":200},"\"{} is odd\"",[190,2339,2309],{"class":797},[190,2341,2342],{"class":192,"line":888},[190,2343,2314],{"class":797},[190,2345,2346],{"class":192,"line":896},[190,2347,323],{"emptyLinePlaceholder":322},[190,2349,2350,2352,2354,2356],{"class":192,"line":904},[190,2351,2288],{"class":1221},[190,2353,2291],{"class":797},[190,2355,2061],{"class":196},[190,2357,2296],{"class":797},[190,2359,2360,2362,2364,2367],{"class":192,"line":915},[190,2361,2301],{"class":196},[190,2363,1201],{"class":797},[190,2365,2366],{"class":200},"\"{} is prime\"",[190,2368,2309],{"class":797},[190,2370,2371],{"class":192,"line":920},[190,2372,2314],{"class":797},[190,2374,2375],{"class":192,"line":926},[190,2376,323],{"emptyLinePlaceholder":322},[190,2378,2379,2381,2383,2386],{"class":192,"line":934},[190,2380,1765],{"class":196},[190,2382,1201],{"class":797},[190,2384,2385],{"class":200},"\"{}\"",[190,2387,2309],{"class":797},[190,2389,2390],{"class":192,"line":1871},[190,2391,1778],{"class":797},[12,2393,2394],{},"Note that passing a reference value to a function may result in an error from the Rust compiler. Follow the suggestions and build the code again.",[180,2396,2398],{"className":182,"code":2397,"language":184,"meta":185,"style":185},"$ cargo build && cargo run\n\nerror[E0308]: mismatched types\n   --> src/main.rs:112:21\n    |\n112 |         if (isPrime(i)) {\n    |             ------- ^ expected `i32`, found `&{integer}`\n    |             |\n    |             arguments to this function are incorrect\n    |\nnote: function defined here\n   --> src/main.rs:136:4\n    |\n136 | fn isPrime(x: i32) -> bool {\n    |    ^^^^^^^ ------\nhelp: consider dereferencing the borrow\n    |\n112 |         if (isPrime(*i)) {\n    |                     +\n\n",[187,2399,2400,2418,2422,2433,2444,2449,2468,2500,2507,2517,2521,2529,2536,2540,2565,2575,2583,2587,2602],{"__ignoreMap":185},[190,2401,2402,2405,2408,2411,2414,2416],{"class":192,"line":193},[190,2403,2404],{"class":196},"$",[190,2406,2407],{"class":200}," cargo",[190,2409,2410],{"class":200}," build",[190,2412,2413],{"class":797}," && ",[190,2415,448],{"class":196},[190,2417,708],{"class":200},[190,2419,2420],{"class":192,"line":319},[190,2421,323],{"emptyLinePlaceholder":322},[190,2423,2424,2427,2430],{"class":192,"line":326},[190,2425,2426],{"class":196},"error[E0308]:",[190,2428,2429],{"class":200}," mismatched",[190,2431,2432],{"class":200}," types\n",[190,2434,2435,2438,2441],{"class":192,"line":335},[190,2436,2437],{"class":196},"   --",[190,2439,2440],{"class":797},"> ",[190,2442,2443],{"class":200},"src/main.rs:112:21\n",[190,2445,2446],{"class":192,"line":340},[190,2447,2448],{"class":1221},"    |\n",[190,2450,2451,2454,2457,2460,2462,2465],{"class":192,"line":658},[190,2452,2453],{"class":196},"112",[190,2455,2456],{"class":1221}," |",[190,2458,2459],{"class":1221},"         if",[190,2461,2291],{"class":797},[190,2463,2464],{"class":196},"isPrime(i",[190,2466,2467],{"class":797},")) {\n",[190,2469,2470,2473,2476,2479,2482,2485,2488,2491,2494,2497],{"class":192,"line":665},[190,2471,2472],{"class":1221},"    |",[190,2474,2475],{"class":196},"             -------",[190,2477,2478],{"class":200}," ^",[190,2480,2481],{"class":200}," expected",[190,2483,2484],{"class":200}," `",[190,2486,2487],{"class":196},"i32",[190,2489,2490],{"class":200},"`",[190,2492,2493],{"class":196},",",[190,2495,2496],{"class":200}," found",[190,2498,2499],{"class":200}," `&{integer}`\n",[190,2501,2502,2504],{"class":192,"line":674},[190,2503,2472],{"class":1221},[190,2505,2506],{"class":1221},"             |\n",[190,2508,2509,2511,2514],{"class":192,"line":855},[190,2510,2472],{"class":1221},[190,2512,2513],{"class":196},"             arguments",[190,2515,2516],{"class":200}," to this function are incorrect\n",[190,2518,2519],{"class":192,"line":863},[190,2520,2448],{"class":1221},[190,2522,2523,2526],{"class":192,"line":872},[190,2524,2525],{"class":196},"note:",[190,2527,2528],{"class":200}," function defined here\n",[190,2530,2531,2533],{"class":192,"line":880},[190,2532,2437],{"class":196},[190,2534,2535],{"class":200},"> src/main.rs:136:4\n",[190,2537,2538],{"class":192,"line":888},[190,2539,2448],{"class":1221},[190,2541,2542,2545,2547,2550,2553,2556,2559,2562],{"class":192,"line":896},[190,2543,2544],{"class":196},"136",[190,2546,2456],{"class":1221},[190,2548,2549],{"class":196}," fn",[190,2551,2552],{"class":200}," isPrime(",[190,2554,2555],{"class":196},"x:",[190,2557,2558],{"class":200}," i32) -",[190,2560,2561],{"class":1221},">",[190,2563,2564],{"class":200}," bool {\n",[190,2566,2567,2569,2572],{"class":192,"line":904},[190,2568,2472],{"class":1221},[190,2570,2571],{"class":196},"    ^^^^^^^",[190,2573,2574],{"class":204}," ------\n",[190,2576,2577,2580],{"class":192,"line":915},[190,2578,2579],{"class":196},"help:",[190,2581,2582],{"class":200}," consider dereferencing the borrow\n",[190,2584,2585],{"class":192,"line":920},[190,2586,2448],{"class":1221},[190,2588,2589,2591,2593,2595,2597,2600],{"class":192,"line":926},[190,2590,2453],{"class":196},[190,2592,2456],{"class":1221},[190,2594,2459],{"class":1221},[190,2596,2291],{"class":200},[190,2598,2599],{"class":196},"isPrime(*i",[190,2601,2467],{"class":200},[190,2603,2604,2606],{"class":192,"line":934},[190,2605,2472],{"class":1221},[190,2607,2608],{"class":196},"                     +\n",[12,2610,1918,2611,154],{},[22,2612,1124],{"href":2613,"rel":2614},"https://gitlab.com/gitlab-da/use-cases/ai/learn-with-ai/learn-rust-ai/-/blob/main/solutions/functions.rs",[],[12,2616,2617,2619,2620,2623],{},[1926,2618,1928],{},": Create a function ",[187,2621,2622],{},"containsString"," and test it with an array of string values, and a string to search for, in a loop. The screenshot shows a potential implementation.",[12,2625,2626],{},[486,2627],{"alt":2628,"src":2629},"containsString function, and vector with string elements to test, suggesting its usage in the main function","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398633/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_function_implemented_then_suggested_in_main.png",[167,2631,109],{"id":2632},"testing",[12,2634,2635,2636,2640,2641,767,2643,2645,2646,2648,2649,2652,2653,2656,2657,154],{},"While learning programming, adopt ",[22,2637,2632],{"href":2638,"rel":2639},"https://doc.rust-lang.org/rust-by-example/testing.html",[]," into your process. This can be unit tests for functions, documentation testing, and integration testing. Practice with testing the previously created functions ",[187,2642,1955],{},[187,2644,1958],{},", and ",[187,2647,2061],{},". Starty by typing ",[187,2650,2651],{},"mod tests {"," followed by a new line with ",[187,2654,2655],{},"use super::*"," to implement the example from the ",[22,2658,2661],{"href":2659,"rel":2660},"https://doc.rust-lang.org/rust-by-example/testing/unit_testing.html",[],"Rust documentation for unit tests",[180,2663,2665],{"className":1189,"code":2664,"language":1191,"meta":185,"style":185},"mod tests {\n    use super::*;\n\n    #[test]\n    fn test_is_even() {\n        assert!(isEven(2));\n        assert!(!isEven(3));\n    }\n\n    #[test]\n    fn test_is_odd() {\n        assert!(!isOdd(2));\n        assert!(isOdd(3));\n    }\n\n    #[test]\n    fn test_is_prime() {\n        assert!(isPrime(2));\n        assert!(!isPrime(3));\n    }\n}\n",[187,2666,2667,2677,2690,2694,2699,2709,2725,2742,2746,2750,2754,2763,2779,2793,2797,2801,2805,2814,2828,2844,2848],{"__ignoreMap":185},[190,2668,2669,2672,2675],{"class":192,"line":193},[190,2670,2671],{"class":1221},"mod",[190,2673,2674],{"class":196}," tests",[190,2676,1373],{"class":797},[190,2678,2679,2682,2685,2688],{"class":192,"line":319},[190,2680,2681],{"class":1221},"    use",[190,2683,2684],{"class":204}," super",[190,2686,2687],{"class":1221},"::*",[190,2689,1313],{"class":797},[190,2691,2692],{"class":192,"line":326},[190,2693,323],{"emptyLinePlaceholder":322},[190,2695,2696],{"class":192,"line":335},[190,2697,2698],{"class":797},"    #[test]\n",[190,2700,2701,2704,2707],{"class":192,"line":340},[190,2702,2703],{"class":1221},"    fn",[190,2705,2706],{"class":196}," test_is_even",[190,2708,2279],{"class":797},[190,2710,2711,2714,2716,2718,2720,2722],{"class":192,"line":658},[190,2712,2713],{"class":196},"        assert!",[190,2715,1201],{"class":797},[190,2717,1955],{"class":196},[190,2719,1201],{"class":797},[190,2721,1571],{"class":204},[190,2723,2724],{"class":797},"));\n",[190,2726,2727,2729,2731,2734,2736,2738,2740],{"class":192,"line":665},[190,2728,2713],{"class":196},[190,2730,1201],{"class":797},[190,2732,2733],{"class":1221},"!",[190,2735,1955],{"class":196},[190,2737,1201],{"class":797},[190,2739,1576],{"class":204},[190,2741,2724],{"class":797},[190,2743,2744],{"class":192,"line":674},[190,2745,1417],{"class":797},[190,2747,2748],{"class":192,"line":855},[190,2749,323],{"emptyLinePlaceholder":322},[190,2751,2752],{"class":192,"line":863},[190,2753,2698],{"class":797},[190,2755,2756,2758,2761],{"class":192,"line":872},[190,2757,2703],{"class":1221},[190,2759,2760],{"class":196}," test_is_odd",[190,2762,2279],{"class":797},[190,2764,2765,2767,2769,2771,2773,2775,2777],{"class":192,"line":880},[190,2766,2713],{"class":196},[190,2768,1201],{"class":797},[190,2770,2733],{"class":1221},[190,2772,1958],{"class":196},[190,2774,1201],{"class":797},[190,2776,1571],{"class":204},[190,2778,2724],{"class":797},[190,2780,2781,2783,2785,2787,2789,2791],{"class":192,"line":888},[190,2782,2713],{"class":196},[190,2784,1201],{"class":797},[190,2786,1958],{"class":196},[190,2788,1201],{"class":797},[190,2790,1576],{"class":204},[190,2792,2724],{"class":797},[190,2794,2795],{"class":192,"line":896},[190,2796,1417],{"class":797},[190,2798,2799],{"class":192,"line":904},[190,2800,323],{"emptyLinePlaceholder":322},[190,2802,2803],{"class":192,"line":915},[190,2804,2698],{"class":797},[190,2806,2807,2809,2812],{"class":192,"line":920},[190,2808,2703],{"class":1221},[190,2810,2811],{"class":196}," test_is_prime",[190,2813,2279],{"class":797},[190,2815,2816,2818,2820,2822,2824,2826],{"class":192,"line":926},[190,2817,2713],{"class":196},[190,2819,1201],{"class":797},[190,2821,2061],{"class":196},[190,2823,1201],{"class":797},[190,2825,1571],{"class":204},[190,2827,2724],{"class":797},[190,2829,2830,2832,2834,2836,2838,2840,2842],{"class":192,"line":934},[190,2831,2713],{"class":196},[190,2833,1201],{"class":797},[190,2835,2733],{"class":1221},[190,2837,2061],{"class":196},[190,2839,1201],{"class":797},[190,2841,1576],{"class":204},[190,2843,2724],{"class":797},[190,2845,2846],{"class":192,"line":1871},[190,2847,1417],{"class":797},[190,2849,2851],{"class":192,"line":2850},21,[190,2852,1422],{"class":797},[12,2854,2855,2856,2859],{},"Run ",[187,2857,2858],{},"cargo test"," to run the unit tests. Modify the test values to experiment with the results.",[180,2861,2863],{"className":182,"code":2862,"language":184,"meta":185,"style":185},"cargo test\n",[187,2864,2865],{"__ignoreMap":185},[190,2866,2867,2869],{"class":192,"line":193},[190,2868,448],{"class":196},[190,2870,2871],{"class":200}," test\n",[12,2873,2874],{},[486,2875],{"alt":2876,"src":2877},"Function unit tests, cargo test output in the VS Code terminal","https://res.cloudinary.com/about-gitlab-com/image/upload/v1782398633/blog/Content%20Images/learn-rust-with-ai-code-suggestions-getting-started/learn_rust_ai_gitlab_code_suggestions_function_unit_tests_terminal_run.png",[12,2879,2880,2881,2884],{},"Create unit tests that fail, and commit and push the changes to GitLab. The CI/CD pipelines will fail in this simulated breakage. The example above needs a fix for the ",[187,2882,2883],{},"test_is_prime"," test. Commit and push the change to verify that the pipeline passes again.",[180,2886,2890],{"className":2887,"code":2888,"language":2889,"meta":185,"style":185},"language-diff shiki shiki-themes github-light","-        assert!(!isPrime(3));\n+        assert!(!isPrime(4));\n","diff",[187,2891,2892,2898],{"__ignoreMap":185},[190,2893,2894],{"class":192,"line":193},[190,2895,2897],{"class":2896},"s9hmT","-        assert!(!isPrime(3));\n",[190,2899,2900],{"class":192,"line":319},[190,2901,2902],{"class":793},"+        assert!(!isPrime(4));\n",[131,2904,115],{"id":2905},"what-is-next",[12,2907,2908],{},"In an upcoming blog, we will look into advanced learning examples with asynchronous operations, services and external API communication in future blog posts. Until then, here are a few recommendations for practicing async.",[167,2910,123],{"id":2911},"async-learning-exercises",[16,2913,2914,2924,2932,2940],{},[19,2915,2916,2923],{},[22,2917,2920],{"href":2918,"rel":2919},"https://doc.rust-lang.org/rust-by-example/std_misc.html",[],[187,2921,2922],{},"std misc"," provides asynchronous operations with threads, channels and file I/O",[19,2925,2926,2927],{},"Book: ",[22,2928,2931],{"href":2929,"rel":2930},"https://pragprog.com/titles/hwrust/hands-on-rust/",[],"Hands-on Rust: Effective Learning through 2D Game Development and Play",[19,2933,2934,2935],{},"Tutorial: ",[22,2936,2939],{"href":2937,"rel":2938},"https://arewegameyet.rs/resources/tutorials/",[],"Are we game yet?",[19,2941,2942,2943],{},"Use case: ",[22,2944,2947],{"href":2945,"rel":2946},"https://rocket.rs/v0.5-rc/guide/quickstart/#running-examples",[],"Web server with rocket.rs",[12,2949,2950],{},"Here are a few more exercises and ideas for additional learning:",[287,2952,2953],{},[19,2954,2955,2956,2958],{},"The Rust compiler might have created warnings that need to be addressed. Follow the instructions from the ",[187,2957,1105],{}," commands and check the Git diff.",[180,2960,2962],{"className":182,"code":2961,"language":184,"meta":185,"style":185},"cargo fix --bin \"learn-rust-ai\"\n\ngit diff\n",[187,2963,2964,2977,2981],{"__ignoreMap":185},[190,2965,2966,2968,2971,2974],{"class":192,"line":193},[190,2967,448],{"class":196},[190,2969,2970],{"class":200}," fix",[190,2972,2973],{"class":204}," --bin",[190,2975,2976],{"class":200}," \"learn-rust-ai\"\n",[190,2978,2979],{"class":192,"line":319},[190,2980,323],{"emptyLinePlaceholder":322},[190,2982,2983,2985],{"class":192,"line":326},[190,2984,310],{"class":196},[190,2986,2987],{"class":200}," diff\n",[287,2989,2990,2998],{"start":319},[19,2991,2992,2997],{},[22,2993,2996],{"href":2994,"rel":2995},"https://doc.rust-lang.org/rust-by-example/error.html",[],"Error handling"," is required when failure is detected, and the caller should know. Some errors can be recovered from within the application, others require program termination.",[19,2999,755,3000,3008],{},[22,3001,3004,3007],{"href":3002,"rel":3003},"https://doc.rust-lang.org/rust-by-example/std.html",[],[187,3005,3006],{},"std"," library"," extends primitive types and makes programming more efficient.",[167,3010,129],{"id":3011},"share-your-feedback",[12,3013,3014,3015,3019],{},"Which programming language are you learning or considering learning? Start a new topic on our ",[22,3016,3018],{"href":3017},"/community/","community"," forum or Discord and share your experience.",[12,3021,3022,3023,3027,3028,154],{},"If you are using Code Suggestions Beta with ",[22,3024,3026],{"href":3025},"/gitlab-duo-agent-platform/","GitLab Duo"," already, please share your thoughts and feedback ",[22,3029,3032],{"href":3030,"rel":3031},"https://gitlab.com/gitlab-org/gitlab/-/issues/405152",[],"in this issue",[3034,3035,3036],"style",{},"html pre.shiki code .s7eDp, html code.shiki .s7eDp{--shiki-default:#6F42C1}html pre.shiki code .sYBdl, html code.shiki .sYBdl{--shiki-default:#032F62}html pre.shiki code .sYu0t, html code.shiki .sYu0t{--shiki-default:#005CC5}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 pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .shJU0, html code.shiki .shJU0{--shiki-default:#22863A}html pre.shiki code .sgsFI, html code.shiki .sgsFI{--shiki-default:#24292E}html pre.shiki code .sD7c4, html code.shiki .sD7c4{--shiki-default:#D73A49}html pre.shiki code .s9hmT, html code.shiki .s9hmT{--shiki-default:#B31D28}",{"title":185,"searchDepth":319,"depth":319,"links":3038},[3039,3043,3047,3048,3049,3056],{"id":133,"depth":319,"text":25,"children":3040},[3041,3042],{"id":169,"depth":326,"text":33},{"id":230,"depth":326,"text":39},{"id":246,"depth":319,"text":45,"children":3044},[3045,3046],{"id":285,"depth":326,"text":53},{"id":455,"depth":326,"text":59},{"id":580,"depth":319,"text":65},{"id":752,"depth":319,"text":71},{"id":1039,"depth":319,"text":77,"children":3050},[3051,3052,3053,3054,3055],{"id":1048,"depth":326,"text":85},{"id":1127,"depth":326,"text":91},{"id":1258,"depth":326,"text":97},{"id":1940,"depth":326,"text":103},{"id":2632,"depth":326,"text":109},{"id":2905,"depth":319,"text":115,"children":3057},[3058,3059],{"id":2911,"depth":326,"text":123},{"id":3011,"depth":326,"text":129},"ai","2023-08-10","Use this guided tutorial, along with GitLab Duo Code Suggestions, to learn a new programming language.","md",null,false,"https://res.cloudinary.com/about-gitlab-com/image/upload/v1749663918/Blog/Hero%20Images/aipower.jpg",{},"/en-us/blog/learning-rust-with-a-little-help-from-ai-code-suggestions-getting-started",{"title":5,"description":3062,"ogTitle":5,"ogDescription":3062,"noIndex":3065,"ogImage":3066,"ogUrl":3070,"ogSiteName":3071,"ogType":3072,"canonicalUrls":3070},"https://about.gitlab.com/blog/learning-rust-with-a-little-help-from-ai-code-suggestions-getting-started","https://about.gitlab.com","article","learning-rust-with-a-little-help-from-ai-code-suggestions-getting-started","en-us/blog/learning-rust-with-a-little-help-from-ai-code-suggestions-getting-started",[3076,3077,3078,3079,3080],"DevSecOps","careers","tutorial","workflow","AI","BlogPost","c79gCWlstOieluDrjaBFgij4yomSEjiokKcWc5zeED4",{"logo":3084,"freeTrial":3089,"sales":3094,"login":3099,"items":3104,"search":3428,"minimal":3459,"duo":3478,"switchNav":3487,"pricingDeployment":3498},{"config":3085},{"href":3086,"dataGaName":3087,"dataGaLocation":3088},"/","gitlab logo","header",{"text":3090,"config":3091},"Get free trial",{"href":3092,"dataGaName":3093,"dataGaLocation":3088},"https://gitlab.com/-/trial_registrations/new?glm_source=about.gitlab.com&glm_content=default-saas-trial/","free trial",{"text":3095,"config":3096},"Request a demo",{"href":3097,"dataGaName":3098,"dataGaLocation":3088},"/sales/?contact-topic=request-demo","sales",{"text":3100,"config":3101},"Sign in",{"href":3102,"dataGaName":3103,"dataGaLocation":3088},"https://gitlab.com/users/sign_in/","sign in",[3105,3133,3233,3238,3350,3406],{"text":3106,"config":3107,"menu":3109},"Platform",{"dataNavLevelOne":3108},"platform",{"type":3110,"columns":3111},"cards",[3112,3118,3125],{"title":3106,"description":3113,"link":3114},"The intelligent orchestration platform for DevSecOps",{"text":3115,"config":3116},"Explore our Platform",{"href":3117,"dataGaName":3108,"dataGaLocation":3088},"/platform/",{"title":3119,"description":3120,"link":3121},"GitLab Duo Agent Platform","Agentic AI for the entire software lifecycle",{"text":3122,"config":3123},"Meet GitLab Duo",{"href":3025,"dataGaName":3124,"dataGaLocation":3088},"gitlab duo agent platform",{"title":3126,"description":3127,"link":3128},"Why GitLab","See the top reasons enterprises choose GitLab",{"text":3129,"config":3130},"Learn more",{"href":3131,"dataGaName":3132,"dataGaLocation":3088},"/why-gitlab/","why gitlab",{"text":3134,"left":322,"config":3135,"menu":3137},"Product",{"dataNavLevelOne":3136},"solutions",{"type":3138,"link":3139,"columns":3143,"feature":3212},"lists",{"text":3140,"config":3141},"View all Solutions",{"href":3142,"dataGaName":3136,"dataGaLocation":3088},"/solutions/",[3144,3168,3191],{"title":3145,"description":3146,"link":3147,"items":3152},"Automation","CI/CD and automation to accelerate deployment",{"config":3148},{"icon":3149,"href":3150,"dataGaName":3151,"dataGaLocation":3088},"AutomatedCodeAlt","/solutions/delivery-automation/","automated software delivery",[3153,3157,3160,3164],{"text":3154,"config":3155},"CI/CD",{"href":3156,"dataGaLocation":3088,"dataGaName":3154},"/solutions/continuous-integration/",{"text":3119,"config":3158},{"href":3025,"dataGaLocation":3088,"dataGaName":3159},"gitlab duo agent platform - product menu",{"text":3161,"config":3162},"Source Code Management",{"href":3163,"dataGaLocation":3088,"dataGaName":3161},"/solutions/source-code-management/",{"text":3165,"config":3166},"Automated Software Delivery",{"href":3150,"dataGaLocation":3088,"dataGaName":3167},"Automated software delivery",{"title":3169,"description":3170,"link":3171,"items":3176},"Security","Deliver code faster without compromising security",{"config":3172},{"href":3173,"dataGaName":3174,"dataGaLocation":3088,"icon":3175},"/solutions/application-security-testing/","security and compliance","ShieldCheckLight",[3177,3181,3186],{"text":3178,"config":3179},"Application Security Testing",{"href":3173,"dataGaName":3180,"dataGaLocation":3088},"Application security testing",{"text":3182,"config":3183},"Software Supply Chain Security",{"href":3184,"dataGaLocation":3088,"dataGaName":3185},"/solutions/supply-chain/","Software supply chain security",{"text":3187,"config":3188},"Software Compliance",{"href":3189,"dataGaName":3190,"dataGaLocation":3088},"/solutions/software-compliance/","software compliance",{"title":3192,"link":3193,"items":3198},"Measurement",{"config":3194},{"icon":3195,"href":3196,"dataGaName":3197,"dataGaLocation":3088},"DigitalTransformation","/solutions/visibility-measurement/","visibility and measurement",[3199,3203,3207],{"text":3200,"config":3201},"Visibility & Measurement",{"href":3196,"dataGaLocation":3088,"dataGaName":3202},"Visibility and Measurement",{"text":3204,"config":3205},"Value Stream Management",{"href":3206,"dataGaLocation":3088,"dataGaName":3204},"/solutions/value-stream-management/",{"text":3208,"config":3209},"Analytics & Insights",{"href":3210,"dataGaLocation":3088,"dataGaName":3211},"/solutions/analytics-and-insights/","Analytics and insights",{"title":3213,"type":3138,"items":3214},"GitLab for",[3215,3221,3227],{"text":3216,"config":3217},"Enterprise",{"icon":3218,"href":3219,"dataGaLocation":3088,"dataGaName":3220},"Building","/enterprise/","enterprise",{"text":3222,"config":3223},"Small Business",{"icon":3224,"href":3225,"dataGaLocation":3088,"dataGaName":3226},"Work","/small-business/","small business",{"text":3228,"config":3229},"Public Sector",{"icon":3230,"href":3231,"dataGaLocation":3088,"dataGaName":3232},"Organization","/solutions/public-sector/","public sector",{"text":3234,"config":3235},"Pricing",{"href":3236,"dataGaName":3237,"dataGaLocation":3088,"dataNavLevelOne":3237},"/pricing/","pricing",{"text":3239,"config":3240,"menu":3242},"Resources",{"dataNavLevelOne":3241},"resources",{"type":3138,"link":3243,"columns":3247,"feature":3339},{"text":3244,"config":3245},"View all resources",{"href":3246,"dataGaName":3241,"dataGaLocation":3088},"/resources/",[3248,3281,3308],{"title":3249,"items":3250},"Getting started",[3251,3256,3261,3266,3271,3276],{"text":3252,"config":3253},"Install",{"href":3254,"dataGaName":3255,"dataGaLocation":3088},"/install/","install",{"text":3257,"config":3258},"Quick start guides",{"href":3259,"dataGaName":3260,"dataGaLocation":3088},"/get-started/","quick setup checklists",{"text":3262,"config":3263},"Learn",{"href":3264,"dataGaLocation":3088,"dataGaName":3265},"https://university.gitlab.com/","learn",{"text":3267,"config":3268},"Product documentation",{"href":3269,"dataGaName":3270,"dataGaLocation":3088},"https://docs.gitlab.com/","product documentation",{"text":3272,"config":3273},"Best practice videos",{"href":3274,"dataGaName":3275,"dataGaLocation":3088},"/getting-started-videos/","best practice videos",{"text":3277,"config":3278},"Integrations",{"href":3279,"dataGaName":3280,"dataGaLocation":3088},"/integrations/","integrations",{"title":3282,"items":3283},"Discover",[3284,3289,3294,3299,3303],{"text":3285,"config":3286},"Customer success stories",{"href":3287,"dataGaName":3288,"dataGaLocation":3088},"/customers/","customer success stories",{"text":3290,"config":3291},"Blog",{"href":3292,"dataGaName":3293,"dataGaLocation":3088},"/blog/","blog",{"text":3295,"config":3296},"Demo Hub",{"href":3297,"dataGaName":3298,"dataGaLocation":3088},"/demo-hub/","demo hub",{"text":3300,"config":3301},"The Source",{"href":3302,"dataGaName":3293,"dataGaLocation":3088},"/the-source/",{"text":3304,"config":3305},"Remote",{"href":3306,"dataGaName":3307,"dataGaLocation":3088},"https://handbook.gitlab.com/handbook/company/culture/all-remote/","remote",{"title":3309,"items":3310},"Connect",[3311,3316,3321,3324,3329,3334],{"text":3312,"config":3313},"GitLab Services",{"href":3314,"dataGaName":3315,"dataGaLocation":3088},"/services/","services",{"text":3317,"config":3318},"Contribute",{"href":3319,"dataGaName":3320,"dataGaLocation":3088},"https://contributors.gitlab.com","contribute",{"text":3322,"config":3323},"Community",{"href":3017,"dataGaName":3018,"dataGaLocation":3088},{"text":3325,"config":3326},"Forum",{"href":3327,"dataGaName":3328,"dataGaLocation":3088},"https://forum.gitlab.com/","forum",{"text":3330,"config":3331},"Events",{"href":3332,"dataGaName":3333,"dataGaLocation":3088},"/events/","events",{"text":3335,"config":3336},"Partners",{"href":3337,"dataGaName":3338,"dataGaLocation":3088},"/partners/","partners",{"config":3340,"title":3343,"text":3344,"link":3345},{"background":3341,"textColor":3342},"url('https://res.cloudinary.com/about-gitlab-com/image/upload/v1777322348/qpq8yrgn8knii57omj0c.png')","#000","What’s new in GitLab","Stay updated with our latest features and improvements.",{"text":3346,"config":3347},"Read the latest",{"href":3348,"dataGaName":3349,"dataGaLocation":3088},"/whats-new/","whats new",{"text":3351,"config":3352,"menu":3354},"Company",{"dataNavLevelOne":3353},"company",{"type":3138,"columns":3355},[3356],{"items":3357},[3358,3363,3369,3371,3376,3381,3386,3391,3396,3401],{"text":3359,"config":3360},"About",{"href":3361,"dataGaName":3362,"dataGaLocation":3088},"/company/","about",{"text":3364,"config":3365,"footerGa":3368},"Jobs",{"href":3366,"dataGaName":3367,"dataGaLocation":3088},"/jobs/","jobs",{"dataGaName":3367},{"text":3330,"config":3370},{"href":3332,"dataGaName":3333,"dataGaLocation":3088},{"text":3372,"config":3373},"Leadership",{"href":3374,"dataGaName":3375,"dataGaLocation":3088},"/company/team/e-group/","leadership",{"text":3377,"config":3378},"Handbook",{"href":3379,"dataGaName":3380,"dataGaLocation":3088},"https://handbook.gitlab.com/","handbook",{"text":3382,"config":3383},"Investor relations",{"href":3384,"dataGaName":3385,"dataGaLocation":3088},"https://ir.gitlab.com/overview/default.aspx","investor relations",{"text":3387,"config":3388},"Trust Center",{"href":3389,"dataGaName":3390,"dataGaLocation":3088},"/security/","trust center",{"text":3392,"config":3393},"AI Transparency Center",{"href":3394,"dataGaName":3395,"dataGaLocation":3088},"/ai-transparency-center/","ai transparency center",{"text":3397,"config":3398},"Newsletter",{"href":3399,"dataGaName":3400,"dataGaLocation":3088},"/company/contact/#contact-forms","newsletter",{"text":3402,"config":3403},"Press",{"href":3404,"dataGaName":3405,"dataGaLocation":3088},"/press/","press",{"text":3407,"config":3408,"menu":3409},"Contact us",{"dataNavLevelOne":3353},{"type":3138,"columns":3410},[3411],{"items":3412},[3413,3418,3423],{"text":3414,"config":3415},"Talk to sales",{"href":3416,"dataGaName":3417,"dataGaLocation":3088},"/sales/","talk to sales",{"text":3419,"config":3420},"Support portal",{"href":3421,"dataGaName":3422,"dataGaLocation":3088},"https://support.gitlab.com/hc/en-us","support portal",{"text":3424,"config":3425},"Customer portal",{"href":3426,"dataGaName":3427,"dataGaLocation":3088},"https://customers.gitlab.com/customers/sign_in/","customer portal",{"close":3429,"login":3430,"suggestions":3437},"Close",{"text":3431,"link":3432},"To search repositories and projects, login to",{"text":3433,"config":3434},"gitlab.com",{"href":3102,"dataGaName":3435,"dataGaLocation":3436},"search login","search",{"text":3438,"default":3439},"Suggestions",[3440,3442,3446,3448,3452,3456],{"text":3119,"config":3441},{"href":3025,"dataGaName":3119,"dataGaLocation":3436},{"text":3443,"config":3444},"Code Suggestions (AI)",{"href":3445,"dataGaName":3443,"dataGaLocation":3436},"/solutions/code-suggestions/",{"text":3154,"config":3447},{"href":3156,"dataGaName":3154,"dataGaLocation":3436},{"text":3449,"config":3450},"GitLab on AWS",{"href":3451,"dataGaName":3449,"dataGaLocation":3436},"/partners/technology-partners/aws/",{"text":3453,"config":3454},"GitLab on Google Cloud",{"href":3455,"dataGaName":3453,"dataGaLocation":3436},"/partners/technology-partners/google-cloud-platform/",{"text":3457,"config":3458},"Why GitLab?",{"href":3131,"dataGaName":3457,"dataGaLocation":3436},{"freeTrial":3460,"mobileIcon":3465,"desktopIcon":3470,"secondaryButton":3473},{"text":3461,"config":3462},"Start free trial",{"href":3463,"dataGaName":3093,"dataGaLocation":3464},"https://gitlab.com/-/trials/new/","nav",{"altText":3466,"config":3467},"Gitlab Icon",{"src":3468,"dataGaName":3469,"dataGaLocation":3464},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1758203874/jypbw1jx72aexsoohd7x.svg","gitlab icon",{"altText":3466,"config":3471},{"src":3472,"dataGaName":3469,"dataGaLocation":3464},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1758203875/gs4c8p8opsgvflgkswz9.svg",{"text":3474,"config":3475},"Get Started",{"href":3476,"dataGaName":3477,"dataGaLocation":3464},"https://gitlab.com/-/trial_registrations/new?glm_source=about.gitlab.com/get-started/","get started",{"freeTrial":3479,"mobileIcon":3483,"desktopIcon":3485},{"text":3480,"config":3481},"Learn more about GitLab Duo",{"href":3025,"dataGaName":3482,"dataGaLocation":3464},"gitlab duo",{"altText":3466,"config":3484},{"src":3468,"dataGaName":3469,"dataGaLocation":3464},{"altText":3466,"config":3486},{"src":3472,"dataGaName":3469,"dataGaLocation":3464},{"button":3488,"mobileIcon":3493,"desktopIcon":3495},{"text":3489,"config":3490},"/switch",{"href":3491,"dataGaName":3492,"dataGaLocation":3464},"#contact","switch",{"altText":3466,"config":3494},{"src":3468,"dataGaName":3469,"dataGaLocation":3464},{"altText":3466,"config":3496},{"src":3497,"dataGaName":3469,"dataGaLocation":3464},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1773335277/ohhpiuoxoldryzrnhfrh.png",{"freeTrial":3499,"mobileIcon":3504,"desktopIcon":3506},{"text":3500,"config":3501},"Back to pricing",{"href":3236,"dataGaName":3502,"dataGaLocation":3464,"icon":3503},"back to pricing","GoBack",{"altText":3466,"config":3505},{"src":3468,"dataGaName":3469,"dataGaLocation":3464},{"altText":3466,"config":3507},{"src":3472,"dataGaName":3469,"dataGaLocation":3464},{"title":3509,"titleMobile":3510,"button":3511,"config":3516},"Duo Agent Platform delivers 400% ROI, per new Forrester Consulting study.","400% ROI: Forrester TEI for GitLab Duo",{"text":3129,"config":3512},{"href":3513,"dataGaName":3514,"dataGaLocation":3515},"https://about.gitlab.com/blog/gitlab-duo-agent-platform-delivers-400-percent-roi/","forrester-tei-dap-banner","global-banner",{"layout":3517,"disabled":3065},"release",{"data":3519},{"text":3520,"source":3521,"edit":3527,"contribute":3532,"config":3537,"items":3542,"minimal":3751},"Git is a trademark of Software Freedom Conservancy and our use of 'GitLab' is under license",{"text":3522,"config":3523},"View page source",{"href":3524,"dataGaName":3525,"dataGaLocation":3526},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/","page source","footer",{"text":3528,"config":3529},"Edit this page",{"href":3530,"dataGaName":3531,"dataGaLocation":3526},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/-/blob/main/content/","web ide",{"text":3533,"config":3534},"Please contribute",{"href":3535,"dataGaName":3536,"dataGaLocation":3526},"https://gitlab.com/gitlab-com/marketing/digital-experience/about-gitlab-com/-/blob/main/CONTRIBUTING.md/","please contribute",{"twitter":3538,"facebook":3539,"youtube":3540,"linkedin":3541},"https://twitter.com/gitlab","https://www.facebook.com/gitlab","https://www.youtube.com/channel/UCnMGQ8QHMAnVIsI3xJrihhg","https://www.linkedin.com/company/gitlab-com",[3543,3590,3643,3687,3719],{"title":3234,"links":3544,"subMenu":3559},[3545,3549,3554],{"text":3546,"config":3547},"View plans",{"href":3236,"dataGaName":3548,"dataGaLocation":3526},"view plans",{"text":3550,"config":3551},"Why Premium?",{"href":3552,"dataGaName":3553,"dataGaLocation":3526},"/pricing/premium/","why premium",{"text":3555,"config":3556},"Why Ultimate?",{"href":3557,"dataGaName":3558,"dataGaLocation":3526},"/pricing/ultimate/","why ultimate",[3560],{"title":3561,"links":3562},"Contact Us",[3563,3566,3568,3570,3575,3580,3585],{"text":3564,"config":3565},"Contact sales",{"href":3416,"dataGaName":3098,"dataGaLocation":3526},{"text":3419,"config":3567},{"href":3421,"dataGaName":3422,"dataGaLocation":3526},{"text":3424,"config":3569},{"href":3426,"dataGaName":3427,"dataGaLocation":3526},{"text":3571,"config":3572},"Status",{"href":3573,"dataGaName":3574,"dataGaLocation":3526},"https://status.gitlab.com/","status",{"text":3576,"config":3577},"Terms of use",{"href":3578,"dataGaName":3579,"dataGaLocation":3526},"/terms/","terms of use",{"text":3581,"config":3582},"Privacy statement",{"href":3583,"dataGaName":3584,"dataGaLocation":3526},"/privacy/","privacy statement",{"text":3586,"config":3587},"Cookie preferences",{"dataGaName":3588,"dataGaLocation":3526,"id":3589,"isOneTrustButton":322},"cookie preferences","ot-sdk-btn",{"title":3134,"links":3591,"subMenu":3600},[3592,3596],{"text":3593,"config":3594},"DevSecOps platform",{"href":3117,"dataGaName":3595,"dataGaLocation":3526},"devsecops platform",{"text":3597,"config":3598},"AI-Assisted Development",{"href":3025,"dataGaName":3599,"dataGaLocation":3526},"ai-assisted development",[3601],{"title":3602,"links":3603},"Topics",[3604,3609,3614,3619,3624,3628,3633,3638],{"text":3605,"config":3606},"CICD",{"href":3607,"dataGaName":3608,"dataGaLocation":3526},"/topics/ci-cd/","cicd",{"text":3610,"config":3611},"GitOps",{"href":3612,"dataGaName":3613,"dataGaLocation":3526},"/topics/gitops/","gitops",{"text":3615,"config":3616},"DevOps",{"href":3617,"dataGaName":3618,"dataGaLocation":3526},"/topics/devops/","devops",{"text":3620,"config":3621},"Version Control",{"href":3622,"dataGaName":3623,"dataGaLocation":3526},"/topics/version-control/","version control",{"text":3076,"config":3625},{"href":3626,"dataGaName":3627,"dataGaLocation":3526},"/topics/devsecops/","devsecops",{"text":3629,"config":3630},"Cloud Native",{"href":3631,"dataGaName":3632,"dataGaLocation":3526},"/topics/cloud-native/","cloud native",{"text":3634,"config":3635},"AI for Coding",{"href":3636,"dataGaName":3637,"dataGaLocation":3526},"/topics/devops/ai-for-coding/","ai for coding",{"text":3639,"config":3640},"Agentic AI",{"href":3641,"dataGaName":3642,"dataGaLocation":3526},"/topics/agentic-ai/","agentic ai",{"title":3644,"links":3645},"Solutions",[3646,3648,3650,3655,3659,3662,3666,3669,3671,3674,3677,3682],{"text":3178,"config":3647},{"href":3173,"dataGaName":3178,"dataGaLocation":3526},{"text":3167,"config":3649},{"href":3150,"dataGaName":3151,"dataGaLocation":3526},{"text":3651,"config":3652},"Agile development",{"href":3653,"dataGaName":3654,"dataGaLocation":3526},"/solutions/agile-delivery/","agile delivery",{"text":3656,"config":3657},"SCM",{"href":3163,"dataGaName":3658,"dataGaLocation":3526},"source code management",{"text":3605,"config":3660},{"href":3156,"dataGaName":3661,"dataGaLocation":3526},"continuous integration & delivery",{"text":3663,"config":3664},"Value stream management",{"href":3206,"dataGaName":3665,"dataGaLocation":3526},"value stream management",{"text":3610,"config":3667},{"href":3668,"dataGaName":3613,"dataGaLocation":3526},"/solutions/gitops/",{"text":3216,"config":3670},{"href":3219,"dataGaName":3220,"dataGaLocation":3526},{"text":3672,"config":3673},"Small business",{"href":3225,"dataGaName":3226,"dataGaLocation":3526},{"text":3675,"config":3676},"Public sector",{"href":3231,"dataGaName":3232,"dataGaLocation":3526},{"text":3678,"config":3679},"Education",{"href":3680,"dataGaName":3681,"dataGaLocation":3526},"/solutions/education/","education",{"text":3683,"config":3684},"Financial services",{"href":3685,"dataGaName":3686,"dataGaLocation":3526},"/solutions/finance/","financial services",{"title":3239,"links":3688},[3689,3691,3693,3695,3698,3700,3703,3705,3707,3709,3711,3713,3715,3717],{"text":3252,"config":3690},{"href":3254,"dataGaName":3255,"dataGaLocation":3526},{"text":3257,"config":3692},{"href":3259,"dataGaName":3260,"dataGaLocation":3526},{"text":3262,"config":3694},{"href":3264,"dataGaName":3265,"dataGaLocation":3526},{"text":3267,"config":3696},{"href":3269,"dataGaName":3697,"dataGaLocation":3526},"docs",{"text":3290,"config":3699},{"href":3292,"dataGaName":3293,"dataGaLocation":3526},{"text":3701,"config":3702},"What's new",{"href":3348,"dataGaName":3349,"dataGaLocation":3526},{"text":3285,"config":3704},{"href":3287,"dataGaName":3288,"dataGaLocation":3526},{"text":3304,"config":3706},{"href":3306,"dataGaName":3307,"dataGaLocation":3526},{"text":3312,"config":3708},{"href":3314,"dataGaName":3315,"dataGaLocation":3526},{"text":3317,"config":3710},{"href":3319,"dataGaName":3320,"dataGaLocation":3526},{"text":3322,"config":3712},{"href":3017,"dataGaName":3018,"dataGaLocation":3526},{"text":3325,"config":3714},{"href":3327,"dataGaName":3328,"dataGaLocation":3526},{"text":3330,"config":3716},{"href":3332,"dataGaName":3333,"dataGaLocation":3526},{"text":3335,"config":3718},{"href":3337,"dataGaName":3338,"dataGaLocation":3526},{"title":3351,"links":3720},[3721,3723,3725,3727,3729,3731,3735,3740,3742,3744,3746],{"text":3359,"config":3722},{"href":3361,"dataGaName":3353,"dataGaLocation":3526},{"text":3364,"config":3724},{"href":3366,"dataGaName":3367,"dataGaLocation":3526},{"text":3372,"config":3726},{"href":3374,"dataGaName":3375,"dataGaLocation":3526},{"text":3377,"config":3728},{"href":3379,"dataGaName":3380,"dataGaLocation":3526},{"text":3382,"config":3730},{"href":3384,"dataGaName":3385,"dataGaLocation":3526},{"text":3732,"config":3733},"Sustainability",{"href":3734,"dataGaName":3732,"dataGaLocation":3526},"/sustainability/",{"text":3736,"config":3737},"Diversity, inclusion and belonging (DIB)",{"href":3738,"dataGaName":3739,"dataGaLocation":3526},"/diversity-inclusion-belonging/","Diversity, inclusion and belonging",{"text":3387,"config":3741},{"href":3389,"dataGaName":3390,"dataGaLocation":3526},{"text":3397,"config":3743},{"href":3399,"dataGaName":3400,"dataGaLocation":3526},{"text":3402,"config":3745},{"href":3404,"dataGaName":3405,"dataGaLocation":3526},{"text":3747,"config":3748},"Modern Slavery Transparency Statement",{"href":3749,"dataGaName":3750,"dataGaLocation":3526},"https://handbook.gitlab.com/handbook/legal/modern-slavery-act-transparency-statement/","modern slavery transparency statement",{"items":3752},[3753,3756,3759],{"text":3754,"config":3755},"Terms",{"href":3578,"dataGaName":3579,"dataGaLocation":3526},{"text":3757,"config":3758},"Cookies",{"dataGaName":3588,"dataGaLocation":3526,"id":3589,"isOneTrustButton":322},{"text":3760,"config":3761},"Privacy",{"href":3583,"dataGaName":3584,"dataGaLocation":3526},[3763],{"id":3764,"title":7,"body":3064,"config":3765,"content":3767,"description":3064,"extension":3771,"meta":3772,"navigation":322,"path":3773,"seo":3774,"stem":3775,"__hash__":3776},"blogAuthors/en-us/blog/authors/michael-friedrich.yml",{"template":3766},"BlogAuthor",{"name":7,"config":3768},{"headshot":3769,"ctfId":3770},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1749659879/Blog/Author%20Headshots/dnsmichi-headshot.jpg","dnsmichi","yml",{},"/en-us/blog/authors/michael-friedrich",{},"en-us/blog/authors/michael-friedrich","lJ-nfRIhdG49Arfrxdn1Vv4UppwD51BB13S3HwIswt4",[3778,3786,3794],{"title":3779,"description":3780,"heroImage":3781,"category":3060,"date":3782,"authors":3783,"slug":3785,"externalUrl":3064},"How I built a demo generator with GitLab Duo Agent Platform","Demos haven't always looked like this. Looking back over my career, here's how they have evolved. Follow the tutorial to build your own demo and agent.","https://res.cloudinary.com/about-gitlab-com/image/upload/v1765809212/noh0mdfn9o94ry9ykura.png","2026-08-13",[3784],"Itzik Gan Baruch","agentic-click-through-demo",{"title":3787,"description":3788,"heroImage":3789,"category":3060,"date":3790,"authors":3791,"slug":3793,"externalUrl":3064},"How to govern agentic AI, MCPs, and AI code assistants","AI agents can write, push, and deploy without human review at each step. Learn a practical framework for controlling access, permissions, and audit trails.","https://res.cloudinary.com/about-gitlab-com/image/upload/v1785337625/ifzlc2hyzaxhzmjgyymh.png","2026-07-31",[3792],"Julie Griffin","govern-agentic-ai-mcps-code-assistants",{"title":3795,"description":3796,"heroImage":3797,"category":3060,"date":3798,"authors":3799,"slug":3801,"externalUrl":3064},"Claude Opus 5 on GitLab: Reasoning built for the hard tasks","Anthropic’s Claude Opus 5 is now available on GitLab Duo Agent Platform, delivering deeper reasoning without sacrificing speed.","https://res.cloudinary.com/about-gitlab-com/image/upload/v1750099203/Blog/Hero%20Images/Blog/Hero%20Images/blog-image-template-1800x945%20%2820%29_2bJGC5ZP3WheoqzlLT05C5_1750099203484.png","2026-07-27",[3800],"Brittany Lutz","claude-opus-5-on-gitlab-duo-agent-platform",{"promotions":3803},[3804,3817,3829,3841],{"id":3805,"categories":3806,"header":3807,"text":3808,"button":3809,"image":3814},"ai-modernization",[3060],"Is AI achieving its promise at scale?","Quiz will take 5 minutes or less",{"text":3810,"config":3811},"Get your AI maturity score",{"href":3812,"dataGaName":3813,"dataGaLocation":3293},"/assessments/ai-modernization-assessment/","modernization assessment",{"config":3815},{"src":3816},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1772138786/qix0m7kwnd8x2fh1zq49.png",{"id":3818,"categories":3819,"header":3821,"text":3808,"button":3822,"image":3826},"devops-modernization",[3820,3627],"product","Are you just managing tools or shipping innovation?",{"text":3823,"config":3824},"Get your DevOps maturity score",{"href":3825,"dataGaName":3813,"dataGaLocation":3293},"/assessments/devops-modernization-assessment/",{"config":3827},{"src":3828},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1772138785/eg818fmakweyuznttgid.png",{"id":3830,"categories":3831,"header":3833,"text":3808,"button":3834,"image":3838},"security-modernization",[3832],"security","Are you trading speed for security?",{"text":3835,"config":3836},"Get your security maturity score",{"href":3837,"dataGaName":3813,"dataGaLocation":3293},"/assessments/security-modernization-assessment/",{"config":3839},{"src":3840},"https://res.cloudinary.com/about-gitlab-com/image/upload/v1772138786/p4pbqd9nnjejg5ds6mdk.png",{"id":3842,"paths":3843,"header":3846,"text":3847,"button":3848,"image":3853},"github-azure-migration",[3844,3845],"migration-from-azure-devops-to-gitlab","integrating-azure-devops-scm-and-gitlab","Is your team ready for GitHub's Azure move?","GitHub is already rebuilding around Azure. Find out what it means for you.",{"text":3849,"config":3850},"See how GitLab compares to GitHub",{"href":3851,"dataGaName":3852,"dataGaLocation":3293},"/compare/gitlab-vs-github/github-azure-migration/","github azure migration",{"config":3854},{"src":3828},{"header":3856,"blurb":3857,"button":3858,"secondaryButton":3863},"Start building faster today","See what your team can do with the intelligent orchestration platform for DevSecOps.\n",{"text":3859,"config":3860},"Get your free trial",{"href":3861,"dataGaName":3093,"dataGaLocation":3862},"https://gitlab.com/-/trial_registrations/new?glm_content=default-saas-trial&glm_source=about.gitlab.com/","feature",{"text":3564,"config":3864},{"href":3416,"dataGaName":3098,"dataGaLocation":3862},1786803772740]