Skip to content

Commit 13fcc0d

Browse files
committed
make services FnMut
1 parent 5159d71 commit 13fcc0d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

rclrs/src/node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ impl Node {
270270
) -> Result<Arc<Service<T>>, RclrsError>
271271
where
272272
T: rosidl_runtime_rs::Service,
273-
F: Fn(&rmw_request_id_t, T::Request) -> T::Response + 'static + Send,
273+
F: FnMut(&rmw_request_id_t, T::Request) -> T::Response + 'static + Send,
274274
{
275275
let service = Arc::new(Service::<T>::new(
276276
Arc::clone(&self.rcl_node_mtx),

rclrs/src/service.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub trait ServiceBase: Send + Sync {
4747
}
4848

4949
type ServiceCallback<Request, Response> =
50-
Box<dyn Fn(&rmw_request_id_t, Request) -> Response + 'static + Send>;
50+
Box<dyn FnMut(&rmw_request_id_t, Request) -> Response + 'static + Send>;
5151

5252
/// Main class responsible for responding to requests sent by ROS clients.
5353
///
@@ -79,7 +79,7 @@ where
7979
// [`Node::create_service`], see the struct's documentation for the rationale
8080
where
8181
T: rosidl_runtime_rs::Service,
82-
F: Fn(&rmw_request_id_t, T::Request) -> T::Response + 'static + Send,
82+
F: FnMut(&rmw_request_id_t, T::Request) -> T::Response + 'static + Send,
8383
{
8484
// SAFETY: Getting a zero-initialized value is always safe.
8585
let mut rcl_service = unsafe { rcl_get_zero_initialized_service() };

0 commit comments

Comments
 (0)