Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rclrs/src/action/action_client/goal_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ impl<A: Action> GoalClient<A> {
/// # Example
///
/// ```
/// # #[cfg(doctest)]
/// # {
/// use rclrs::*;
/// use crate::rclrs::vendor::example_interfaces::action::Fibonacci;
/// use futures::StreamExt;
Expand All @@ -118,6 +120,7 @@ impl<A: Action> GoalClient<A> {
/// }
/// }
/// }
/// # }
/// ```
pub struct GoalClientStream<A: Action> {
stream_map: StreamMap<i32, Pin<Box<dyn Stream<Item = GoalEvent<A>> + Send>>>,
Expand Down
9 changes: 9 additions & 0 deletions rclrs/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ where
/// Define an `async fn` whose arguments are compatible with one of the above
/// signatures and which returns a `()` (a.k.a. nothing).
/// ```
/// # #[cfg(doctest)]
/// # {
/// # use rclrs::*;
/// # use crate::rclrs::vendor::test_msgs;
/// # let node = Context::default()
Expand All @@ -176,6 +178,7 @@ where
/// let request = test_msgs::srv::Empty_Request::default();
/// let promise = client.call_then_async(&request, print_hello)?;
/// # Ok::<(), RclrsError>(())
/// # }
/// ```
///
/// ## 2. Function that returns an `async { ... }`
Expand All @@ -190,6 +193,8 @@ where
/// ### `fn`
///
/// ```
/// # #[cfg(doctest)]
/// # {
/// # use rclrs::*;
/// # use crate::rclrs::vendor::test_msgs;
/// # use std::future::Future;
Expand All @@ -210,6 +215,7 @@ where
/// &request,
/// print_greeting)?;
/// # Ok::<(), RclrsError>(())
/// # }
/// ```
///
/// ### Closure
Expand All @@ -219,6 +225,8 @@ where
/// is also the most powerful option.
///
/// ```
/// # #[cfg(doctest)]
/// # {
/// # use rclrs::*;
/// # use crate::rclrs::vendor::test_msgs;
/// # let node = Context::default()
Expand All @@ -236,6 +244,7 @@ where
/// }
/// })?;
/// # Ok::<(), RclrsError>(())
/// # }
/// ```
pub fn call_then_async<'a, Req, Args>(
&self,
Expand Down
20 changes: 16 additions & 4 deletions rclrs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
//! [`Executor`], and then a [`Node`]. Create whatever primitives you need, and
//! then tell the [`Executor`] to spin:
//!
//! ```no_run
//! ```
//! # #[cfg(doctest)]
//! # {
//! use rclrs::*;
//! # use crate::rclrs::vendor::example_interfaces;
//!
Expand All @@ -47,13 +49,16 @@
//!
//! executor.spin(SpinOptions::default()).first_error()?;
//! # Ok::<(), RclrsError>(())
//! # }
//! ```
//!
//! If your callback needs to interact with some state data, consider using a
//! [`Worker`], especially if that state data needs to be shared with other
//! callbacks:
//!
//! ```no_run
//! ```
//! # #[cfg(doctest)]
//! # {
//! # use rclrs::*;
//! #
//! # let context = Context::default_from_env()?;
Expand Down Expand Up @@ -84,6 +89,7 @@
//!
//! # executor.spin(SpinOptions::default()).first_error()?;
//! # Ok::<(), RclrsError>(())
//! # }
//! ```
//!
//! # Parameters
Expand All @@ -97,7 +103,9 @@
//! - Read-only parameters do not allow you to modify them after they have been declared.
//!
//! The following is a simple example of using a mandatory parameter:
//! ```no_run
//! ```
//! # #[cfg(doctest)]
//! # {
//! use rclrs::*;
//! # use crate::rclrs::vendor::example_interfaces;
//! use std::sync::Arc;
Expand All @@ -119,6 +127,7 @@
//!
//! executor.spin(SpinOptions::default()).first_error()?;
//! # Ok::<(), RclrsError>(())
//! # }
//! ```
//!
//! # Logging
Expand All @@ -127,7 +136,9 @@
//! ergonomic Rust API. [`ToLogParams`] can be used to dictate how logging is
//! performed.
//!
//! ```no_run
//! ```
//! # #[cfg(doctest)]
//! # {
//! use rclrs::*;
//! # use crate::rclrs::vendor::example_interfaces;
//! use std::time::Duration;
Expand Down Expand Up @@ -176,6 +187,7 @@
//! );
//! executor.spin(SpinOptions::default()).first_error()?;
//! # Ok::<(), RclrsError>(())
//! # }
//! ```

mod action;
Expand Down
Loading
Loading