Skip to content

Commit

Permalink
missed impls for call_service
Browse files Browse the repository at this point in the history
  • Loading branch information
carter committed Dec 17, 2024
1 parent 0769b61 commit d022e78
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions roslibrust_mock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ impl ServiceProvider for MockRos {
type ServiceClient<T: RosServiceType> = MockServiceClient<T>;
type ServiceServer = ();

async fn call_service<T: RosServiceType>(
&self,
topic: &str,
request: T::Request,
) -> RosLibRustResult<T::Response> {
let client = self.service_client::<T>(topic).await?;
client.call(&request).await
}

async fn service_client<T: RosServiceType + 'static>(
&self,
topic: &str,
Expand Down
10 changes: 10 additions & 0 deletions roslibrust_zenoh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ impl ServiceProvider for ZenohClient {
type ServiceClient<T: RosServiceType> = ZenohServiceClient<T>;
type ServiceServer = ZenohServiceServer;

async fn call_service<T: RosServiceType>(
&self,
topic: &str,
request: T::Request,
) -> RosLibRustResult<T::Response> {
// TODO should be able to optimize this...
let client = self.service_client::<T>(topic).await?;
client.call(&request).await
}

async fn service_client<T: RosServiceType + 'static>(
&self,
topic: &str,
Expand Down

0 comments on commit d022e78

Please sign in to comment.