@@ -6,22 +6,28 @@ use std::os::raw::c_char;
6
6
7
7
/// Extract non-ROS arguments from program's input arguments.
8
8
///
9
- /// `args` is expected to be the input arguments of the program (passed via [`std::env::args()`]),
9
+ /// `args` is expected to be the input arguments of the program (e.g. [`std::env::args()`]),
10
10
/// which are expected to contain at least one element - the executable name.
11
- /// According to rcl documentation, ROS arguments are between `--ros-args` and `--` arguments.
12
- /// Everything else is considered as non-ROS and left unparsed. Extracted non-ROS args are
13
- /// returned in the order that they appear (see example below).
11
+ ///
12
+ /// ROS arguments are arguments between `--ros-args` and `--`, with the final `--` being optional.
13
+ /// Everything else is considered as non-ROS arguments and will be left unparsed by
14
+ /// [`Context::new()`][1] etc.
15
+ /// Extracted non-ROS arguments are returned in the order that they appear by this function.
14
16
///
15
17
/// # Example
16
18
/// ```
17
- /// let input_args : [String;6] = [
18
- /// "arg1", "--ros-args", "some", "args", "--", "arg2"
19
- /// ].map(|x| x.to_string());
20
- /// let non_ros_args = rclrs::extract_non_ros_args(input_args).unwrap();
19
+ /// # use rclrs::RclrsError;
20
+ /// let input_args = [
21
+ /// "arg1", "--ros-args", "some", "args", "--", "arg2"
22
+ /// ].map(|x| x.to_string());
23
+ /// let non_ros_args = rclrs::extract_non_ros_args(input_args)?;
21
24
/// assert_eq!(non_ros_args.len(), 2);
22
25
/// assert_eq!(non_ros_args[0], "arg1");
23
26
/// assert_eq!(non_ros_args[1], "arg2");
27
+ /// # Ok::<(), RclrsError>(())
24
28
/// ```
29
+ ///
30
+ /// [1]: crate::Context::new
25
31
pub fn extract_non_ros_args (
26
32
args : impl IntoIterator < Item = String > ,
27
33
) -> Result < Vec < String > , RclrsError > {
0 commit comments