Struct ros2_client::Subscription

source ·
pub struct Subscription<M> { /* private fields */ }
Expand description

A ROS2 Subscription

Corresponds to a (simplified) DataReader in DDS

Implementations§

source§

impl<M> Subscription<M>
where M: 'static,

source

pub fn take_seed<'de, S>(&self, seed: S) -> ReadResult<Option<(M, MessageInfo)>>
where S: DeserializeSeed<'de, Value = M> + Clone, M: 'static,

source

pub fn async_stream_seed<'a, 'de, S>( &'a self, seed: S ) -> impl FusedStream<Item = ReadResult<(M, MessageInfo)>> + 'a
where S: DeserializeSeed<'de, Value = M> + Clone + 'a, M: 'static,

source§

impl<M: 'static + DeserializeOwned> Subscription<M>

source

pub fn take(&self) -> ReadResult<Option<(M, MessageInfo)>>

source

pub async fn async_take(&self) -> ReadResult<(M, MessageInfo)>

source

pub fn async_stream( &self ) -> impl FusedStream<Item = ReadResult<(M, MessageInfo)>> + '_

source§

impl<M> Subscription<M>
where M: 'static,

source

pub fn guid(&self) -> GUID

source

pub fn gid(&self) -> Gid

source

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.

source

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§

source§

impl<D> Evented for Subscription<D>

source§

fn register( &self, poll: &Poll, token: Token, interest: Ready, opts: PollOpt ) -> Result<()>

Register self with the given Poll instance. Read more
source§

fn reregister( &self, poll: &Poll, token: Token, interest: Ready, opts: PollOpt ) -> Result<()>

Re-register self with the given Poll instance. Read more
source§

fn deregister(&self, poll: &Poll) -> Result<()>

Deregister self from the given Poll instance Read more

Auto Trait Implementations§

§

impl<M> !Freeze for Subscription<M>

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V