From bf861a6a2606c0351eaa518662c052d0d10b3daa Mon Sep 17 00:00:00 2001 From: "Michael X. Grey" Date: Thu, 9 Oct 2025 22:28:53 +0800 Subject: [PATCH] Re-export traits from rosidl_runtime_rs Signed-off-by: Michael X. Grey --- rclrs/src/lib.rs | 2 ++ rclrs/src/service.rs | 24 ++++++++++++------------ rclrs/src/worker.rs | 4 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/rclrs/src/lib.rs b/rclrs/src/lib.rs index 3952682a1..e7ae8bab1 100644 --- a/rclrs/src/lib.rs +++ b/rclrs/src/lib.rs @@ -223,3 +223,5 @@ pub use time::*; use time_source::*; pub use wait_set::*; pub use worker::*; + +pub use rosidl_runtime_rs::{Message as MessageIDL, Service as ServiceIDL}; diff --git a/rclrs/src/service.rs b/rclrs/src/service.rs index 4537d7b6e..52bfb6adb 100644 --- a/rclrs/src/service.rs +++ b/rclrs/src/service.rs @@ -5,7 +5,7 @@ use std::{ sync::{Arc, Mutex, MutexGuard}, }; -use rosidl_runtime_rs::{Message, Service as IdlService}; +use rosidl_runtime_rs::{Message, Service as ServiceIDL}; use crate::{ error::ToResult, rcl_bindings::*, IntoPrimitiveOptions, MessageCow, Node, NodeHandle, @@ -71,7 +71,7 @@ pub type WorkerService = Arc>>; /// [1]: std::sync::Weak pub struct ServiceState where - T: IdlService, + T: ServiceIDL, Scope: WorkScope, { /// This handle is used to access the data that rcl holds for this service. @@ -86,7 +86,7 @@ where impl ServiceState where - T: IdlService, + T: ServiceIDL, Scope: WorkScope + 'static, { /// Returns the name of the service. @@ -166,7 +166,7 @@ where } } -impl ServiceState { +impl ServiceState { /// Set the callback of this service, replacing the callback that was /// previously set. /// @@ -192,7 +192,7 @@ impl ServiceState { } } -impl ServiceState> { +impl ServiceState> { /// Set the callback of this service, replacing the callback that was /// previously set. /// @@ -238,7 +238,7 @@ impl<'a, T: IntoPrimitiveOptions<'a>> From for ServiceOptions<'a> { } } -struct ServiceExecutable { +struct ServiceExecutable { handle: Arc, callback: Arc>>, commands: Arc, @@ -246,7 +246,7 @@ struct ServiceExecutable { impl RclPrimitive for ServiceExecutable where - T: IdlService, + T: ServiceIDL, Scope: WorkScope, { unsafe fn execute(&mut self, payload: &mut dyn Any) -> Result<(), RclrsError> { @@ -317,9 +317,9 @@ impl ServiceHandle { // | rmw_take | // +---------------------+ // ``` - fn take_request(&self) -> Result<(T::Request, rmw_request_id_t), RclrsError> { + fn take_request(&self) -> Result<(T::Request, rmw_request_id_t), RclrsError> { let mut request_id_out = RequestId::zero_initialized_rmw(); - type RmwMsg = <::Request as Message>::RmwMsg; + type RmwMsg = <::Request as Message>::RmwMsg; let mut request_out = RmwMsg::::default(); let handle = &*self.lock(); unsafe { @@ -335,11 +335,11 @@ impl ServiceHandle { } /// Same as [`Self::take_request`] but includes additional info about the service - fn take_request_with_info( + fn take_request_with_info( &self, ) -> Result<(T::Request, rmw_service_info_t), RclrsError> { let mut service_info_out = ServiceInfo::zero_initialized_rmw(); - type RmwMsg = <::Request as Message>::RmwMsg; + type RmwMsg = <::Request as Message>::RmwMsg; let mut request_out = RmwMsg::::default(); let handle = &*self.lock(); unsafe { @@ -354,7 +354,7 @@ impl ServiceHandle { Ok((T::Request::from_rmw_message(request_out), service_info_out)) } - fn send_response( + fn send_response( self: &Arc, request_id: &mut rmw_request_id_t, response: T::Response, diff --git a/rclrs/src/worker.rs b/rclrs/src/worker.rs index 261240ec7..3ca459d58 100644 --- a/rclrs/src/worker.rs +++ b/rclrs/src/worker.rs @@ -4,7 +4,7 @@ use crate::{ WorkerCommands, WorkerService, WorkerSubscription, }; use futures::channel::oneshot; -use rosidl_runtime_rs::{Message, Service as IdlService}; +use rosidl_runtime_rs::{Message, Service as ServiceIDL}; use std::{ any::Any, sync::{Arc, Mutex, Weak}, @@ -360,7 +360,7 @@ impl WorkerState { callback: impl IntoWorkerServiceCallback, ) -> Result, RclrsError> where - T: IdlService, + T: ServiceIDL, { ServiceState::>::create( options,