Skip to main content

Module lifecycle

Module lifecycle 

Source
Expand description

Lifecycle node API (REP-2002)

Provides managed lifecycle state machines for nros nodes.

  • LifecyclePollingNode — standalone state machine with plain function pointers (no_std)
  • LifecyclePollingNodeCtx — standalone state machine with unsafe fn(*mut c_void) -> TransitionResult callbacks, for bridging the C FFI (no_std)

Modules§

trampolines
Monomorphized extern "C" trampolines that recover &mut T from the FFI context pointer and dispatch to the LifecycleCallbacks method. rustc emits one per T, so there is no closure box — no_std-safe. Registered by Executor::register_lifecycle_node; not meant to be called directly.

Structs§

LifecyclePollingNode
Standalone lifecycle state machine for no_std environments.
LifecyclePollingNodeCtx
Lifecycle state machine with unsafe fn(*mut c_void) -> TransitionResult callbacks.

Enums§

LifecycleCallbackSlot
Which transition callback slot to register in LifecyclePollingNodeCtx::register.
LifecycleError
Error type for lifecycle transitions.

Traits§

LifecycleCallbacks
Safe lifecycle-callback surface, symmetric with the C++ nros::LifecycleNode (rclcpp LifecycleNodeInterface). Implement the transitions you need; the rest default to Success (on_error to Failure), matching rclcpp’s non-pure-virtual defaults. Register the node with Executor::register_lifecycle_node, which binds the five REP-2002 services and wires each transition here — no unsafe in user code.

Type Aliases§

LifecycleCallbackFn
Lifecycle callback function pointer (no_std compatible).
LifecycleCallbackFnCtx
Lifecycle callback taking a user context pointer (no_std, C FFI shape).