Skip to content

Commit 2494b61

Browse files
mxgreyactions-user
authored andcommitted
Re-export traits from rosidl_runtime_rs (#537)
Signed-off-by: Michael X. Grey <greyxmike@gmail.com>
1 parent 43be4bf commit 2494b61

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

rclrs/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,5 @@ use time_source::*;
225225
pub use timer::*;
226226
pub use wait_set::*;
227227
pub use worker::*;
228+
229+
pub use rosidl_runtime_rs::{Message as MessageIDL, Service as ServiceIDL};

rclrs/src/service.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::{
55
sync::{Arc, Mutex, MutexGuard},
66
};
77

8-
use rosidl_runtime_rs::{Message, Service as IdlService};
8+
use rosidl_runtime_rs::{Message, Service as ServiceIDL};
99

1010
use crate::{
1111
error::ToResult, rcl_bindings::*, IntoPrimitiveOptions, MessageCow, Node, NodeHandle,
@@ -71,7 +71,7 @@ pub type WorkerService<T, Payload> = Arc<ServiceState<T, Worker<Payload>>>;
7171
/// [1]: std::sync::Weak
7272
pub struct ServiceState<T, Scope>
7373
where
74-
T: IdlService,
74+
T: ServiceIDL,
7575
Scope: WorkScope,
7676
{
7777
/// This handle is used to access the data that rcl holds for this service.
@@ -86,7 +86,7 @@ where
8686

8787
impl<T, Scope> ServiceState<T, Scope>
8888
where
89-
T: IdlService,
89+
T: ServiceIDL,
9090
Scope: WorkScope + 'static,
9191
{
9292
/// Returns the name of the service.
@@ -166,7 +166,7 @@ where
166166
}
167167
}
168168

169-
impl<T: IdlService> ServiceState<T, Node> {
169+
impl<T: ServiceIDL> ServiceState<T, Node> {
170170
/// Set the callback of this service, replacing the callback that was
171171
/// previously set.
172172
///
@@ -192,7 +192,7 @@ impl<T: IdlService> ServiceState<T, Node> {
192192
}
193193
}
194194

195-
impl<T: IdlService, Payload: 'static + Send + Sync> ServiceState<T, Worker<Payload>> {
195+
impl<T: ServiceIDL, Payload: 'static + Send + Sync> ServiceState<T, Worker<Payload>> {
196196
/// Set the callback of this service, replacing the callback that was
197197
/// previously set.
198198
///
@@ -238,15 +238,15 @@ impl<'a, T: IntoPrimitiveOptions<'a>> From<T> for ServiceOptions<'a> {
238238
}
239239
}
240240

241-
struct ServiceExecutable<T: IdlService, Scope: WorkScope> {
241+
struct ServiceExecutable<T: ServiceIDL, Scope: WorkScope> {
242242
handle: Arc<ServiceHandle>,
243243
callback: Arc<Mutex<AnyServiceCallback<T, Scope::Payload>>>,
244244
commands: Arc<WorkerCommands>,
245245
}
246246

247247
impl<T, Scope> RclPrimitive for ServiceExecutable<T, Scope>
248248
where
249-
T: IdlService,
249+
T: ServiceIDL,
250250
Scope: WorkScope,
251251
{
252252
unsafe fn execute(&mut self, payload: &mut dyn Any) -> Result<(), RclrsError> {
@@ -317,9 +317,9 @@ impl ServiceHandle {
317317
// | rmw_take |
318318
// +---------------------+
319319
// ```
320-
fn take_request<T: IdlService>(&self) -> Result<(T::Request, rmw_request_id_t), RclrsError> {
320+
fn take_request<T: ServiceIDL>(&self) -> Result<(T::Request, rmw_request_id_t), RclrsError> {
321321
let mut request_id_out = RequestId::zero_initialized_rmw();
322-
type RmwMsg<T> = <<T as IdlService>::Request as Message>::RmwMsg;
322+
type RmwMsg<T> = <<T as ServiceIDL>::Request as Message>::RmwMsg;
323323
let mut request_out = RmwMsg::<T>::default();
324324
let handle = &*self.lock();
325325
unsafe {
@@ -335,11 +335,11 @@ impl ServiceHandle {
335335
}
336336

337337
/// Same as [`Self::take_request`] but includes additional info about the service
338-
fn take_request_with_info<T: IdlService>(
338+
fn take_request_with_info<T: ServiceIDL>(
339339
&self,
340340
) -> Result<(T::Request, rmw_service_info_t), RclrsError> {
341341
let mut service_info_out = ServiceInfo::zero_initialized_rmw();
342-
type RmwMsg<T> = <<T as IdlService>::Request as Message>::RmwMsg;
342+
type RmwMsg<T> = <<T as ServiceIDL>::Request as Message>::RmwMsg;
343343
let mut request_out = RmwMsg::<T>::default();
344344
let handle = &*self.lock();
345345
unsafe {
@@ -354,7 +354,7 @@ impl ServiceHandle {
354354
Ok((T::Request::from_rmw_message(request_out), service_info_out))
355355
}
356356

357-
fn send_response<T: IdlService>(
357+
fn send_response<T: ServiceIDL>(
358358
self: &Arc<Self>,
359359
request_id: &mut rmw_request_id_t,
360360
response: T::Response,

rclrs/src/worker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
WorkerSubscription, WorkerTimer,
77
};
88
use futures::channel::oneshot;
9-
use rosidl_runtime_rs::{Message, Service as IdlService};
9+
use rosidl_runtime_rs::{Message, Service as ServiceIDL};
1010
use std::{
1111
any::Any,
1212
sync::{Arc, Mutex, Weak},
@@ -362,7 +362,7 @@ impl<Payload: 'static + Send + Sync> WorkerState<Payload> {
362362
callback: impl IntoWorkerServiceCallback<T, Payload, Args>,
363363
) -> Result<WorkerService<T, Payload>, RclrsError>
364364
where
365-
T: IdlService,
365+
T: ServiceIDL,
366366
{
367367
ServiceState::<T, Worker<Payload>>::create(
368368
options,

0 commit comments

Comments
 (0)