pub struct FeedbackStream<'a, A, const GOAL_BUF: usize = nros_node::::executor::handles::FeedbackStream::{constant#0}, const RESULT_BUF: usize = nros_node::::executor::handles::FeedbackStream::{constant#1}, const FEEDBACK_BUF: usize = nros_node::::executor::handles::FeedbackStream::{constant#2}>where
A: RosAction,{ /* private fields */ }Expand description
A stream of feedback messages from an action server.
Created by ActionClient::feedback_stream(). Receives feedback for
all active goals. The stream never self-terminates — use combinators
like take_while or break to stop.
Three access modes:
- Async (
Stream): Enable thestreamfeature forfutures_core::Stream+StreamExtcombinators - Async (no deps): Use
next()inwhile letloops (always available) - Sync: Use
wait_next()which drives the executor internally
Implementations§
Source§impl<A, const GOAL_BUF: usize, const RESULT_BUF: usize, const FEEDBACK_BUF: usize> FeedbackStream<'_, A, GOAL_BUF, RESULT_BUF, FEEDBACK_BUF>where
A: RosAction,
impl<A, const GOAL_BUF: usize, const RESULT_BUF: usize, const FEEDBACK_BUF: usize> FeedbackStream<'_, A, GOAL_BUF, RESULT_BUF, FEEDBACK_BUF>where
A: RosAction,
Sourcepub async fn recv(
&mut self,
) -> Option<Result<(GoalId, <A as RosAction>::Feedback), NodeError>>
pub async fn recv( &mut self, ) -> Option<Result<(GoalId, <A as RosAction>::Feedback), NodeError>>
Async: wait for the next feedback message (no futures dependency needed).
Requires a background task running executor.spin_async() to drive
I/O. Returns None only on error.
When the stream feature is enabled, prefer StreamExt::next() or
TryStreamExt::try_next() for combinator support.
§Example
let mut stream = client.feedback_stream();
while let Some(result) = stream.recv().await {
let (goal_id, feedback) = result?;
// process feedback...
}Sourcepub fn wait_next(
&mut self,
executor: &mut Executor,
timeout: Duration,
) -> Result<Option<(GoalId, <A as RosAction>::Feedback)>, NodeError>
pub fn wait_next( &mut self, executor: &mut Executor, timeout: Duration, ) -> Result<Option<(GoalId, <A as RosAction>::Feedback)>, NodeError>
Sync: wait for the next feedback message, spinning the executor.
Returns Ok(Some(feedback)) if a message arrives within timeout_ms,
or Ok(None) on timeout. Unlike Promise::wait(), timeout is not
an error — the caller typically retries in a loop.