@@ -64,20 +64,19 @@ impl NodeBuilder {
64
64
///
65
65
/// # Example
66
66
/// ```
67
- /// # use rclrs::{Context, NodeBuilder, RclrsError, RclReturnCode, NodeErrorCode };
67
+ /// # use rclrs::{Context, NodeBuilder, RclrsError, RclReturnCode};
68
68
/// let context = Context::new([])?;
69
69
/// // This is a valid node name
70
70
/// assert!(NodeBuilder::new(&context, "my_node").build().is_ok());
71
71
/// // This is another valid node name (although not a good one)
72
72
/// assert!(NodeBuilder::new(&context, "_______").build().is_ok());
73
73
/// // This is an invalid node name
74
- /// assert_eq !(
74
+ /// assert!(matches !(
75
75
/// NodeBuilder::new(&context, "röböt")
76
76
/// .build()
77
- /// .unwrap_err()
78
- /// .code,
79
- /// RclReturnCode::NodeError(NodeErrorCode::NodeInvalidName)
80
- /// );
77
+ /// .unwrap_err(),
78
+ /// RclrsError::RclError { code: RclReturnCode::NodeInvalidName, .. }
79
+ /// ));
81
80
/// # Ok::<(), RclrsError>(())
82
81
/// ```
83
82
///
@@ -116,20 +115,19 @@ impl NodeBuilder {
116
115
///
117
116
/// # Example
118
117
/// ```
119
- /// # use rclrs::{Context, Node, RclrsError, RclReturnCode, NodeErrorCode };
118
+ /// # use rclrs::{Context, Node, RclrsError, RclReturnCode};
120
119
/// let context = Context::new([])?;
121
120
/// // This is a valid namespace
122
121
/// let builder_ok_ns = Node::builder(&context, "my_node").namespace("/some/nested/namespace");
123
122
/// assert!(builder_ok_ns.build().is_ok());
124
123
/// // This is an invalid namespace
125
- /// assert_eq !(
124
+ /// assert!(matches !(
126
125
/// Node::builder(&context, "my_node")
127
126
/// .namespace("/10_percent_luck/20_percent_skill")
128
127
/// .build()
129
- /// .unwrap_err()
130
- /// .code,
131
- /// RclReturnCode::NodeError(NodeErrorCode::NodeInvalidNamespace)
132
- /// );
128
+ /// .unwrap_err(),
129
+ /// RclrsError::RclError { code: RclReturnCode::NodeInvalidNamespace, .. }
130
+ /// ));
133
131
/// // A missing forward slash at the beginning is automatically added
134
132
/// assert_eq!(
135
133
/// Node::builder(&context, "my_node")
@@ -243,7 +241,7 @@ impl NodeBuilder {
243
241
err,
244
242
s : self . namespace . clone ( ) ,
245
243
} ) ?;
246
- let node_options = self . create_node_options ( ) ?;
244
+ let rcl_node_options = self . create_rcl_node_options ( ) ?;
247
245
let rcl_context = & mut * self . context . lock ( ) ;
248
246
249
247
// SAFETY: Getting a zero-initialized value is always safe.
@@ -258,7 +256,7 @@ impl NodeBuilder {
258
256
node_name. as_ptr ( ) ,
259
257
node_namespace. as_ptr ( ) ,
260
258
rcl_context,
261
- & node_options ,
259
+ & rcl_node_options ,
262
260
)
263
261
. ok ( ) ?;
264
262
} ;
@@ -278,9 +276,9 @@ impl NodeBuilder {
278
276
/// For detail about default values, see [`NodeBuilder`][1] docs.
279
277
///
280
278
/// [1]: crate::NodeBuilder
281
- fn create_node_options ( & self ) -> Result < rcl_node_options_t , RclrsError > {
279
+ fn create_rcl_node_options ( & self ) -> Result < rcl_node_options_t , RclrsError > {
282
280
// SAFETY: No preconditions for this function.
283
- let mut node_options = unsafe { rcl_node_get_default_options ( ) } ;
281
+ let mut rcl_node_options = unsafe { rcl_node_get_default_options ( ) } ;
284
282
285
283
let cstring_args = self
286
284
. arguments
@@ -299,17 +297,17 @@ impl NodeBuilder {
299
297
cstring_arg_ptrs. len ( ) as i32 ,
300
298
cstring_arg_ptrs. as_ptr ( ) ,
301
299
rcutils_get_default_allocator ( ) ,
302
- & mut node_options . arguments ,
300
+ & mut rcl_node_options . arguments ,
303
301
)
304
302
}
305
303
. ok ( ) ?;
306
304
307
- node_options . use_global_arguments = self . use_global_arguments ;
308
- node_options . enable_rosout = self . enable_rosout ;
305
+ rcl_node_options . use_global_arguments = self . use_global_arguments ;
306
+ rcl_node_options . enable_rosout = self . enable_rosout ;
309
307
// SAFETY: No preconditions for this function.
310
- node_options . allocator = unsafe { rcutils_get_default_allocator ( ) } ;
308
+ rcl_node_options . allocator = unsafe { rcutils_get_default_allocator ( ) } ;
311
309
312
- Ok ( node_options )
310
+ Ok ( rcl_node_options )
313
311
}
314
312
}
315
313
0 commit comments