Struct ros2_client::Subscription
source · pub struct Subscription<M: DeserializeOwned> { /* private fields */ }
Expand description
A ROS2 Subscription
Corresponds to a (simplified) DataReader
in
DDS
Implementations§
source§impl<M: 'static + DeserializeOwned> Subscription<M>
impl<M: 'static + DeserializeOwned> Subscription<M>
pub fn take(&self) -> ReadResult<Option<(M, MessageInfo)>>
pub async fn async_take(&self) -> ReadResult<(M, MessageInfo)>
pub fn async_stream( &self ) -> impl Stream<Item = ReadResult<(M, MessageInfo)>> + FusedStream + '_
pub fn guid(&self) -> GUID
pub fn gid(&self) -> Gid
sourcepub fn get_publisher_count(&self, my_node: &Node) -> usize
pub fn get_publisher_count(&self, my_node: &Node) -> usize
Returns the count of currently matched Publishers.
my_node
must be the Node that created this Subscription, or the result
is undefined.
sourcepub async fn wait_for_publisher(&self, my_node: &Node)
pub async fn wait_for_publisher(&self, my_node: &Node)
Waits until there is at least one matched publisher on this topic, possibly forever.
my_node
must be the Node that created this Subscription, or the length
of the wait is undefined.
Trait Implementations§
Auto Trait Implementations§
impl<M> !RefUnwindSafe for Subscription<M>
impl<M> Send for Subscription<M>where
M: Send,
impl<M> Sync for Subscription<M>where
M: Sync,
impl<M> Unpin for Subscription<M>where
M: Unpin,
impl<M> !UnwindSafe for Subscription<M>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more