Skip to main content

Crate nros_core

Crate nros_core 

Source
Expand description

Core types, traits, and abstractions for nros

This crate provides the foundational types and traits for nros:

  • RosMessage trait for message types
  • RosService trait for service types
  • RosAction trait for action types
  • ServiceServer and ServiceClient for service communication
  • Time and Duration types
  • Error types

Re-exports§

pub use action::ActionClient;
pub use action::ActionServer;
pub use action::CancelResponse;
pub use action::CancelReturnCode;
pub use action::GoalId;
pub use action::GoalInfo;
pub use action::GoalResponse;
pub use action::GoalStatus;
pub use action::GoalStatusStamped;
pub use action::RosAction;
pub use clock::Clock;
pub use clock::ClockType;
pub use codegen_version::NROS_CODEGEN_VERSION;
pub use codegen_version::NROS_CODEGEN_VERSION_MIN;
pub use lifecycle::LifecycleState;
pub use lifecycle::LifecycleTransition;
pub use lifecycle::TransitionResult;
pub use logger::Logger;
pub use logger::OnceFlag;
pub use message_info::MessageInfo;
pub use message_info::PUBLISHER_GID_SIZE;
pub use message_info::RawMessageInfo;
pub use service::ServiceCallback;
pub use service::ServiceClient;
pub use service::ServiceRequest;
pub use service::ServiceServer;
pub use time::Duration;
pub use time::Time;
pub use types::RosMessage;
pub use types::RosService;
pub use types::ViewableMessage;
pub use heapless;

Modules§

action
ROS 2 Action types
clock
Clock API for nros
codegen_version
RFC-0090 / phase-429 — the codegen version, the one token that says whether generated code and this runtime can work together.
heap
Heap-backed containers for generated mode = "heap" message fields (RFC-0033). Gated on alloc, which std implies — so a hosted consumer gets these by asking for std and never has to name alloc. nros-serdes gates its matching Serialize/Deserialize impls on the SAME feature and receives it through the same forward, which is what issue 0598 was about. Generated code refers to nros_core::heap::{Vec, String} so the same path works in both crate and inline (build.rs) codegen modes.
lifecycle
Lifecycle state machine types (REP-2002)
logger
ROS 2 compatible logging utilities
message_info
Message metadata for received messages
service
ROS 2 Service types
time
ROS time types.
types
Core ROS type traits.

Structs§

CdrReader
CDR reader for deserialization
CdrWriter
DHeaderMark
Opaque marker returned by CdrWriter::begin_dheader, passed back to CdrWriter::end_dheader. Under XCDR1 it carries nothing (the DHEADER calls are no-ops); under XCDR2 it holds the reserved DHEADER position.
DHeaderScope
Opaque scope returned by CdrReader::begin_dheader, passed back to CdrReader::end_dheader. Under XCDR1 it carries nothing (no-op); under XCDR2 it holds the absolute buffer offset of the delimited struct’s end.
LeSliceView
A borrowed, alignment-agnostic view over a CDR little-endian numeric sequence (RFC-0033 borrowed mode). Borrows the raw payload bytes zero-copy; decodes elements lazily on access, so the source buffer need not be T-aligned. Valid only for the borrow lifetime 'a (the subscription callback scope).

Enums§

DeserError
Deserialization error.
EncodingVersion
CDR writer for serialization.
SerError
Serialization error.

Traits§

Deserialize
Trait for types that can be deserialized from CDR format
DeserializeView
Trait for borrowed (zero-copy) deserialization from CDR format (RFC-0033 borrowed storage mode, issue 0007).
LeDecode
A little-endian-decodable fixed-width numeric element of a borrowed sequence.
Serialize
Trait for types that can be serialized to CDR format