pub struct Publisher<T> where
T: MessageT, { /* private fields */ }
Expand description
Publisher
Implementations
sourceimpl<T> Publisher<T> where
T: MessageT,
impl<T> Publisher<T> where
T: MessageT,
sourcepub fn publish(&self, message: &T) -> Result<()>
pub fn publish(&self, message: &T) -> Result<()>
Publish a message.
Examples
use rclrust_msg::std_msgs::msg::Int32;
let publisher = node.create_publisher::<Int32>("message", &QoSProfile::default())?;
publisher.publish(&Int32 { data: 42 })?;
sourcepub fn topic_name(&self) -> Option<String>
pub fn topic_name(&self) -> Option<String>
Get the topic name which this publisher publishes on.
Examples
let publisher = node.create_publisher::<Int32>("message", &QoSProfile::default())?;
assert_eq!(&publisher.topic_name().unwrap(), "/message");
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Check if this publisher is valid or not. Normally, a return value should be true
.
Examples
let publisher = node.create_publisher::<Int32>("message", &QoSProfile::default())?;
assert!(publisher.is_valid());
sourcepub fn subscription_count(&self) -> Result<usize>
pub fn subscription_count(&self) -> Result<usize>
Get how many subscriber are subscribing the topic which this publisher publishes on.
Examples
let publisher = node.create_publisher::<Int32>("message", &QoSProfile::default())?;
println!("{}", publisher.subscription_count()?);
sourcepub fn actual_qos(&self) -> Option<QoSProfile>
pub fn actual_qos(&self) -> Option<QoSProfile>
Get the actual QoS settings, after the defaults have been determined.
Examples
let publisher = node.create_publisher::<Int32>("message", &QoSProfile::default())?;
println!("{:?}", publisher.actual_qos().unwrap());
Auto Trait Implementations
impl<T> RefUnwindSafe for Publisher<T> where
T: RefUnwindSafe,
impl<T> Send for Publisher<T>
impl<T> Sync for Publisher<T>
impl<T> Unpin for Publisher<T> where
T: Unpin,
impl<T> UnwindSafe for Publisher<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more