embassy/docs/modules/ROOT/pages/traits.adoc

9 lines
843 B
Text
Raw Normal View History

2021-12-09 09:06:17 +00:00
= Embassy Traits
2021-12-10 09:47:34 +00:00
Embassy provides a set of traits and types specifically designed for `async` usage. Many of these futures will be upstreamed to the `embedded-hal` crate at some point in the future, probably when the required GAT (Generic Associated Types) feature is stabilized in Rust.
2021-12-09 09:40:26 +00:00
2021-12-10 09:47:34 +00:00
* `embassy::io`: `AsyncBufRead`, `AsyncWrite`. Traits for byte-stream IO, essentially `no_std` compatible versions of `futures::io`. The primary reason for re-defining these traits is that the `futures::io` variant requires `std::io::Error`, which does not work in the `no_std` environment.
* `embassy::time`: Time `Driver` trait that is implemented for different platforms. Time in Embassy is represented using the `Duration` and `Instant` types.
These traits are implemented by the platform-specific crates, such as `embassy-nrf` or `embassy-stm32`.