pub struct EntityState { /* private fields */ }Expand description
Atomic container for the entity lifecycle.
Implementations§
Source§impl EntityState
impl EntityState
Sourcepub fn new() -> Arc<Self> ⓘ
pub fn new() -> Arc<Self> ⓘ
New state, initially disabled (spec default for all entities except DomainParticipantFactory).
Sourcepub fn new_enabled() -> Arc<Self> ⓘ
pub fn new_enabled() -> Arc<Self> ⓘ
New state, already enabled — for DomainParticipantFactory (Spec §2.2.2.1.4: the factory is always enabled).
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
True if the entity is enabled.
Sourcepub fn enable(&self) -> bool
pub fn enable(&self) -> bool
Sets enabled=true (idempotent). Returns true if the call
performed the false→true transition (for cascade logic).
Sourcepub fn instance_handle(&self) -> InstanceHandle
pub fn instance_handle(&self) -> InstanceHandle
Local 64-bit identifier of this entity.
Sourcepub fn status_changes(&self) -> StatusMask
pub fn status_changes(&self) -> StatusMask
Current status-changes mask. Reading does NOT clear — the
caller takes the relevant bits back itself via
Self::clear_status_changes.
Sourcepub fn set_status_bits(&self, bits: StatusMask)
pub fn set_status_bits(&self, bits: StatusMask)
Sets additional status bits (called by the discovery/runtime layer when a status event arrives).
Sourcepub fn clear_status_changes(&self, bits: StatusMask)
pub fn clear_status_changes(&self, bits: StatusMask)
Clears the given bits from the status-changes mask (after the caller’s read).
Sourcepub fn set_listener_mask(&self, mask: StatusMask)
pub fn set_listener_mask(&self, mask: StatusMask)
Set the listener mask — affects bubble-up.
Sourcepub fn listener_mask(&self) -> StatusMask
pub fn listener_mask(&self) -> StatusMask
Read the listener mask.
Sourcepub fn is_deleted(&self) -> bool
pub fn is_deleted(&self) -> bool
true if the entity has already gone through delete_*.
Sourcepub fn mark_deleted(&self) -> bool
pub fn mark_deleted(&self) -> bool
Marks the entity as deleted (idempotent). Returns true on the
first call (false→true transition), false on subsequent
calls.
Sourcepub fn check_not_deleted(&self) -> Result<()>
pub fn check_not_deleted(&self) -> Result<()>
Guard helper for public ops: returns Err(AlreadyDeleted) if
the entity has already been deleted, otherwise Ok(()).
Usage pattern:
pub fn write(&self, sample: T) -> Result<()> {
self.entity_state().check_not_deleted()?;
// ... the actual logic ...
}§Errors
DdsError::AlreadyDeleted if is_deleted() == true.
Sourcepub fn check_enabled(&self) -> Result<()>
pub fn check_enabled(&self) -> Result<()>
Guard helper: returns Err(NotEnabled) if the entity is not
enabled (Spec §2.2.2.1.1.7 RC NOT_ENABLED).
§Errors
DdsError::NotEnabled if is_enabled() == false.