ros2-rust / ros2_rust

Rust bindings for ROS 2
Apache License 2.0
920 stars 126 forks source link

Idiomatic API for Rust #12

Open ruffsl opened 5 years ago

ruffsl commented 5 years ago

Rather than merely a wrapper around the rcl c library and types, what other ways can we make the rclrs API more Idiomatic to rust design patterns and style? How do we expect to expose error handling, logging, composition of nodes, etc. This is intentionally open ended, but please feel free to narrow in scope.

tprk77 commented 5 years ago

Can you give some specific examples of what you mean? It's not like the current API is using raw pointers and using int for error codes. It already seems pretty Rusty to me. For example, it's using structs, traits, results, etc.

esteve commented 5 years ago

One improvement I didn't have time to make was to tie the lifetime of Publishers and Subscriptions to Nodes, but beside that, I'd say the API is fairly idiomatic. Like @tprk77 asked, @ruffsl do you have a concrete example of where the API of rclrs is not idiomatic? Thanks.