Skip to content

Commit 5466525

Browse files
authored
Rename RMW-compatible to RMW-native (#159)
1 parent 836d0bb commit 5466525

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

rclrs_examples/src/message_demo.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn demonstrate_printing() {
7373
println!("{:?}", default_msg);
7474
println!("================== Pretty debug representation ===================");
7575
println!("{:#?}", default_msg);
76-
// The RMW-compatible message type has the same output
76+
// The RMW-native message type has the same output
7777
let default_rmw_msg = rclrs_example_msgs::msg::rmw::VariousTypes::default();
7878
assert_eq!(
7979
format!("{:?}", default_msg),
@@ -111,7 +111,7 @@ fn demonstrate_sequences() {
111111

112112
fn demonstrate_pubsub() -> Result<(), Error> {
113113
println!("================== Interoperability demo ==================");
114-
// Demonstrate interoperability between idiomatic and RMW-compatible message types
114+
// Demonstrate interoperability between idiomatic and RMW-native message types
115115
let context = rclrs::Context::new(env::args())?;
116116
let mut node = context.create_node("message_demo")?;
117117

@@ -135,13 +135,13 @@ fn demonstrate_pubsub() -> Result<(), Error> {
135135
"topic",
136136
rclrs::QOS_PROFILE_DEFAULT,
137137
move |_msg: rclrs_example_msgs::msg::rmw::VariousTypes| {
138-
println!("Got RMW-compatible message!")
138+
println!("Got RMW-native message!")
139139
},
140140
)?;
141141
println!("Sending idiomatic message.");
142142
idiomatic_publisher.publish(rclrs_example_msgs::msg::VariousTypes::default())?;
143143
rclrs::spin_once(&node, None)?;
144-
println!("Sending RMW-compatible message.");
144+
println!("Sending RMW-native message.");
145145
direct_publisher.publish(rclrs_example_msgs::msg::rmw::VariousTypes::default())?;
146146
rclrs::spin_once(&node, None)?;
147147

rosidl_runtime_rs/src/traits.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub trait SequenceAlloc: Sized {
3131
fn sequence_copy(in_seq: &crate::Sequence<Self>, out_seq: &mut crate::Sequence<Self>) -> bool;
3232
}
3333

34-
/// Trait for RMW-compatible messages.
34+
/// Trait for RMW-native messages.
3535
///
3636
/// See the documentation for the [`Message`] trait, which is the trait that should generally be
3737
/// used by user code.
@@ -46,22 +46,22 @@ pub trait RmwMessage: Clone + Debug + Default {
4646
///
4747
/// `rosidl_generator_rs` generates two types of messages that implement this trait:
4848
/// - An "idiomatic" message type, in the `${package_name}::msg` module
49-
/// - An "RMW-compatible" message type, in the `${package_name}::msg::rmw` module
49+
/// - An "RMW-native" message type, in the `${package_name}::msg::rmw` module
5050
///
5151
/// # Idiomatic message type
5252
/// The idiomatic message type aims to be familiar to Rust developers and ROS 2 developers coming
5353
/// from `rclcpp`.
5454
/// To this end, it translates the original ROS 2 message into a version that uses idiomatic Rust
5555
/// structs: [`std::vec::Vec`] for sequences and [`std::string::String`] for strings. All other
56-
/// fields are the same as in an RMW-compatible message.
56+
/// fields are the same as in an RMW-native message.
5757
///
5858
/// This conversion incurs some overhead when reading and publishing messages.
5959
///
60-
/// It's possible to use the idiomatic type for a publisher and the RMW-compatible type for a
60+
/// It's possible to use the idiomatic type for a publisher and the RMW-native type for a
6161
/// corresponding subscription, and vice versa.
6262
///
63-
/// # RMW-compatible message type
64-
/// The RMW-compatible message type aims to achieve higher performance by avoiding the conversion
63+
/// # RMW-native message type
64+
/// The RMW-native message type aims to achieve higher performance by avoiding the conversion
6565
/// step to an idiomatic message.
6666
///
6767
/// It uses the following type mapping:
@@ -88,7 +88,7 @@ pub trait RmwMessage: Clone + Debug + Default {
8888
/// iteration and all of the functionality of slices. However, it doesn't have an equivalent of
8989
/// [`Vec::push()`], among others.
9090
///
91-
/// ## What does "RMW-compatible" mean in detail?
91+
/// ## What does "RMW-native" mean in detail?
9292
/// The message can be directly passed to and from the RMW layer because (1) its layout is
9393
/// identical to the layout of the type generated by `rosidl_generator_c` and (2) the dynamic
9494
/// memory inside the message is owned by the C allocator.
@@ -127,19 +127,19 @@ pub trait RmwMessage: Clone + Debug + Default {
127127
/// The `Drop` impl for any sequence or string will call `fini()`.
128128
129129
pub trait Message: Clone + Debug + Default + 'static {
130-
/// The corresponding RMW-compatible message type.
130+
/// The corresponding RMW-native message type.
131131
type RmwMsg: RmwMessage;
132132

133-
/// Converts the idiomatic message into an RMW-compatible message.
133+
/// Converts the idiomatic message into an RMW-native message.
134134
///
135135
/// If the idiomatic message is owned, a slightly more efficient conversion is possible.
136136
/// This is why the function takes a `Cow`.
137137
///
138-
/// If this function receives a borrowed message that is already RMW-compatible, it should
138+
/// If this function receives a borrowed message that is already RMW-native, it should
139139
/// directly return that borrowed message.
140140
/// This is why the return type is also `Cow`.
141141
fn into_rmw_message(msg_cow: Cow<'_, Self>) -> Cow<'_, Self::RmwMsg>;
142142

143-
/// Converts the RMW-compatible message into an idiomatic message.
143+
/// Converts the RMW-native message into an idiomatic message.
144144
fn from_rmw_message(msg: Self::RmwMsg) -> Self;
145145
}

0 commit comments

Comments
 (0)