From 885f4156d4278f392d25f7b7fc5be7cb15ce94af Mon Sep 17 00:00:00 2001 From: Milan Vukov Date: Mon, 25 Nov 2024 22:49:33 +0100 Subject: [PATCH] Add Publisher::can_loan_msgs (#434) * Add Publisher::can_loan_msgs * Fix formatting --- rclrs/src/publisher.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rclrs/src/publisher.rs b/rclrs/src/publisher.rs index 2935ca322..b1cdd93b9 100644 --- a/rclrs/src/publisher.rs +++ b/rclrs/src/publisher.rs @@ -229,6 +229,11 @@ where msg_ptr: msg_ptr as *mut T, }) } + + /// Returns true if message loans are possible, false otherwise. + pub fn can_loan_messages(&self) -> bool { + unsafe { rcl_publisher_can_loan_messages(&*self.handle.rcl_publisher.lock().unwrap()) } + } } /// Convenience trait for [`Publisher::publish`].