Struct rustdds::dds::Subscriber[][src]

pub struct Subscriber { /* fields omitted */ }

DDS Subscriber

Examples

use rustdds::dds::Subscriber;

let domain_participant = DomainParticipant::new(0);
let qos = QosPolicyBuilder::new().build();

let subscriber = domain_participant.create_subscriber(&qos);

Implementations

impl Subscriber[src]

pub fn create_datareader<D: 'static, SA>(
    &self,
    topic: Topic,
    qos: Option<QosPolicies>
) -> Result<WithKeyDataReader<D, SA>> where
    D: DeserializeOwned + Keyed,
    <D as Keyed>::K: Key,
    SA: DeserializerAdapter<D>, 
[src]

Creates DDS DataReader for keyed Topics

Arguments

  • topic - Reference to the DDS Topic this reader reads from
  • entity_id - Optional EntityId if necessary for DDS communication (random if None)
  • qos - Not in use

Examples

use serde::Deserialize;
use rustdds::serialization::CDRDeserializerAdapter;
use rustdds::dds::data_types::TopicKind;
use rustdds::dds::traits::Keyed;

let subscriber = domain_participant.create_subscriber(&qos).unwrap();

#[derive(Deserialize)]
struct SomeType { a: i32 }
impl Keyed for SomeType {
  type K = i32;

  fn get_key(&self) -> Self::K {
    self.a
  }
}

let topic = domain_participant.create_topic("some_topic", "SomeType", &qos, TopicKind::WithKey).unwrap();
let data_reader = subscriber.create_datareader::<SomeType, CDRDeserializerAdapter<_>>(topic, None, None);

pub fn create_datareader_CDR<D: 'static>(
    &self,
    topic: Topic,
    qos: Option<QosPolicies>
) -> Result<WithKeyDataReader<D, CDRDeserializerAdapter<D>>> where
    D: DeserializeOwned + Keyed,
    <D as Keyed>::K: Key
[src]

pub fn create_datareader_no_key<D: 'static, SA>(
    &self,
    topic: Topic,
    entity_id: Option<EntityId>,
    qos: Option<QosPolicies>
) -> Result<NoKeyDataReader<D, SA>> where
    D: DeserializeOwned,
    SA: DeserializerAdapter<D>, 
[src]

Create DDS DataReader for non keyed Topics

Arguments

  • topic - Reference to the DDS Topic this reader reads from
  • entity_id - Optional EntityId if necessary for DDS communication (random if None)
  • qos - Not in use

Examples

use serde::Deserialize;
use rustdds::serialization::CDRDeserializerAdapter;
use rustdds::dds::data_types::TopicKind;

let subscriber = domain_participant.create_subscriber(&qos).unwrap();

#[derive(Deserialize)]
struct SomeType {}

let topic = domain_participant.create_topic("some_topic", "SomeType", &qos, TopicKind::NoKey).unwrap();
let data_reader = subscriber.create_datareader_no_key::<SomeType, CDRDeserializerAdapter<_>>(topic, None, None);

pub fn create_datareader_no_key_CDR<D: 'static>(
    &self,
    topic: Topic,
    entity_id: Option<EntityId>,
    qos: Option<QosPolicies>
) -> Result<NoKeyDataReader<D, CDRDeserializerAdapter<D>>> where
    D: DeserializeOwned
[src]

pub fn get_participant(&self) -> Option<DomainParticipant>[src]

Returns DomainParticipant if it is sill alive.

Example

let domain_participant = DomainParticipant::new(0);
let qos = QosPolicyBuilder::new().build();

let subscriber = domain_participant.create_subscriber(&qos).unwrap();
assert_eq!(domain_participant, subscriber.get_participant().unwrap());

Trait Implementations

impl Clone for Subscriber[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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