diff --git a/rclrs/src/context.rs b/rclrs/src/context.rs index ab55b11fe..4bd9dffd3 100644 --- a/rclrs/src/context.rs +++ b/rclrs/src/context.rs @@ -145,7 +145,7 @@ impl Context { /// It can be set through the `ROS_DOMAIN_ID` environment variable. /// /// [1]: https://docs.ros.org/en/rolling/Concepts/About-Domain-ID.html - pub fn domain_id(&self) -> u8 { + pub fn domain_id(&self) -> usize { let mut domain_id: usize = 0; let ret = unsafe { rcl_context_get_domain_id( @@ -155,7 +155,7 @@ impl Context { }; debug_assert_eq!(ret, 0); - domain_id as u8 + domain_id } /// Checks if the context is still valid. @@ -179,7 +179,7 @@ pub struct InitOptions { /// [ROS_DOMAIN_ID][1] environment variable. /// /// [1]: https://docs.ros.org/en/rolling/Concepts/Intermediate/About-Domain-ID.html#the-ros-domain-id - domain_id: Option, + domain_id: Option, } impl InitOptions { @@ -189,19 +189,19 @@ impl InitOptions { } /// Transform an InitOptions into a new one with a certain domain_id - pub fn with_domain_id(mut self, domain_id: Option) -> InitOptions { + pub fn with_domain_id(mut self, domain_id: Option) -> InitOptions { self.domain_id = domain_id; self } /// Set the domain_id of an InitOptions, or reset it to the default behavior /// (determined by environment variables) by providing None. - pub fn set_domain_id(&mut self, domain_id: Option) { + pub fn set_domain_id(&mut self, domain_id: Option) { self.domain_id = domain_id; } /// Get the domain_id that will be provided by these InitOptions. - pub fn domain_id(&self) -> Option { + pub fn domain_id(&self) -> Option { self.domain_id } diff --git a/rclrs/src/node/graph.rs b/rclrs/src/node/graph.rs index 01843ecb5..95b04cc42 100644 --- a/rclrs/src/node/graph.rs +++ b/rclrs/src/node/graph.rs @@ -462,7 +462,7 @@ mod tests { let domain_id: usize = std::env::var("ROS_DOMAIN_ID") .ok() .and_then(|value| value.parse().ok()) - .map(|value| { + .map(|value: usize| { if value == 99 { // The default domain ID for this application is 99, which // conflicts with our arbitrarily chosen default for the @@ -476,7 +476,8 @@ mod tests { .unwrap_or(99); let context = - Context::new_with_options([], InitOptions::new().with_domain_id(Some(domain_id))).unwrap(); + Context::new_with_options([], InitOptions::new().with_domain_id(Some(domain_id))) + .unwrap(); let node_name = "test_publisher_names_and_types"; let node = Node::new(&context, node_name).unwrap(); // Test that the graph has no publishers