Uploaded February 2026 | Updated September 2026, 2 weeks ago
Rust's ownership and borrowing system can be confusing at first. In this video, we break down the seven fundamental rules that govern how Rust manages memory safely without a garbage collector or runtime overhead. To keep it applicable to embedded systems, we use a stack-based example (rather than relying on the heap examples found in the Rust Book). You'll learn how ownership transfers work, when values are dropped from memory, and how references provide safe access to data without the memory bugs that plague C and C++ programs. No hardware required for this episode: just your computer and the Rust compiler to explore these concepts through hands-on code examples.
The written guide for this episode can be found here: digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-4-ownership-and-borrowing
The GitHub repository containing the Docker image and example code for this series can be found here: github.com/ShawnHymel/introduction-to-embedded-rust
This tutorial provides an in-depth exploration of Rust's memory management rules, covering each principle with clear examples and explanations. We start with basic ownership: how each value has exactly one owner and what happens when ownership is transferred (moved) between variables. You'll understand the difference between types that implement the Copy trait (like primitive integers and arrays) versus types that use move semantics. We explore scoping rules and how Rust automatically deallocates memory when owners go out of scope, eliminating memory leaks without manual cleanup. We then dive into borrowing and references, explaining the crucial rule that you can have either multiple immutable references or one mutable reference at a time.
We also look at why references must always be valid, preventing dangling pointer bugs that cause crashes and security vulnerabilities in other languages. We demonstrate partial moves with compound types like tuples and structs, showing what happens when you move ownership of only part of a value.
We conclude with slice operations, including how to create multiple mutable slices to non-overlapping array regions using split_at_mut() (a useful pattern for working with buffers in embedded systems). Unlike typical Rust tutorials that rely heavily on heap-allocated types (like String and Vec), our examples use stack-only data structures that mirror real embedded development constraints, making this tutorial especially relevant for bare-metal programming.
These ownership and borrowing rules are what make Rust unique among systems programming languages, offering the performance of C with memory safety guarantees typically found only in garbage-collected languages.
Related Link:
digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-4-ownership-and-borrowing
Links:
Getting Started with STM32 and Nucleo: youtube.com/watch?v=hyZS2p1tW-g&list=PLEBQazB0HUyRYuzfi4clXsKUSgorErmBv
Introduction to Real-Time Operating Systems (RTOS): youtube.com/watch?v=F321087yYy4&list=PLEBQazB0HUyQ4hAPU1cJED6t3DU0h34bz
Raspberry Pi Pico 2: digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
Learn more:
Maker.io - digikey.com/en/maker
DigiKey’s Blog – TheCircuit digikey.com/en/blog
Connect with DigiKey on Facebook facebook.com/digikey.electronics
And follow us on X: https://x.com/digikey
Product:
digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
digikey.com/en/products/detail/raspberry-pi/SC1632/26241102
digikey.com/en/products/detail/raspberry-pi/SC1633/25862735
digikey.com/en/products/detail/raspberry-pi/SC1634/26241087
digikey.com/en/products/detail/sparkfun-electronics/13314/6797646
digikey.com/en/products/detail/lite-on-inc/LTL-4224/217584
digikey.com/en/products/detail/stackpole-electronics-inc/CF14JT220R/1830334
digikey.com/en/products/detail/te-connectivity-alcoswitch-switches/1825910-6/1632536
digikey.com/en/products/detail/dfrobot/FIT0096/7597069
digikey.com/en/products/detail/adafruit-industries-llc/1957/6827090
digikey.com/en/products/detail/cvilux-usa/DH-20M50055/13175849
Chapters:
0:00 Intro
0:52 Stack vs. Heap
3:32 Rule 1: Each Value Has an Owner
5:48 Rule 2: Only One Owner at a Time
9:28 Rule 3: Value Dropped When Owner Goes Out of Scope
15:49 Pointers and References
17:56 Rule 4: Only One Mutable Reference or Any Number of Immutable References
26:21 Rule 5: References Must Always Be Valid
29:43 Rule 6: Moving Part of a Value Moves the Whole Value
32:58 Rule 7: Slides Are References to the Whole Value
40:10 Recap
40:41 Reading Assignment
41:36 Conclusion
Rust's ownership and borrowing system can be confusing at first. In this video, we break down the seven fundamental rules that govern how Rust manages memory safely without a garbage collector or runtime overhead. To keep it applicable to embedded systems, we use a stack-based example (rather than relying on the heap examples found in the Rust Book). You'll learn how ownership transfers work, when values are dropped from memory, and how references provide safe access to data without the memory bugs that plague C and C++ programs. No hardware required for this episode: just your computer and the Rust compiler to explore these concepts through hands-on code examples.
The written guide for this episode can be found here: digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-4-ownership-and-borrowing
The GitHub repository containing the Docker image and example code for this series can be found here: github.com/ShawnHymel/introduction-to-embedded-rust
This tutorial provides an in-depth exploration of Rust's memory management rules, covering each principle with clear examples and explanations. We start with basic ownership: how each value has exactly one owner and what happens when ownership is transferred (moved) between variables. You'll understand the difference between types that implement the Copy trait (like primitive integers and arrays) versus types that use move semantics. We explore scoping rules and how Rust automatically deallocates memory when owners go out of scope, eliminating memory leaks without manual cleanup. We then dive into borrowing and references, explaining the crucial rule that you can have either multiple immutable references or one mutable reference at a time.
We also look at why references must always be valid, preventing dangling pointer bugs that cause crashes and security vulnerabilities in other languages. We demonstrate partial moves with compound types like tuples and structs, showing what happens when you move ownership of only part of a value.
We conclude with slice operations, including how to create multiple mutable slices to non-overlapping array regions using split_at_mut() (a useful pattern for working with buffers in embedded systems). Unlike typical Rust tutorials that rely heavily on heap-allocated types (like String and Vec), our examples use stack-only data structures that mirror real embedded development constraints, making this tutorial especially relevant for bare-metal programming.
These ownership and borrowing rules are what make Rust unique among systems programming languages, offering the performance of C with memory safety guarantees typically found only in garbage-collected languages.
Related Link:
digikey.com/en/maker/tutorials/2026/intro-to-embedded-rust-part-4-ownership-and-borrowing
Links:
Getting Started with STM32 and Nucleo: youtube.com/watch?v=hyZS2p1tW-g&list=PLEBQazB0HUyRYuzfi4clXsKUSgorErmBv
Introduction to Real-Time Operating Systems (RTOS): youtube.com/watch?v=F321087yYy4&list=PLEBQazB0HUyQ4hAPU1cJED6t3DU0h34bz
Raspberry Pi Pico 2: digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
Learn more:
Maker.io - digikey.com/en/maker
DigiKey’s Blog – TheCircuit digikey.com/en/blog
Connect with DigiKey on Facebook facebook.com/digikey.electronics
And follow us on X: https://x.com/digikey
Product:
digikey.com/en/products/detail/raspberry-pi/SC1631/24627142
digikey.com/en/products/detail/raspberry-pi/SC1632/26241102
digikey.com/en/products/detail/raspberry-pi/SC1633/25862735
digikey.com/en/products/detail/raspberry-pi/SC1634/26241087
digikey.com/en/products/detail/sparkfun-electronics/13314/6797646
digikey.com/en/products/detail/lite-on-inc/LTL-4224/217584
digikey.com/en/products/detail/stackpole-electronics-inc/CF14JT220R/1830334
digikey.com/en/products/detail/te-connectivity-alcoswitch-switches/1825910-6/1632536
digikey.com/en/products/detail/dfrobot/FIT0096/7597069
digikey.com/en/products/detail/adafruit-industries-llc/1957/6827090
digikey.com/en/products/detail/cvilux-usa/DH-20M50055/13175849
Chapters:
0:00 Intro
0:52 Stack vs. Heap
3:32 Rule 1: Each Value Has an Owner
5:48 Rule 2: Only One Owner at a Time
9:28 Rule 3: Value Dropped When Owner Goes Out of Scope
15:49 Pointers and References
17:56 Rule 4: Only One Mutable Reference or Any Number of Immutable References
26:21 Rule 5: References Must Always Be Valid
29:43 Rule 6: Moving Part of a Value Moves the Whole Value
32:58 Rule 7: Slides Are References to the Whole Value
40:10 Recap
40:41 Reading Assignment
41:36 Conclusion

![Spool Speed Ahead [Maker Update] | Maker.io
This week on Maker Update, taking your filament for a spin, a solderless USB port, adapting your eBike to the EV grid, and getting your coffee under control.
+Show Notes [Maker Update Ep.473]+
=Project of the Week=
Spooly McSpoolBot by Matt Denton 0:27
https://github.com/mantisrobot/SPOOLBOT
D-O Droid Build by Matt Denton https://www.youtube.com/playlist?list=PLTSAQ5KEjPVCldgA1t-KT1lRTKJdAY7er
=News=
Green Powered Challenge by Hackaday and DigiKey 2:38
https://hackaday.io/contest/205085-green-powered-challenge
Easily Replaceable USB-C Port Spawned By EU Laws 3:00
https://hackaday.com/2026/02/26/easily-replaceable-usb-c-port-spawned-by-eu-laws/
Find it on DigiKey -
Single: https://www.digikey.com/en/products/detail/jae-electronics/DX07B024ZJ1C1088/28948035
Double: https://www.digikey.com/en/products/detail/jae-electronics/DX07B048ZJ1C768/28948037
=More Projects=
I Fixed the Biggest Problem with Electric Bikes by Matt Gray 3:35
https://www.youtube.com/watch?v=i6IyukCIia8
MokaBot by Javier Tellols 4:20
https://www.baristamagazine.com/all-about-the-mokabot-the-smart-moka-pot/
James Hoffmann MokaBot Overview Video
https://www.youtube.com/watch?v=UGf7mtfhOFM
=Tips & Tools=
Homing Without Limits in Python Using RP2040 & TMC2209 by DIY Machines 5:14
https://www.instructables.com/Sensorless-Homing-in-Python-Using-RP2040-TMC2209/
Find it on DigiKey -
TMC2209 Silent Step Stick:
https://www.digikey.com/en/products/detail/analog-devices-inc-maxim-integrated/TMC2209SILENTSTEPSTICK/10232488
Adam Savages Favorite New Painting Technique! by Tested 5:49
https://www.youtube.com/watch?v xYiXY_Cv68
=DigiKey Spotlight=
Leveraging Development Boards and Modules to Achieve Multimodal Perception AI by DigiKey Product Discovery 6:19
https://www.youtube.com/watch?v=r5JphsUCu_M
#makerupdate
Maker Update is a weekly video series covering news, projects, tips, and events that interest the maker and DIY community.
Find more online:
Blog: http://makerprojectlab.com
Instagram: https://www.instagram.com/makerprojectlab/ Spool Speed Ahead [Maker Update] | Maker.io](https://i.ytimg.com/vi/PAzosz6g2js/mqdefault.jpg)








