pub struct FeedbackStream<'a, A: RosAction, const GOAL_BUF: usize = { crate::config::DEFAULT_RX_BUF_SIZE }, const RESULT_BUF: usize = { crate::config::DEFAULT_RX_BUF_SIZE }, const FEEDBACK_BUF: usize = { crate::config::DEFAULT_RX_BUF_SIZE }> { /* 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: RosAction, const GOAL_BUF: usize, const RESULT_BUF: usize, const FEEDBACK_BUF: usize> FeedbackStream<'_, A, GOAL_BUF, RESULT_BUF, FEEDBACK_BUF>
impl<A: RosAction, const GOAL_BUF: usize, const RESULT_BUF: usize, const FEEDBACK_BUF: usize> FeedbackStream<'_, A, GOAL_BUF, RESULT_BUF, FEEDBACK_BUF>
Sourcepub async fn recv(&mut self) -> Option<Result<(GoalId, A::Feedback), NodeError>>
pub async fn recv(&mut self) -> Option<Result<(GoalId, A::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::Feedback)>, NodeError>
pub fn wait_next( &mut self, executor: &mut Executor, timeout: Duration, ) -> Result<Option<(GoalId, A::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.