Skip to content

Commit ec4463a

Browse files
committed
merge dyn_msg feature into main codebase
Signed-off-by: Esteve Fernandez <[email protected]>
1 parent 9892e4b commit ec4463a

File tree

8 files changed

+7
-27
lines changed

8 files changed

+7
-27
lines changed

.github/workflows/rust-minimal.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
echo "Running clippy in $path"
102102
# Run clippy for all features except use_ros_shim (needed for docs.rs)
103103
if [ "$(basename $path)" = "rclrs" ]; then
104-
cargo clippy --no-deps --all-targets -F default,dyn_msg -- -D warnings
104+
cargo clippy --no-deps --all-targets -F default -- -D warnings
105105
else
106106
cargo clippy --no-deps --all-targets --all-features -- -D warnings
107107
fi
@@ -117,7 +117,7 @@ jobs:
117117
echo "Running cargo test in $path"
118118
# Run cargo test for all features except use_ros_shim (needed for docs.rs)
119119
if [ "$(basename $path)" = "rclrs" ]; then
120-
cargo test -F default,dyn_msg
120+
cargo test -F default
121121
elif [ "$(basename $path)" = "rosidl_runtime_rs" ]; then
122122
cargo test -F default
123123
else

.github/workflows/rust-stable.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
echo "Running clippy in $path"
102102
# Run clippy for all features except use_ros_shim (needed for docs.rs)
103103
if [ "$(basename $path)" = "rclrs" ]; then
104-
cargo clippy --no-deps --all-targets -F default,dyn_msg -- -D warnings
104+
cargo clippy --no-deps --all-targets -F default -- -D warnings
105105
else
106106
cargo clippy --no-deps --all-targets --all-features -- -D warnings
107107
fi
@@ -117,7 +117,7 @@ jobs:
117117
echo "Running cargo test in $path"
118118
# Run cargo test for all features except use_ros_shim (needed for docs.rs)
119119
if [ "$(basename $path)" = "rclrs" ]; then
120-
cargo test -F default,dyn_msg
120+
cargo test -F default
121121
elif [ "$(basename $path)" = "rosidl_runtime_rs" ]; then
122122
cargo test -F default
123123
else

.github/workflows/rust-win.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
cd %%B
7676
echo Running cargo test in %%B
7777
if /I "%%~nxB"=="rclrs" (
78-
cargo test -F default,dyn_msg
78+
cargo test -F default
7979
) else if /I "%%~nxB"=="rosidl_runtime_rs" (
8080
cargo test -F default
8181
) else (

rclrs/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ path = "src/lib.rs"
1515
# and also state why each dependency is needed.
1616
[dependencies]
1717
# Needed for dynamically finding type support libraries
18-
ament_rs = { version = "0.2", optional = true }
18+
ament_rs = { version = "0.2" }
1919

2020
# Needed for uploading documentation to docs.rs
2121
cfg-if = "1.0.0"
@@ -27,7 +27,7 @@ futures = "0.3"
2727
async-std = "1.13"
2828

2929
# Needed for dynamic messages
30-
libloading = { version = "0.8", optional = true }
30+
libloading = { version = "0.8" }
3131

3232
# Needed for the Message trait, among others
3333
rosidl_runtime_rs = "0.4"
@@ -54,7 +54,6 @@ cfg-if = "1.0.0"
5454

5555
[features]
5656
default = []
57-
dyn_msg = ["ament_rs", "libloading"]
5857
serde = ["dep:serde", "dep:serde-big-array", "rosidl_runtime_rs/serde"]
5958
# This feature is solely for the purpose of being able to generate documetation without a ROS installation
6059
# The only intended usage of this feature is for docs.rs builders to work, and is not intended to be used by end users

rclrs/src/error.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::{
44
fmt::{self, Display},
55
};
66

7-
#[cfg(feature = "dyn_msg")]
87
use crate::dynamic_message::DynamicMessageError;
98
use crate::{rcl_bindings::*, DeclarationError};
109

@@ -34,7 +33,6 @@ pub enum RclrsError {
3433
},
3534
/// It was attempted to add a waitable to a wait set twice.
3635
AlreadyAddedToWaitSet,
37-
#[cfg(feature = "dyn_msg")]
3836
/// An error while creating dynamic message.
3937
DynamicMessageError {
4038
/// The error containing more detailed information.
@@ -102,7 +100,6 @@ impl Display for RclrsError {
102100
"Could not add entity to wait set because it was already added to a wait set"
103101
)
104102
}
105-
#[cfg(feature = "dyn_msg")]
106103
RclrsError::DynamicMessageError { .. } => {
107104
write!(f, "Could not create dynamic message")
108105
}
@@ -134,7 +131,6 @@ impl Display for RclrsError {
134131
}
135132
}
136133

137-
#[cfg(feature = "dyn_msg")]
138134
impl From<DynamicMessageError> for RclrsError {
139135
fn from(err: DynamicMessageError) -> Self {
140136
Self::DynamicMessageError { err }
@@ -171,7 +167,6 @@ impl Error for RclrsError {
171167
// TODO(@mxgrey): We should provide source information for these other types.
172168
// It should be easy to do this using the thiserror crate.
173169
RclrsError::AlreadyAddedToWaitSet => None,
174-
#[cfg(feature = "dyn_msg")]
175170
RclrsError::DynamicMessageError { err } => Some(err).map(|e| e as &dyn Error),
176171
RclrsError::NegativeDuration(_) => None,
177172
RclrsError::UnownedGuardCondition => None,

rclrs/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,7 @@ mod test_helpers;
198198

199199
mod rcl_bindings;
200200

201-
#[cfg(feature = "dyn_msg")]
202201
pub mod dynamic_message;
203-
#[cfg(feature = "dyn_msg")]
204202
pub use dynamic_message::*;
205203

206204
pub use arguments::*;

rclrs/src/node.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ mod primitive_options;
55
pub use primitive_options::*;
66

77
mod graph;
8-
#[cfg(feature = "dyn_msg")]
98
use crate::{
109
dynamic_message::{
1110
DynamicMessage, DynamicPublisher, DynamicPublisherState, DynamicSubscription,
@@ -14,7 +13,6 @@ use crate::{
1413
},
1514
MessageInfo,
1615
};
17-
#[cfg(feature = "dyn_msg")]
1816
use futures::future::BoxFuture;
1917

2018
pub use graph::*;
@@ -424,7 +422,6 @@ impl NodeState {
424422
/// .keep_last(100)
425423
/// )
426424
/// .unwrap();
427-
#[cfg(feature = "dyn_msg")]
428425
pub fn create_dynamic_publisher<'a>(
429426
self: &Arc<Self>,
430427
topic_type: MessageTypeName,
@@ -862,7 +859,6 @@ impl NodeState {
862859
/// },
863860
/// );
864861
/// ```
865-
#[cfg(feature = "dyn_msg")]
866862
pub fn create_dynamic_subscription<'a, F>(
867863
&self,
868864
topic_type: MessageTypeName,
@@ -937,7 +933,6 @@ impl NodeState {
937933
/// )?;
938934
/// # Ok::<(), RclrsError>(())
939935
/// ```
940-
#[cfg(feature = "dyn_msg")]
941936
pub fn create_async_dynamic_subscription<'a, F>(
942937
&self,
943938
topic_type: MessageTypeName,

rclrs/src/worker.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#[cfg(feature = "dyn_msg")]
21
use crate::{
32
dynamic_message::{
43
DynamicMessage, DynamicSubscriptionState, MessageTypeName, WorkerDynamicSubscription,
@@ -311,7 +310,6 @@ impl<Payload: 'static + Send + Sync> WorkerState<Payload> {
311310
/// )?;
312311
/// # Ok::<(), RclrsError>(())
313312
/// ```
314-
#[cfg(feature = "dyn_msg")]
315313
pub fn create_dynamic_subscription<'a, F>(
316314
&self,
317315
topic_type: MessageTypeName,
@@ -577,7 +575,6 @@ mod tests {
577575
struct TestPayload {
578576
subscription_count: usize,
579577
service_count: usize,
580-
#[cfg(feature = "dyn_msg")]
581578
dynamic_subscription_count: usize,
582579
}
583580

@@ -593,7 +590,6 @@ mod tests {
593590
},
594591
);
595592

596-
#[cfg(feature = "dyn_msg")]
597593
let _count_dynamic_sub = worker.create_dynamic_subscription(
598594
"test_msgs/msg/Empty".try_into().unwrap(),
599595
"test_worker_topic",
@@ -612,14 +608,11 @@ mod tests {
612608

613609
let promise = worker.listen_until(move |payload| {
614610
if payload.service_count > 0 && payload.subscription_count > 0 {
615-
#[cfg(feature = "dyn_msg")]
616611
if payload.dynamic_subscription_count > 0 {
617612
Some(*payload)
618613
} else {
619614
None
620615
}
621-
#[cfg(not(feature = "dyn_msg"))]
622-
Some(*payload)
623616
} else {
624617
None
625618
}

0 commit comments

Comments
 (0)