rustdds/structure/
entity.rs

1use crate::structure::guid::{EntityId, GuidPrefix, GUID};
2
3/// Trait for things that have a [`GUID`].
4///
5/// Base class for all RTPS entities. RTPS Entity represents the class of
6/// objects that are visible to other RTPS Entities on the network. As such,
7/// RTPS Entity objects have a globally-unique identifier (GUID) and can be
8/// referenced inside RTPS messages.
9/// (for usage, DomainParticipant, DataReader and DataWriter implement this)
10/// RTPS 2.3 specification section 8.2.4
11pub trait RTPSEntity {
12  fn guid(&self) -> GUID;
13
14  fn entity_id(&self) -> EntityId {
15    self.guid().entity_id
16  }
17  fn guid_prefix(&self) -> GuidPrefix {
18    self.guid().prefix
19  }
20}