[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"academy-blog-translations-none":3,"academy-blogs-en-1-1-all-rust-series-ep3-intro-to-cargo-package-manager-all--*":4},{},{"data":5,"meta":79},[6],{"categoryId":7,"collectionId":8,"collectionName":9,"content":10,"createBy":11,"createDate":12,"created":13,"description":14,"expand":15,"group":68,"id":69,"image":70,"imageAlt":71,"imagePath":72,"keywordIds":73,"langId":64,"publishDate":74,"scheduleDate":22,"slug":75,"status":28,"title":76,"updateBy":11,"updated":77,"views":78},"mfqe235iv6x1or8","sclblg987654321","school_blog","\u003Cp>Welcome back to \u003Cstrong>Rust The Series SS1\u003C\u002Fstrong>, the series designed to take you from zero to Rust hero with \u003Cstrong>Superdev Academy\u003C\u002Fstrong>!\u003C\u002Fp>\u003Cp>In EP 1 and 2, we covered the history of Rust and got our environment ready. Now, in EP 3, we are finally going to \"write\" and \"run\" our very first piece of code. But before we dive into the syntax, we need to meet the tool that every Rustacean swears by: \u003Cstrong>Cargo\u003C\u002Fstrong>.\u003C\u002Fp>\u003Ch2>Why Cargo? More Than Just a Package Manager\u003C\u002Fh2>\u003Cp>If Java has Maven\u002FGradle, Python has Pip, and Node.js has NPM... Rust has \u003Cstrong>Cargo\u003C\u002Fstrong>. However, Cargo is often considered more \"complete\" because it is an \u003Cstrong>All-in-one\u003C\u002Fstrong> tool that comes pre-installed with Rust.\u003C\u002Fp>\u003Ctable style=\"min-width: 50px;\">\u003Ccolgroup>\u003Ccol style=\"min-width: 25px;\">\u003Ccol style=\"min-width: 25px;\">\u003C\u002Fcolgroup>\u003Ctbody>\u003Ctr>\u003Ctd colspan=\"1\" rowspan=\"1\">\u003Cp>\u003Cstrong>Feature\u003C\u002Fstrong>\u003C\u002Fp>\u003C\u002Ftd>\u003Ctd colspan=\"1\" rowspan=\"1\">\u003Cp>\u003Cstrong>Description\u003C\u002Fstrong>\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd colspan=\"1\" rowspan=\"1\">\u003Cp>\u003Cstrong>Build System\u003C\u002Fstrong>\u003C\u002Fp>\u003C\u002Ftd>\u003Ctd colspan=\"1\" rowspan=\"1\">\u003Cp>Compiles your source code into an executable program.\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd colspan=\"1\" rowspan=\"1\">\u003Cp>\u003Cstrong>Package Manager\u003C\u002Fstrong>\u003C\u002Fp>\u003C\u002Ftd>\u003Ctd colspan=\"1\" rowspan=\"1\">\u003Cp>Manages external libraries (called \u003Cstrong>Crates\u003C\u002Fstrong> in Rust).\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd colspan=\"1\" rowspan=\"1\">\u003Cp>\u003Cstrong>Project Creator\u003C\u002Fstrong>\u003C\u002Fp>\u003C\u002Ftd>\u003Ctd colspan=\"1\" rowspan=\"1\">\u003Cp>Generates a standardized project structure for seamless collaboration.\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003Ctr>\u003Ctd colspan=\"1\" rowspan=\"1\">\u003Cp>\u003Cstrong>Test Runner\u003C\u002Fstrong>\u003C\u002Fp>\u003C\u002Ftd>\u003Ctd colspan=\"1\" rowspan=\"1\">\u003Cp>Runs built-in tests to ensure your code works as expected.\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>It is widely regarded as one of the best project management systems in the programming world because it makes development incredibly stable and easy to manage.\u003C\u002Fp>\u003Ch2>1. Creating Your First Project with \u003Ccode>cargo new\u003C\u002Fcode>\u003C\u002Fh2>\u003Cp>Open your Terminal (or Command Prompt) and type the following command to create a new project:\u003C\u002Fp>\u003Cp>Bash\u003C\u002Fp>\u003Cpre>\u003Ccode>cargo new hello_superdev\ncd hello_superdev\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>Once you open this folder (we recommend using VS Code), you’ll see the standard Rust project structure:\u003C\u002Fp>\u003Cul>\u003Cli>\u003Cp>\u003Cstrong>\u003Ccode>Cargo.toml\u003C\u002Fcode>\u003C\u002Fstrong>: The \"heart\" of your project (The Manifest) containing metadata and dependencies.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cstrong>\u003Ccode>src\u002F\u003C\u002Fcode>\u003C\u002Fstrong>: The folder where all your source code lives.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cstrong>\u003Ccode>src\u002F\u003C\u002Fcode>\u003C\u002Fstrong>\u003Ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"http:\u002F\u002Fmain.rs\">\u003Cstrong>\u003Ccode>main.rs\u003C\u002Fcode>\u003C\u002Fstrong>\u003C\u002Fa>: The main file where we write our code.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cstrong>\u003Ccode>.gitignore\u003C\u002Fcode>\u003C\u002Fstrong>: Automatically generated for those using Git\u002FGitHub.\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>2. Deep Dive: The \u003Ccode>Cargo.toml\u003C\u002Fcode> (Manifest)\u003C\u002Fh2>\u003Cp>This file uses the \u003Cstrong>TOML\u003C\u002Fstrong> (\u003Cem>Tom's Obvious, Minimal Language\u003C\u002Fem>) format, which is designed to be human-readable:\u003C\u002Fp>\u003Cp>Ini, TOML\u003C\u002Fp>\u003Cpre>\u003Ccode>[package]\nname = \"hello_superdev\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\n# This is where you add external libraries, e.g., serde = \"1.0\"\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cul>\u003Cli>\u003Cp>\u003Cstrong>\u003Ccode>[package]\u003C\u002Fcode>\u003C\u002Fstrong>: Contains general info like the project name, version, and the Rust \u003Ccode>edition\u003C\u002Fcode>.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cstrong>\u003Ccode>[dependencies]\u003C\u002Fcode>\u003C\u002Fstrong>: When you want to add \"superpowers\" to your app (like handling JSON or building a Web API), you'll list those libraries here.\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>3. The \"Hello World\" in \u003Ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"http:\u002F\u002Fmain.rs\">\u003Ccode>main.rs\u003C\u002Fcode>\u003C\u002Fa>\u003C\u002Fh2>\u003Cp>Look inside \u003Ccode>src\u002F\u003C\u002Fcode>\u003Ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"http:\u002F\u002Fmain.rs\">\u003Ccode>main.rs\u003C\u002Fcode>\u003C\u002Fa>. You'll notice that Cargo has already written the boilerplate code for you!\u003C\u002Fp>\u003Cp>Rust\u003C\u002Fp>\u003Cpre>\u003Ccode>fn main() {\n    println!(\"Hello, world!\");\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>\u003Cstrong>Code Analysis:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cul>\u003Cli>\u003Cp>\u003Cstrong>\u003Ccode>fn main()\u003C\u002Fcode>\u003C\u002Fstrong>: This is the \u003Cstrong>Entry Point\u003C\u002Fstrong> of every Rust program. Execution starts here.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cstrong>\u003Ccode>println!\u003C\u002Fcode>\u003C\u002Fstrong>: This is a \u003Cstrong>Macro\u003C\u002Fstrong> (notice the \u003Ccode>!\u003C\u002Fcode>). It prints text to the console. In Rust, macros are used here instead of regular functions because they can handle a variable number of arguments with type safety.\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>4. The 3 Essential Commands to Remember\u003C\u002Fh2>\u003Cp>As you develop in Rust, you will use these three commands constantly:\u003C\u002Fp>\u003Ch3>A. \u003Ccode>cargo build\u003C\u002Fcode> (Compile)\u003C\u002Fh3>\u003Cp>This compiles your code and creates an executable file in the \u003Ccode>target\u002Fdebug\u002F\u003C\u002Fcode> folder.\u003C\u002Fp>\u003Ch3>B. \u003Ccode>cargo run\u003C\u002Fcode> (Build &amp; Run)\u003C\u002Fh3>\u003Cp>The most popular command! It checks if your code has changed, recompiles it if necessary, and then runs the program immediately.\u003C\u002Fp>\u003Cblockquote>\u003Cp>\u003Cstrong>Result:\u003C\u002Fstrong> You should see \u003Ccode>\"Hello, world!\"\u003C\u002Fcode> printed on your screen.\u003C\u002Fp>\u003C\u002Fblockquote>\u003Ch3>C. \u003Ccode>cargo check\u003C\u002Fcode> (The Speed Demon)\u003C\u002Fh3>\u003Cp>This command scans your code for errors and syntax mistakes but \u003Cstrong>does not\u003C\u002Fstrong> generate an executable. It is much faster than a full build, making it perfect for checking your code frequently while you type.\u003C\u002Fp>\u003Ch2>5. Building for Release (Production Mode)\u003C\u002Fh2>\u003Cp>When your program is finished and you want to share it or deploy it, use:\u003C\u002Fp>\u003Cp>Bash\u003C\u002Fp>\u003Cpre>\u003Ccode>cargo build --release\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Cp>\u003Cstrong>Why use \u003Ccode>--release\u003C\u002Fcode>?\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>In standard mode (Debug), Rust focuses on fast compilation for development. In \u003Cstrong>Release\u003C\u002Fstrong> mode, the compiler performs heavy \u003Cstrong>Optimizations\u003C\u002Fstrong> to make your program run as fast as possible. The final executable will be located in \u003Ccode>target\u002Frelease\u002F\u003C\u002Fcode>.\u003C\u002Fp>\u003Cp>\u003C\u002Fp>\u003Cdiv data-type=\"horizontalRule\">\u003Chr>\u003C\u002Fdiv>\u003Ch2>Summary\u003C\u002Fh2>\u003Cp>In this EP, we’ve learned how to use Cargo to manage projects, understood the \u003Ccode>Cargo.toml\u003C\u002Fcode> structure, and ran our first \"Hello World\" using \u003Ccode>cargo run\u003C\u002Fcode>.\u003C\u002Fp>\u003Cp>Having a world-class tool like Cargo allows us to focus entirely on writing logic without worrying about the messy build configurations common in older languages like C++.\u003C\u002Fp>\u003Cp>\u003Cstrong>Next Step:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>In \u003Cstrong>EP 4\u003C\u002Fstrong>, we dive into the most critical fundamental: \u003Cstrong>Variables &amp; Mutability\u003C\u002Fstrong>. We’ll answer the big question: Why are Rust variables \"Immutable\" (unchangeable) by default, and how do we change them when we need to?\u003C\u002Fp>\u003Cp>See you at \u003Cstrong>Superdev Academy\u003C\u002Fstrong>! 🦀✨\u003C\u002Fp>\u003Ch2>🎯 Stay Tuned with Superdev Academy:\u003C\u002Fh2>\u003Cp>Don't miss out on deep-dive technical articles and updates. Follow us on all platforms:\u003C\u002Fp>\u003Cul>\u003Cli>\u003Cp>🔵 \u003Cstrong>Facebook:\u003C\u002Fstrong> \u003Ca target=\"_blank\" rel=\"noopener\" class=\"ng-star-inserted\" href=\"https:\u002F\u002Fwww.facebook.com\u002Fsuperdev.academy.th\">Superdev Academy Thailand\u003C\u002Fa>\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>🎬 \u003Cstrong>YouTube:\u003C\u002Fstrong> \u003Ca target=\"_blank\" rel=\"noopener\" class=\"ng-star-inserted\" href=\"https:\u002F\u002Fwww.youtube.com\u002F@SuperdevAcademy\">Superdev Academy Channel\u003C\u002Fa>\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>📸 \u003Cstrong>Instagram:\u003C\u002Fstrong> \u003Ca target=\"_blank\" rel=\"noopener\" class=\"ng-star-inserted\" href=\"https:\u002F\u002Fwww.instagram.com\u002Fsuperdevacademy\u002F\">@superdevacademy\u003C\u002Fa>\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>🎬 \u003Cstrong>TikTok:\u003C\u002Fstrong> \u003Ca target=\"_blank\" rel=\"noopener\" class=\"ng-star-inserted\" href=\"https:\u002F\u002Fwww.tiktok.com\u002F@superdevacademy?lang=th-TH\">@superdevacademy\u003C\u002Fa>\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>🌐 \u003Cstrong>Website:\u003C\u002Fstrong> \u003Ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"http:\u002F\u002Fsuperdevacademy.com\">superdevacademy.com\u003C\u002Fa>\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Cp>\u003C\u002Fp>","oplnwslvnmx5axc","2026-03-24 00:00:00.000Z","2026-03-23 03:51:01.644Z","Start your Rust journey with Cargo. Learn how to create projects, manage dependencies (Crates), and master essential commands like cargo build, run, and check at Superdev Academy.",{"categoryId":16,"keywordIds":30,"langId":59},{"blogIds":17,"collectionId":18,"collectionName":19,"createBy":11,"created":20,"id":7,"image":21,"imageAlt":22,"imagePath":23,"label":24,"name":25,"priority":26,"publishDate":27,"scheduleDate":22,"status":28,"updateBy":11,"updated":29},[],"sclcatblg987654321","school_category_blog","2026-03-16 04:40:07.104Z","47vt5s1gglj_tz0b90vnge.png","","https:\u002F\u002Ftwsme-r2.tumwebsme.com\u002Fsclcatblg987654321\u002Fmfqe235iv6x1or8\u002F47vt5s1gglj_tz0b90vnge.png",{"en":25,"th":25},"Rust The Series",2,"2026-03-16 04:40:09.199Z","Publish","2026-03-17 06:07:58.599Z",[31,38,42,46,50,54],{"collectionId":32,"collectionName":33,"createBy":22,"created":34,"id":35,"publishDate":36,"scheduleDate":22,"status":28,"title":37,"updateBy":22,"updated":34},"sclkey987654321","school_keyword","2026-03-04 08:20:08.348Z","ux2m77tsy8v19bg","2026-02-04 02:08:47.407Z","Rust Programming",{"collectionId":32,"collectionName":33,"createBy":22,"created":39,"id":40,"publishDate":22,"scheduleDate":22,"status":28,"title":41,"updateBy":22,"updated":39},"2026-03-23 03:08:56.729Z","ttp78s7jayewgl4","Rust",{"collectionId":32,"collectionName":33,"createBy":22,"created":43,"id":44,"publishDate":22,"scheduleDate":22,"status":28,"title":45,"updateBy":22,"updated":43},"2026-03-23 03:26:43.307Z","pf009wnev852vvt","Rust tutorial",{"collectionId":32,"collectionName":33,"createBy":22,"created":47,"id":48,"publishDate":22,"scheduleDate":22,"status":28,"title":49,"updateBy":22,"updated":47},"2026-03-23 03:50:38.325Z","akdikqixom9r0q9","Cargo Rust",{"collectionId":32,"collectionName":33,"createBy":22,"created":51,"id":52,"publishDate":22,"scheduleDate":22,"status":28,"title":53,"updateBy":22,"updated":51},"2026-03-23 03:50:46.038Z","xctfzmxdd8f9ai1","Cargo Commands",{"collectionId":32,"collectionName":33,"createBy":22,"created":55,"id":56,"publishDate":57,"scheduleDate":22,"status":28,"title":58,"updateBy":22,"updated":55},"2026-03-04 08:44:11.146Z","gms2qr4xg6qv65e","2026-03-02 04:30:22.021Z","Superdev Academy",{"code":60,"collectionId":61,"collectionName":62,"createAt":63,"id":64,"is_default":65,"language":66,"updateAt":67},"en","pbc_1989393366","locale","2026-01-22 11:00:02.726Z","qv9c1llfov2d88z",false,"English","2026-02-05 10:48:59.032Z","5diz71et6elhs9k","yvvrfmvitu02hwf","6nrc9hf6ink_3tj7gksldv.png","Rust programming language logo and Cargo build tool illustration for Rust The Series EP 3 at Superdev Academy.","https:\u002F\u002Ftwsme-r2.tumwebsme.com\u002Fsclblg987654321\u002Fyvvrfmvitu02hwf\u002F6nrc9hf6ink_3tj7gksldv.png",[35,40,44,48,52,56],"2026-03-23 04:03:06.965Z","rust-series-ep3-intro-to-cargo-package-manager","Introduction to Cargo - The Essential Tool for Rust Developers | Rust The Series EP.3","2026-03-23 04:03:07.146Z",11,{"pagination":80},{"page":81,"pageSize":81,"pageCount":81,"total":81},1]