pub fn dispose(&self, key: <D as Keyed>::K, source_timestamp: Option<Timestamp>) -> Result<()> {
    /*

    Removing this for now, as there is need to redesign the mechanism of transmitting dispose actions
    to RTPS Writer. Then the RTPS writer needs to execute the dispose. That is done by sending a DATA
    submessage with the serialized key instead of data, and sending inline QoS parameter
    StatusInfo_t (see RTPS spec 9.6.3.4) to indicate "disposed"
    */

    let mut ddsdata = DDSData::from_dispose::<D>(key.clone(), source_timestamp);
    // TODO key value should be unique always. This is not always unique.
    // If sample with same values is given then hash is same for both samples.
    // TODO FIX THIS
    ddsdata.value_key_hash = key.into_hash_key();

    // What does this block of code do? What is the purpose of _data_sample?
    let _data_sample: DataSample<D> = match source_timestamp {
      Some(t) => DataSample::<D>::new_disposed::<<D as Keyed>::K>(t, key, self.get_guid()),
      None => DataSample::new_disposed::<<D as Keyed>::K>(Timestamp::now(), key, self.get_guid()),
    };

    match self
      .cc_upload
      .try_send(WriterCommand::DDSData { data: ddsdata })
    {
      Ok(_) => {
        self.refresh_manual_liveliness();
        Ok(())
      }
      Err(huh) => {
        warn!("Error: {:?}", huh);
        Err(Error::OutOfResources)
      }
    }
  }
/// Disposes data instance with specified key
///
/// # Arguments
///
/// * `key` - Key of the instance
/// * `source_timestamp` - DDS source timestamp (None uses now as time as specified in DDS spec)
///
/// # Examples
///
/// ```
/// # use serde::{Serialize, Deserialize};
/// # use rustdds::dds::DomainParticipant;
/// # use rustdds::dds::qos::QosPolicyBuilder;
/// # use rustdds::dds::data_types::TopicKind;
/// # use rustdds::dds::With_Key_DataWriter as DataWriter;
/// # use rustdds::dds::traits::Keyed;
/// # use rustdds::serialization::CDRSerializerAdapter;
/// #
/// let domain_participant = DomainParticipant::new(0);
/// let qos = QosPolicyBuilder::new().build();
/// let publisher = domain_participant.create_publisher(&qos).unwrap();
///
/// #[derive(Serialize, Deserialize)]
/// struct SomeType { a: i32, val: usize }
/// impl Keyed for SomeType {
///   type K = i32;
///
///   fn get_key(&self) -> Self::K {
///     self.a
///   }
/// }
///
/// // WithKey is important
/// let topic = domain_participant.create_topic("some_topic", "SomeType", &qos, TopicKind::WithKey).unwrap();
/// let data_writer = publisher.create_datawriter::<SomeType, CDRSerializerAdapter<_>>(None, topic, None).unwrap();
///
/// let some_data_1_1 = SomeType { a: 1, val: 3};
/// let some_data_1_2 = SomeType { a: 1, val: 4};
/// // different key
/// let some_data_2_1 = SomeType { a: 2, val: 5};
/// let some_data_2_2 = SomeType { a: 2, val: 6};
///
/// data_writer.write(some_data_1_1, None).unwrap();
/// data_writer.write(some_data_1_2, None).unwrap();
/// data_writer.write(some_data_2_1, None).unwrap();
/// data_writer.write(some_data_2_2, None).unwrap();
///
/// // disposes both some_data_1_1 and some_data_1_2. They are no longer offered by this writer to this topic.
/// data_writer.dispose(1, None).unwrap();
/// ```
Disposes data instance with specified key
Disposes data instance with specified key
pub fn dispose(&self, key: <D as Keyed>::K, source_timestamp: Option<Timestamp>) -> Result<()> {
    /*
    Removing this for now, as there is need to redesign the mechanism of transmitting dispose actions
    to RTPS Writer. Then the RTPS writer needs to execute the dispose. That is done by sending a DATA
    submessage with the serialized key instead of data, and sending inline QoS parameter
    StatusInfo_t (see RTPS spec 9.6.3.4) to indicate "disposed"
    */
    let mut ddsdata = DDSData::from_dispose::<D>(key.clone(), source_timestamp);
    // TODO key value should be unique always. This is not always unique.
    // If sample with same values is given then hash is same for both samples.
    // TODO FIX THIS
    ddsdata.value_key_hash = key.into_hash_key();
    // What does this block of code do? What is the purpose of _data_sample?
    let _data_sample: DataSample<D> = match source_timestamp {
      Some(t) => DataSample::<D>::new_disposed::<<D as Keyed>::K>(t, key, self.get_guid()),
      None => DataSample::new_disposed::<<D as Keyed>::K>(Timestamp::now(), key, self.get_guid()),
    };
    match self
      .cc_upload
      .try_send(WriterCommand::DDSData { data: ddsdata })
    {
      Ok(_) => {
        self.refresh_manual_liveliness();
        Ok(())
      }
      Err(huh) => {
        warn!("Error: {:?}", huh);
        Err(Error::OutOfResources)
      }
    }
  }
pub fn dispose ( & self , key : < D as Keyed > :: K , source_timestamp : Option < Timestamp > ) -> Result < ( ) > { /*

    Removing this for now, as there is need to redesign the mechanism of transmitting dispose actions
    to RTPS Writer. Then the RTPS writer needs to execute the dispose. That is done by sending a DATA
    submessage with the serialized key instead of data, and sending inline QoS parameter
    StatusInfo_t (see RTPS spec 9.6.3.4) to indicate "disposed"
    */ let mut ddsdata = DDSData :: from_dispose :: < D > ( key . clone ( ) , source_timestamp ) ; // TODO key value should be unique always. This is not always unique. // If sample with same values is given then hash is same for both samples. // TODO FIX THIS ddsdata . value_key_hash = key . into_hash_key ( ) ; // What does this block of code do? What is the purpose of _data_sample? let _data_sample : DataSample < D > = match source_timestamp { Some ( t ) => DataSample :: < D > :: new_disposed :: < < D as Keyed > :: K > ( t , key , self . get_guid ( ) ) , None => DataSample :: new_disposed :: < < D as Keyed > :: K > ( Timestamp :: now ( ) , key , self . get_guid ( ) ) , } ; match self . cc_upload . try_send ( WriterCommand :: DDSData { data : ddsdata } ) { Ok ( _ ) => { self . refresh_manual_liveliness ( ) ; Ok ( ( ) ) } Err ( huh ) => { warn ! ( " " huh ) ; Err ( Error :: OutOfResources ) } } }
Disposes data instance with specified key
Disposes data instance with specified key
&self
key
<D as Keyed>::K
source_timestamp
Option<Timestamp>
examples
None
use serde::{serialize, deserialize};
None
use rustdds::dds::domainparticipant;
None
use rustdds::dds::qos::qospolicybuilder;
None
use rustdds::dds::data_types::topickind;
None
use rustdds::dds::with_key_datawriter as datawriter;
None
use rustdds::dds::traits::keyed;
None
use rustdds::serialization::cdrserializeradapter;
let domain_participant = DomainParticipant::new(0);
let qos = QosPolicyBuilder::new().build();
let publisher = domain_participant.create_publisher(&qos).unwrap().
let domain_participant = DomainParticipant :: new ( 0 ) ; let qos = QosPolicyBuilder :: new () . build () ; let publisher = domain_participant . create_publisher ( &qos ) . unwrap () .
[derive(serialize, deserialize)]
struct SomeType { a: i32, val: usize }
impl Keyed for SomeType {
type K = i32.



WithKey is important
let topic = domain_participant.create_topic("some_topic", "SomeType", &qos, TopicKind::WithKey).unwrap();
let data_writer = publisher.create_datawriter::>(None, topic, None).unwrap().

let some_data_1_1 = SomeType { a: 1, val: 3};
let some_data_1_2 = SomeType { a: 1, val: 4};
different key
let some_data_2_1 = SomeType { a: 2, val: 5};
let some_data_2_2 = SomeType { a: 2, val: 6}.



disposes both some_data_1_1 and some_data_1_2. They are no longer offered by this writer to this topic.
data_writer.dispose(1, None).unwrap();
```
struct SomeType { a : i32 val : usize } impl Keyed for SomeType { type K = i32 . WithKey is important let topic = domain_participant . create_topic ( " some_topic " " SomeType " &qos TopicKind :: WithKey ) . unwrap () ; let data_writer = publisher . create_datawriter :: > ( None topic None ) . unwrap () . let some_data_1_1 = SomeType { a : 1 val : 3 } ; let some_data_1_2 = SomeType { a : 1 val : 4 } ; different key let some_data_2_1 = SomeType { a : 2 val : 5 } ; let some_data_2_2 = SomeType { a : 2 val : 6 } . disposes both some_data_1_1 and some_data_1_2 . They are no longer offered by this writer to this topic . data_writer . dispose ( 1 None ) . unwrap () ; ` ` `