use std::borrow::Cow;
use std::time::Duration;
use super::{NoCallback, PublisherBuilder, SubscriptionBuilder, TimerBuilder};
pub trait NodeBuilderExt {
fn publisher<'a, T>(&self, topic: impl Into<Cow<'a, str>>) -> PublisherBuilder<T>
where
T: rclrs::MessageIDL;
fn subscription<'a, T>(&self, topic: impl Into<Cow<'a, str>>) -> SubscriptionBuilder<T, NoCallback>
where
T: rclrs::MessageIDL;
fn timer_repeating(&self, period: Duration) -> TimerBuilder<NoCallback>;
}
impl NodeBuilderExt for rclrs::Node {
fn publisher<'a, T>(&self, topic: impl Into<Cow<'a, str>>) -> PublisherBuilder<T>
where
T: rclrs::MessageIDL,
{
PublisherBuilder::new(self.clone(), topic)
}
fn subscription<'a, T>(&self, topic: impl Into<Cow<'a, str>>) -> SubscriptionBuilder<T, NoCallback>
where
T: rclrs::MessageIDL,
{
SubscriptionBuilder::new(self.clone(), topic)
}
fn timer_repeating(&self, period: Duration) -> TimerBuilder<NoCallback> {
TimerBuilder::new(self.clone(), period)
}
}