|
|
Log in / Subscribe / Register

Rust for embedded Linux kernels

Rust for embedded Linux kernels

Posted Apr 24, 2024 12:13 UTC (Wed) by josh (subscriber, #17465)
In reply to: Rust for embedded Linux kernels by atnot
Parent article: Rust for embedded Linux kernels

> rusts rough equivalent, move (which like passing by value in C may or may not actually copy memory), is used very commonly as it is the only way to transfer full ownership of memory to other code

It's the only way when you have data on the stack. Data in the heap can have ownership passed around by pointer, and Rust does this all the time (e.g. Box and Vec and many other data structures). But if you have data on the *stack* and you want to pass full ownership around, you have to do it by copying.

You can safely pass around *references* to data on the stack, and Rust will guarantee that that data doesn't outlive the stack frame it came from.


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds