[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"academy-blogs-en-1-1-all-learn-rust-ep10-structs-data-modeling-basics-wrap-up-all--*":3,"academy-blog-translations-jr23sw5fmzc263p":83},{"data":4,"page":82,"perPage":82,"totalItems":82,"totalPages":82},[5],{"alt":6,"collectionId":7,"collectionName":8,"content":9,"cover_image":10,"cover_image_path":11,"created":12,"created_by":13,"expand":14,"id":75,"keywords":76,"locale":51,"published_at":77,"scheduled_at":13,"school_blog":73,"short_description":78,"slug":79,"status":71,"title":80,"updated":81,"updated_by":13,"views":74},"Infographic explaining Rust Structs as Blueprints, showing fields, instance creation, and adding methods using the impl block.","sclblg987654321","school_blog_translations","\u003Cp>Welcome to the final episode of \u003Ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https:\u002F\u002Fwww.superdevacademy.com\u002Fen\u002Fblogs\u002Fcategories\u002FRust%20The%20Series\">\u003Cstrong>Rust The Series (Basic Edition)! \u003C\u002Fstrong>\u003C\u002Fa>After battling through the ironclad memory management rules and Rust’s famous \u003Ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https:\u002F\u002Fwww.superdevacademy.com\u002Fen\u002Fblogs\u002Flearn-rust-ep8-borrowing-and-references\">\u003Cstrong>Borrowing\u003C\u002Fstrong>\u003C\u002Fa> system, you might be asking yourself:\u003C\u002Fp>\u003Cblockquote>\u003Cp>\u003Cem>\"How can I create a single variable that holds multiple related pieces of information? For example, a member profile that contains a Name (String), Age (i32), and Membership Status (bool) how do I bundle them all together?\"\u003C\u002Fem>\u003C\u002Fp>\u003C\u002Fblockquote>\u003Cp>In other languages, your mind might jump to \u003Cstrong>Classes\u003C\u002Fstrong> or \u003Cstrong>Objects\u003C\u002Fstrong>. In Rust, we use a powerful tool called a \u003Cstrong>Struct (Structure)\u003C\u002Fstrong>. It is the primary way to create custom \u003Ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https:\u002F\u002Fwww.superdevacademy.com\u002Fen\u002Fblogs\u002Frust-programming-data-types-guide\">\u003Cstrong>Data Types\u003C\u002Fstrong>\u003C\u002Fa> tailored to your specific needs!\u003C\u002Fp>\u003Ch2>1. What is a Struct?\u003C\u002Fh2>\u003Cp>To put it simply, a \u003Cstrong>Struct\u003C\u002Fstrong> allows you to bundle multiple types of data into a single unit. Each piece of data inside the bundle is called a \u003Cstrong>Field\u003C\u002Fstrong>.\u003C\u002Fp>\u003Cp>The true power of a Struct lies in its ability to name each part of the data. Unlike a Tuple, where you have to remember the order of elements (indices), a Struct makes your code much more readable. It serves as a Blueprint that defines exactly what an object should consist of.\u003C\u002Fp>\u003Cp>Rust\u003C\u002Fp>\u003Cpre>\u003Ccode>\u002F\u002F Defining a Struct (Creating the Blueprint)\nstruct User {\n    username: String,    \u002F\u002F User's name\n    email: String,       \u002F\u002F User's email\n    sign_in_count: u64,  \u002F\u002F Number of times logged in\n    active: bool,        \u002F\u002F Account status (Active\u002FInactive)\n}\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch2>2. Creating an Instance (Putting the Blueprint into Action)\u003C\u002Fh2>\u003Cp>Once we have our blueprint (Struct), the next step is to create actual data, which we call an Instance.\u003C\u002Fp>\u003Cp>Think of creating an instance like filling out a form you’ve designed. One thing to keep in mind: Rust is very strict about data. It requires you to provide values for every single field you declared in the blueprint.\u003C\u002Fp>\u003Cp>Rust\u003C\u002Fp>\u003Cpre>\u003Ccode>fn main() {\n    \u002F\u002F Create an instance named user1 \n    \u002F\u002F (We use 'mut' so we can modify the data later)\n    let mut user1 = User {\n        email: String::from(\"admin@superdev.com\"),\n        username: String::from(\"superdev_admin\"),\n        active: true,\n        sign_in_count: 1,\n    };\n\n    \u002F\u002F Accessing Data: Use \"Dot Notation\" (e.g., user1.email)\n    \u002F\u002F Modifying Data: We can change the value directly because it's declared as 'mut'\n    user1.email = String::from(\"contact@superdev.com\");\n    \n    println!(\"User: {} (Email: {})\", user1.username, user1.email);\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Important Safety Notes:\u003C\u002Fh3>\u003Cul>\u003Cli>\u003Cp>\u003Cstrong>Immutable by Default:\u003C\u002Fstrong> In true Rust fashion, if you simply declare \u003Ccode>let user1 = ...\u003C\u002Fcode>, you won't be able to change any field after the instance is created.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cstrong>All or Nothing:\u003C\u002Fstrong> In Rust, we cannot make individual fields mutable. If you want to edit a field, the entire instance must be declared as \u003Ccode>mut\u003C\u002Fcode>.\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>3. Methods: Giving Your Struct Superpowers\u003C\u002Fh2>\u003Cp>Storing data is great, but what makes Structs truly powerful is the ability to add Methods—functions specifically tied to that Struct. This gives your objects their own built-in \"behaviors.\"\u003C\u002Fp>\u003Cp>We use the keyword \u003Cstrong>\u003Ccode>impl\u003C\u002Fcode>\u003C\u002Fstrong> (short for Implementation) to declare: \"Here are the capabilities of this Struct!\"\u003C\u002Fp>\u003Cp>Rust\u003C\u002Fp>\u003Cpre>\u003Ccode>struct Rectangle {\n    width: u32,\n    height: u32,\n}\n\nimpl Rectangle {\n    \u002F\u002F A Method for calculating area\n    \u002F\u002F We use '&amp;self' to say, \"I need to borrow the data from myself\"\n    fn area(&amp;self) -&gt; u32 {\n        self.width * self.height\n    }\n}\n\nfn main() {\n    let rect = Rectangle { width: 30, height: 50 };\n    \n    \u002F\u002F Call the method using Dot Notation (.)\n    println!(\"The rectangle area is: {} square units\", rect.area());\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\u003Ch3>Why do we need \u003Ccode>&amp;self\u003C\u002Fcode>?\u003C\u002Fh3>\u003Cp>Did you notice the \u003Ccode>&amp;self\u003C\u002Fcode> parameter? This is a direct application of the Borrowing rules we learned in EP.8:\u003C\u002Fp>\u003Cul>\u003Cli>\u003Cp>It means the method is borrowing for reading the data from itself (the specific instance) to perform a calculation.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>If you wanted the method to modify the data within itself, you would simply change it to \u003Cstrong>\u003Ccode>&amp;mut self\u003C\u002Fcode>\u003C\u002Fstrong>.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>This is the beauty of Rust: even in an Object-Oriented style, \u003Ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"https:\u002F\u002Fwww.superdevacademy.com\u002Fen\u002Fblogs\u002Frust-ownership-memory-management-ep7\">\u003Cstrong>the Ownership\u003C\u002Fstrong>\u003C\u002Fa> rules follow you to ensure your code is always safe!\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>4. Summary: The Rust The Series Journey\u003C\u002Fh2>\u003Cp>Congratulations! Over the past 10 episodes, we have built the essential foundation needed to step fully into the world of Rust. Here is a recap of our journey to success:\u003C\u002Fp>\u003Cul>\u003Cli>\u003Cp>\u003Cstrong>EP.1-3 (The Beginning):\u003C\u002Fstrong> Arming ourselves by installing the right tools and meeting \u003Cstrong>Cargo\u003C\u002Fstrong>, our intelligent companion that stays with us throughout the development journey.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cstrong>EP.4-6 (The Core):\u003C\u002Fstrong> Mastering the non-negotiable fundamentals, including variables, \u003Cstrong>Data Types\u003C\u002Fstrong>, and \u003Cstrong>Control Flow\u003C\u002Fstrong>.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cstrong>EP.7-9 (The Soul):\u003C\u002Fstrong> Diving deep into the heart of what makes Rust unique: \u003Cstrong>Ownership, Borrowing, and Slices\u003C\u002Fstrong>.\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cstrong>EP.10 (The Architecture):\u003C\u002Fstrong> Bringing everything together to design custom data structures with \u003Cstrong>Structs\u003C\u002Fstrong>.\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Cp>Although the \"Basic Edition\" of this series ends here, your journey in the world of Rust has only just begun! Exciting treasures like Enums, Pattern Matching, Traits, and Error Handling are waiting for you to conquer in the next phase.\u003C\u002Fp>\u003Cblockquote>\u003Cp>\u003Cstrong>\"Learning how to communicate effectively with the Rust Compiler today is your first step toward becoming a developer who writes some of the safest and most efficient software in the world.\"\u003C\u002Fstrong>\u003C\u002Fp>\u003C\u002Fblockquote>\u003Cp>\u003C\u002Fp>\u003Cdiv data-type=\"horizontalRule\">\u003Chr>\u003C\u002Fdiv>\u003Ch2>A Final Note from the Team\u003C\u002Fh2>\u003Cp>A huge thank you to everyone who followed \u003Cstrong>Rust The Series\u003C\u002Fstrong> through to the end of this foundational phase!\u003C\u002Fp>\u003Cp>We sincerely hope this series has helped tear down the wall of belief that \u003Cem>\"Rust is too hard\"\u003C\u002Fem> and replaced it with the joy and confidence of learning. For us, Rust’s safety and speed aren't just features they are the Art of Exceptional Programming.\u003C\u002Fp>\u003Cp>Stay tuned for our next project! Whether we dive into new frameworks or push the boundaries of Advanced Rust, you won't want to miss what's coming next.\u003C\u002Fp>\u003Cp>🎯 \u003Cstrong>Follow Superdev Academy for top-tier Dev knowledge:\u003C\u002Fstrong> Don't miss our deep-dive technical articles and the latest technology updates. Connect with us on all channels:\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\">\u003Cstrong>Superdev Academy Thailand\u003C\u002Fstrong>\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\">\u003Cstrong>Superdev Academy Channel\u003C\u002Fstrong>\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\">\u003Cstrong>@superdevacademy\u003C\u002Fstrong>\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\">\u003Cstrong>@superdevacademy\u003C\u002Fstrong>\u003C\u002Fa>\u003C\u002Fp>\u003C\u002Fli>\u003Cli>\u003Cp>\u003Cstrong>🌐 Website: \u003C\u002Fstrong>\u003Ca target=\"_blank\" rel=\"noopener noreferrer nofollow\" href=\"http:\u002F\u002Fsuperdevacademy.com\">\u003Cstrong>superdevacademy.com\u003C\u002Fstrong>\u003C\u002Fa>\u003C\u002Fp>\u003C\u002Fli>\u003C\u002Ful>\u003Cp>\u003C\u002Fp>","20huxp5666ju_46ts1eryg2.png","https:\u002F\u002Ftwsme-r2.tumwebsme.com\u002Fsclblg987654321\u002F5mjwslsuaynlw7d\u002F20huxp5666ju_46ts1eryg2.png","2026-04-27 09:11:56.972Z","",{"keywords":15,"locale":45,"school_blog":55},[16,23,27,31,36,41],{"collectionId":17,"collectionName":18,"created":19,"created_by":13,"id":20,"name":21,"updated":22,"updated_by":13},"sclkey987654321","school_keywords","2026-03-04 08:20:06.235Z","254619mvnk1hr7y","Rust","2026-04-10 16:07:25.292Z",{"collectionId":17,"collectionName":18,"created":24,"created_by":13,"id":25,"name":26,"updated":24,"updated_by":13},"2026-04-27 08:44:07.827Z","js0lw99aehm9lee","Rust Struct",{"collectionId":17,"collectionName":18,"created":28,"created_by":13,"id":29,"name":30,"updated":28,"updated_by":13},"2026-04-27 08:44:15.504Z","32obullvepjuri6","Rust Method",{"collectionId":17,"collectionName":18,"created":32,"created_by":13,"id":33,"name":34,"updated":35,"updated_by":13},"2026-03-23 03:26:43.307Z","pf009wnev852vvt","Rust tutorial","2026-04-10 16:14:45.235Z",{"collectionId":17,"collectionName":18,"created":37,"created_by":13,"id":38,"name":39,"updated":40,"updated_by":13},"2026-04-03 10:57:34.421Z","azixuoag5jisout","Backend Development","2026-04-10 16:14:47.389Z",{"collectionId":17,"collectionName":18,"created":42,"created_by":13,"id":43,"name":44,"updated":42,"updated_by":13},"2026-04-27 09:04:31.707Z","fng4v2w97o8lweg","Learn Rust Programming",{"code":46,"collectionId":47,"collectionName":48,"created":49,"flag":50,"id":51,"is_default":52,"label":53,"updated":54},"en","pbc_1989393366","locales","2026-01-22 11:00:02.726Z","twemoji:flag-united-states","qv9c1llfov2d88z",false,"English","2026-04-10 15:42:46.825Z",{"category":56,"collectionId":57,"collectionName":58,"expand":59,"id":73,"views":74},"mfqe235iv6x1or8","pbc_2105096300","school_blogs",{"category":60},{"blogIds":61,"collectionId":62,"collectionName":63,"created":64,"created_by":13,"id":56,"image":65,"image_alt":13,"image_path":66,"label":67,"name":68,"priority":69,"publish_at":70,"scheduled_at":13,"status":71,"updated":72,"updated_by":13},[],"sclcatblg987654321","school_category_blogs","2026-03-16 04:40:07.104Z","47vt5s1gglj_tz0b90vnge.png","https:\u002F\u002Ftwsme-r2.tumwebsme.com\u002Fsclcatblg987654321\u002Fmfqe235iv6x1or8\u002F47vt5s1gglj_tz0b90vnge.png",{"en":68,"th":68},"Rust The Series",2,"2026-03-16 04:40:09.199Z","published","2026-04-25 02:32:15.619Z","jr23sw5fmzc263p",140,"5mjwslsuaynlw7d",[20,25,29,33,38,43],"2026-05-05 03:14:34.943Z","Master the art of data modeling in Rust with Structs. Learn how to create custom types, implement methods, and review the core concepts from the past 10 episodes to solidify your foundation.","learn-rust-ep10-structs-data-modeling-basics-wrap-up","Structuring Data with Structs | Rust The Series EP.10","2026-05-05 03:14:34.944Z",1,{"th":79,"en":79}]