Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rust API

Reference · Level 2: Building real applications

The nano-ros Rust API is the nros crate. It re-exports every type a user application needs: Executor, Node, Publisher<M>, Subscription<M>, Service<S>, Client<S>, ActionServer<A>, ActionClient<A>, Timer and GuardCondition, with nros::prelude as the glob import. It is no_std, and its heap use is behind the alloc feature, so the same node code builds for a host and for a board. Message types are generated crates, one per interface package your node depends on (Message Generation).

API reference

nros rustdoc — start here.

The published rustdoc is built from the current main branch with the alloc, log, env, rmw-cffi and ros-humble features on.

Where to start

How to read the rustdoc

The published pages show the crate with the features listed above turned on. A board build turns on only the features its image asks for, so an item behind a feature your image does not enable is absent from that build even though the published page shows it; the item’s source, linked from its page, shows the #[cfg(feature = ...)] that gates it. Your own package documents nros at the version and features it builds with: run cargo doc --open in that package. That is also where your message crates are documented: they are generated for your workspace, so the published site does not have them.

Porting only

These crates are not part of the user API. They surface only when you write a custom RMW backend or port nano-ros to a new platform; see Write a custom RMW backend and Add a platform.