Logo
blank Skip to main content

Using Rust for IoT Development: Everything You Need to Know to Start a Project

Key takeaways:

  • While C/C++ is still the default choice for IoT and embedded development, Rust is becoming a close contender.
  • Rust’s memory safety, garbage collection, compile-time error detection, and interoperability allow developers to fix IoT issues that were unsolvable with C/C++.
  • Key considerations before committing your project to Rust include a relatively small ecosystem, limited board support, and a lack of skilled embedded Rust developers. 
  • Companies that have adopted or migrated to Rust report more efficient operation of their IoT devices, fewer bugs, and improved data protection.

C/C++ has dominated embedded IoT development for decades, but using these languages comes at a cost. 

Memory safety vulnerabilities, buffer overflows, and concurrency bugs remain fundamental and unavoidable risks for IoT devices powered by C/C++. Rust offers an alternative, delivering C/C++ performance while eliminating many of these risks through its ownership model and compile-time guarantees. 

However, there are things you should consider before adopting Rust for IoT. In this article, we examine Rust’s practical advantages and limitations for IoT projects. We’ll explore how Rust addresses traditional embedded development challenges, evaluate the maturity of its hardware support, and help you determine whether Rust is the right choice for your next IoT product.

This post will be useful for IoT manufacturers, engineering leaders, and product managers who are looking for ways to improve their device performance and security.

What makes Rust better than C/C++ for IoT development?

IoT and embedded development are traditionally based on C/C++, Python, and Java. For a long time, these languages have provided developers with the best possible control over hardware, mechanisms for performance optimization, and real-time data processing. However, they also present challenges with memory safety and code reliability — these languages simply don’t provide any tools for automated memory safety and error detection.

And for IoT products, stable and safe operation is everything. That’s why many development teams have turned to Rust.

Why use Rust over C++ in IoT development?

Rust is a relatively new multi-paradigm programming language that has quickly gained popularity among the development community. In 2024, Rust was the most-admired programming language in the Stack Overflow Developer Survey, with an 83% score. Developers and software providers value Rust for its modern automation features, safety, and code efficiency.

Here are the key benefits of using Rust for IoT development projects:

5 reasons to develop IoT software with Rust

Memory safety

Rust’s strict memory management model eliminates common vulnerabilities like null pointer dereferencing, buffer overflows, and data races. And Rust enforces ownership and borrowing systems to make code safer without performance penalties. 

In IoT systems, where devices often run independently without frequent security updates, these features are crucial. 

By contrast, in C++, developers rely heavily on code reviews, testing, and external tools to catch the same problems, and mistakes can be costly.

Compile-time error detection

Rust’s compiler is stricter than that of C/C++ or Java. It performs deep static analysis to detect potential logical, lifetime, and concurrency issues before the code runs. This approach shortens testing cycles and makes releases more predictable. In other languages, such errors are detected only at runtime, when fixing them is much more expensive.

With IoT devices, fixing errors after deployment may not even be possible. Under these conditions, Rust helps to avoid baked-in vulnerabilities and product recalls.

Compatibility with other languages

Interoperability is one of the core principles of Rust that allows this language to coexist with C and C++ code. Its well-designed Foreign Function Interface (FFI) makes it easy to call or expose functions across language boundaries. 

FFI enables gradual Rust adoption, which is especially important for existing IoT software. Teams can write new IoT modules in Rust and combine them with existing C++ drivers and legacy firmware instead of carrying out lengthy and costly migration. 

Code versatility

IoT products mostly consist of device code and the cloud services connecting these devices, and Rust provides a lot of tools for both parts. With Rust, development teams can build bare-metal microcontrollers using frameworks like embedded-hal and RTIC, edge devices running Linux, and cloud back ends orchestrating thousands of endpoints. In C++, developers often have to use separate toolchains and dialects for each layer, leading to fragmentation and complicated code support. 

Using one language across these tiers simplifies knowledge sharing and code maintenance for IoT products. 

Energy efficiency

Energy efficiency can make or break IoT devices that are already very limited in their hardware capabilities. Rust provides features like zero-cost abstractions and deterministic resource use that result in smaller binaries and fewer CPU cycles. 

Without garbage collection or hidden allocations, Rust applications have predictable energy profiles that can extend battery life and reduce thermal load. Performance and energy consumption of Rust-based devices is comparable to C++ devices, but with added safety and reliability.

These and other features make it look like building solutions for IoT with Rust makes perfect sense. However, many of its modern features make Rust a perfect choice for IoT development. So why are many companies still sticking to C/C++? Let’s examine the key downsides of using Rust.

Collaborate with IoT experts on your next project!

The Apriorit team will help you choose relevant technologies and implement a safe, efficient solution just as you envision it.

Challenges of using Rust in IoT development 

Despite being 10 years old, Rust is still experiencing the growing pains of a new language. The main issues with Rust that an IoT development team may face are:

  • Smaller ecosystem and community (compared to other popular languages). While Rust’s community is active and supportive, the language doesn’t provide as many libraries and drivers as C++, and it supports fewer boards. Teams may need to write low-level integrations from scratch or adapt community projects that are not yet tested in production. Lack of a diverse ecosystem makes application design and MVP development take longer.
  • Steep learning curve. Rust’s new concepts, including its ownership model and compilation rules, not only force developers to study new features but also change the way they think. For engineers experienced in C or C++, Rust’s rules can feel rigid, with explicit handling of lifetimes, mutability, and borrowing. Over time, this discipline leads to safer and more maintainable code, but the learning curve can extend project timelines early on.
  • Lack of skilled developers. With only 13% of developers being skilled in Rust, the global Rust talent pool remains relatively small compared to C++ or Python. These developers are in high demand for projects that focus on code safety and efficiency. Because of that, hiring a Rust expert can be a challenge even if a company offers a competitive salary, and building that expertise internally takes a lot of time due to the language’s learning curve.

With these limitations, getting a Rust project off the ground and delivering an MVP takes more time and investment than doing the same with, say, a C++ project. However, many companies believe that the long-term benefits Rust provides outweigh these challenges. In the next section, we’ll take a look at several IoT projects that leverage Rust.

Rust-based IoT products — are they out there?

Both industry leaders and startups build their new IoT products with Rust and migrate legacy solutions to this language. Their key motivation to use Rust is memory safety management, which fixes issues that are inherent to C++ and critical for IoT operations.

Here are several examples of how Rust is used in IoT solutions:

  • IoT Edge by Microsoft Azure. This runtime and framework allows developers to deploy, run, and manage containerized applications locally on edge devices. Microsoft used Rust for the security daemon in IoT Edge because this language provides reliable security and memory management capabilities, as well as interoperability with C.
  • Software for Dwelio’s smart home devices. Dwelio originally powered its devices with Python code. They decided to rewrite it in Rust to resolve bugs, improve software scalability, get rid of technical debt, and switch to cheaper hardware. As a result, the company got safer, more stable, and more cost-efficient software.
  • Automotive microcontrollers by STMicroelectronics and HighTec. Functional safety of software is critical for software-defined vehicles, and using Rust allowed STMicroelectronics and HighTec to deliver the world’s first 28nm microcontrollers compliant with ISO 26262 ASIL D. Their product allows automotive companies to build safe, compliant, and performant vehicles.

As you can see, Rust enables companies to build devices that meet diverse goals, industry-specific requirements, and applicable regulations. They value Rust’s security and memory safety features, efficient power consumption, and simplified code support.

But the choice of language for IoT development depends not only on the preferences of the development team. Hardware support is critical, so make sure to research Rust’s current capabilities before making a decision. 

In the next section, we’ll guide you through the key steps of choosing Rust-compliant software.

Read also

Secure Development with Rust: Benefits, Features, and Use Cases

Explore how Rust’s unique memory safety and concurrency model can help you build secure, reliable tools for many industries.

Learn more
Secure Development with Rust: Benefits, Features, and Use Cases

Checking IoT hardware compatibility with Rust

The choice of hardware for an IoT project always depends more on product requirements than on the tech stack your development team wants to use. Rust provides support for the majority of popular boards including Arduino, Raspberry Pi, and ESP32, but it lacks pre-built crates for more niche boards. 

In theory, you can use any hardware for a Rust-based project, even if Rust does not currently support it. However, the burden of ensuring compatibility and efficient performance will then lie with your team, making the development process long and technically challenging.

When picking components for a Rust-based system, your team should consider two elements: the device board and the operating system.

Checking IoT hardware compatibility with Rust

Here are the key criteria for choosing suitable and compatible hardware:

  • Board’s task. Your choice should be based on expectations of device performance and features, as well as project scale. Example: for prototyping simple devices or DIY projects, the Raspberry Pi Pico with its corresponding crate (rp-pico) is a suitable choice. For industrial-scale production, opt for microcontrollers designed for high load, such as those from the STM32 family (with its respective crate). Also, consider specific project requirements: connectivity, battery life, performance, integrations with additional sensors and devices, etc.
  • Rust support. Rust-embedded provides a list of currently available crates for boards. Once you have a list of boards that correspond to your device requirements, check the list of available crates to see which are compatible with Rust. Alternatively, your team can develop a custom crate independently, though this requires additional development time.

When it comes to choosing the operating system, your team has two options:

  • RTOS. You can power your device with a real-time operating system where code is loaded directly into RAM and executed, without an operating system layer. This approach is suitable for microcontrollers with limited resources. To work with RTOS, your team can use the no_std and embedded-hal libraries for hardware control, along with Embassy, embassy-executor, or rtos-rs for task management.
  • Linux. If RTOS capabilities aren’t enough, you can run a full-fledged operating system on your devices. This approach is appropriate when, in addition to controlling hardware, you need to run a web server, database, or third-party services concurrently. When running Linux, you can use the std library for OS interactions, the rppal or linux-embedded-hal library for hardware control, and actix-web for a web server.

To make the right choice between RTOS and Linux, you can also compare the features they support:

Featureno_stdstd
Heap (dynamic memory)Only if you use the alloc crate and use a suitable allocator like alloc-cortex-m
Collections (Vec, BTreeMap, etc.)Only if you use the collections crate and configure a global default allocatorHashMap and HashSet are not available
Stack overflow protection
Runs init code before main
Libstd available
Libcore available
Writing firmware, kernel, or bootloader code

The right choice of board and operating system will ensure your IoT device can work under the load and conditions you plan for it, and that your team will be able to use Rust’s benefits to the max.

Read also

Linux Driver Development with Rust: Benefits, Challenges, and a Practical Example

Explore the advantages of introducing Rust into Linux driver development, from minimizing low-level errors to increasing system security and developer productivity.

Learn more
article-Linux-driver-development-with-Rust-cover

How Apriorit can help you build Rust-based IoT projects

Improving internal Rust expertise is one of Apriorit’s priorities. Our engineers have practical experience from many Rust-based projects, including:

Paired with our 20+ years of experience in embedded and IoT development, our experience in Rust makes Apriorit perfectly geared to deliver complex, performant, and secure systems. Whether you need a cross-platform, low-level, or C/C++ interoperable IoT solution, Apriorit engineers will deliver exactly the product you envision.

Conclusion

Using Rust for embedded development addresses challenges that have persisted for decades, such as achieving memory safety and concurrency without sacrificing performance or managing garbage collection manually. For IoT projects, this translates into fewer runtime bugs and more reliable deployments.

One of the key challenges in switching to Rust is finding an expert Rust development team. At Apriorit, we have extensive experience building IoT solutions across Rust, C/C++, and hybrid implementations. Working with us, you’ll get a secure technical solution that brings your business idea to life.

FAQ

What are the disadvantages of using C/C++ for IoT devices?

<p>C or C++ is the default choice for for IoT devices, as these languages provide fine control over hardware, stable performance, and a rich ecosystem. However, they come with significant downsides:</p>
<ul>
<li>Memory management and safety risks</li>
<li>No garbage collection</li>
<li>No automated error handling</li>
<li>Error detection at compile time</li>
<li>Challenging codebase maintenance</li>
<li>Lots of room for developer errors</li>
</ul>

Can I use Rust for any type of IoT product?

<p>Rust works for most IoT products, from microcontrollers to edge gateways and industrial devices. Hardware support depends on available platform implementations and HAL crates.</p>
<p>Popular platforms like ARM Cortex-M, ESP32, and RISC-V have strong support for Rust. Resource-constrained devices with limited RAM or specialized architectures may require additional tooling setup, but Rust’s no_std mode enables bare-metal development without standard library overhead.</p>

What are the challenges of using Rust for IoT projects?

<p>The main challenges are a smaller ecosystem compared to C/C++, fewer hardware abstraction layers for niche platforms, and a steeper learning curve for developers. Additionally, some vendor-specific SDKs only support C/C++, requiring FFI modules for integration with Rust.</p>
<p>Finding engineers with embedded Rust experience can be difficult, as they are in high demand. For many companies, it’s easier to outsource Rust development to a company with relevant experience instead of going through the hiring process.</p>

Can Rust-based IoT code work with my C/C++ code?

<p>Yes. Rust has C interoperability through FFI, allowing seamless integration with existing C/C++ codebases, drivers, and libraries. You can call C functions from Rust and expose Rust functions to C. </p>
<p>FFI enables gradual migration to Rust while maintaining compatibility with legacy C/C++ code.</p>

Can I integrate Rust firmware modules into a larger ecosystem?

<p>Rust modules integrate seamlessly via standard IoT protocols like MQTT, CoAP, HTTP/HTTPS, and communication interfaces including UART, SPI, I2C, and CAN bus. </p>

<p>You can ensure cloud connectivity, OTA updates, and device management through libraries and frameworks within the Rust ecosystem.</p>

Is Rust suitable for resource-constrained IoT devices?

Yes, Rust compiles to efficient machine code with no runtime overhead or garbage collection. This code is perfect for devices with limited memory and processing power. Devices with as little as 16KB RAM can run Rust firmware, though comfortable minimums are typically 32-64KB RAM.

Have a question?

Ask our expert!

Michael-Teslia
Michael Teslia

Program Manager

Tell us about
your project

...And our team will:

  • Process your request within 1-2 business days.
  • Get back to you with an offer based on your project's scope and requirements.
  • Set a call to discuss your future project in detail and finalize the offer.
  • Sign a contract with you to start working on your project.

Do not have any specific task for us in mind but our skills seem interesting? Get a quick Apriorit intro to better understand our team capabilities.

* By sending us your request you confirm that you read and accepted our Terms & Conditions and Privacy Policy.