News for hackers. Stuff that matters.
Re:Committing to Rust for Kernel Code by oddmiral on Thursday November 23, 2023 @02:10PM (#38396285)
It is not designed for, but Rust works well on microcontrollers, such as Arduino. For example, a blink program for Arduino in Rust is less than 300 bytes in size when compiled with "s" optimization level. It's a bit larger than C because of vector of interrupt handlers and error handling.
Re:Committing to Rust for Kernel Code by steveklabnik on Thursday November 23, 2023 @02:11PM (#38396304)
> It is not designed for,

Making sure Rust can work in embedded environments is absolutely a design goal, and choices around this are made explicitly.

Re:Committing to Rust for Kernel Code by tester756 on Thursday November 23, 2023 @02:12PM (#38396315)
>choices around this are made explicitly.

e.g?

Re:Committing to Rust for Kernel Code by steveklabnik on Thursday November 23, 2023 @02:16PM (#38396356)
A few off the top of my head: the core/std split, making the core language never allocate implicitly, the design of async/await.
Re:Committing to Rust for Kernel Code by worik on Thursday November 23, 2023 @02:44PM (#38396700)
> the design of async/await.

I am curious

How is "the design of async/await." for embedded programming?

Re:Committing to Rust for Kernel Code by steveklabnik on Thursday November 23, 2023 @02:56PM (#38396822)
The design of async/await took "using it in embedded" as a constraint. This is why it doesn't allocate, for example. Even C++ coroutines have one allocation, though they say that it can often be optimized away.

This means RTOS-like projects can use it for tasks, and it works well. Embassy is an example of such a project.

(Yet, I should also point out that you don't have to: at work we keep ours synchronous, for Reasons. Rust lets you do what you want.)

Re:Committing to Rust for Kernel Code by Vecr on Thursday November 23, 2023 @02:55PM (#38396807)
Async/await does not require dynamic memory allocation.