Struct rustdds::dds::Publisher[][src]

pub struct Publisher { /* fields omitted */ }
Expand description

DDS Publisher

Examples

use rustdds::dds::Publisher;

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

let publisher = domain_participant.create_publisher(&qos);

Implementations

Creates DDS DataWriter for Keyed topic

Arguments

  • entity_id - Custom entity id if necessary for the user to define it
  • topic - Reference to DDS Topic this writer is created to
  • qos - Not currently in use

Examples

use rustdds::dds::traits::Keyed;
use rustdds::serialization::CDRSerializerAdapter;
use serde::Serialize;

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

let publisher = domain_participant.create_publisher(&qos).unwrap();

#[derive(Serialize)]
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_writer = publisher.create_datawriter::<SomeType, CDRSerializerAdapter<_>>(topic, None);

Shorthand for crate_datawriter with Commaon Data Representation Little Endian

Creates DDS DataWriter for Nokey Topic

Arguments

  • entity_id - Custom entity id if necessary for the user to define it
  • topic - Reference to DDS Topic this writer is created to
  • qos - QoS policies for this DataWriter

Examples

use rustdds::serialization::CDRSerializerAdapter;
use serde::Serialize;

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

let publisher = domain_participant.create_publisher(&qos).unwrap();

#[derive(Serialize)]
struct SomeType {}

let topic = domain_participant.create_topic("some_topic", "SomeType", &qos, TopicKind::WithKey).unwrap();
let data_writer = publisher.create_datawriter_no_key::<SomeType, CDRSerializerAdapter<_>>(topic, None);

Currently does nothing

Currently does nothing

Coherent set not implemented and currently does nothing

Coherent set not implemented and currently does nothing

Gets DomainParticipant if it has not disappeared from all scopes.

Example


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

let publisher = domain_participant.create_publisher(&qos).unwrap();
assert_eq!(domain_participant, publisher.get_participant().unwrap());

Returns default DataWriter qos. Currently default qos is not used.

Example

use rustdds::dds::qos::{QosPolicyBuilder};

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

let publisher = domain_participant.create_publisher(&qos).unwrap();
assert_eq!(qos, publisher.get_default_datawriter_qos());

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.