`embedded-nal` logo

`embedded-nal`

Free

An Embedded Network Abstraction Layer - [![crates.io](https://img.shields.io/crates/v/embedded-nal.svg)](https://crates.io/crates/embedded-nal)

FreeFree tier
Type
Open Source

About `embedded-nal`

embedded-nal is an open-source Rust crate that defines a simple set of traits for an Embedded Network Abstraction Layer (NAL). These traits can be implemented by almost any TCP/IP stack, including on-chip stacks like smoltcp or off-chip stacks via AT modems. The project follows a structured process for proposing new traits: research/discussion, implementation/demonstration, and finally a pull request. It is dual-licensed under Apache 2.0 and MIT, and guarantees compilation on stable Rust 1.77.0 and up. The repository also hosts an asynchronous variant, embedded-nal-async, in a sub-crate within the same workspace.

Key Features

Defines a set of traits for embedded network abstraction
Supports on-chip TCP/IP stacks (e.g., smoltcp) and off-chip stacks (e.g., AT modem)
Includes an asynchronous variant (embedded-nal-async)
Community-driven trait proposal process with discussion, demonstration, and PR stages
Minimum supported Rust version (MSRV) 1.77.0
Dual-licensed under Apache 2.0 and MIT

Pros & Cons

Pros
  • Provides portability across different TCP/IP stacks with a common trait interface
  • Well-defined and community-reviewed process for adding new traits
  • Supports both synchronous and asynchronous networking via embedded-nal-async
  • Dual license allows flexible use in open-source and proprietary projects
  • Open-source with active community involvement (rust-embedded-community)
Cons
  • Low-level abstraction; users need familiarity with embedded networking concepts
  • Documentation limited to the README and API reference
  • Trait design is evolving; stability not guaranteed for all traits

Best For

Embedded systems requiring TCP/IP networking in RustIoT devices with limited resources needing a portable network APIno_std environments where a standard TCP stack is unavailableAbstracting over different network hardware (e.g., WiFi modules, Ethernet chips)

FAQ

What is embedded-nal?
embedded-nal is a Rust crate that defines a set of traits for an Embedded Network Abstraction Layer. It allows different TCP/IP stacks (e.g., smoltcp, AT modem stacks) to be used through a common interface.
What TCP/IP stacks can be used with embedded-nal?
Almost any TCP/IP stack can implement the traits, including on-chip stacks like smoltcp and off-chip stacks such as those accessed via AT modems.
Does embedded-nal support asynchronous operations?
Yes, the repository includes an embedded-nal-async sub-crate that provides asynchronous trait variants.
How can I propose a new trait for embedded-nal?
The process involves research/discussion via an issue, then implementation/demonstration (e.g., in a fork or separate crate), and finally opening a pull request to merge the stabilized trait into embedded-nal.
What is the minimum Rust version required?
The crate is guaranteed to compile on stable Rust 1.77.0 and up.