Skip to main content

EntityState

Struct EntityState 

Source
pub struct EntityState { /* private fields */ }
Expand description

Atomic container for the entity lifecycle.

Implementations§

Source§

impl EntityState

Source

pub fn new() -> Arc<Self>

New state, initially disabled (spec default for all entities except DomainParticipantFactory).

Source

pub fn new_enabled() -> Arc<Self>

New state, already enabled — for DomainParticipantFactory (Spec §2.2.2.1.4: the factory is always enabled).

Source

pub fn is_enabled(&self) -> bool

True if the entity is enabled.

Source

pub fn enable(&self) -> bool

Sets enabled=true (idempotent). Returns true if the call performed the false→true transition (for cascade logic).

Source

pub fn instance_handle(&self) -> InstanceHandle

Local 64-bit identifier of this entity.

Source

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.

Source

pub fn set_status_bits(&self, bits: StatusMask)

Sets additional status bits (called by the discovery/runtime layer when a status event arrives).

Source

pub fn clear_status_changes(&self, bits: StatusMask)

Clears the given bits from the status-changes mask (after the caller’s read).

Source

pub fn set_listener_mask(&self, mask: StatusMask)

Set the listener mask — affects bubble-up.

Source

pub fn listener_mask(&self) -> StatusMask

Read the listener mask.

Source

pub fn is_deleted(&self) -> bool

true if the entity has already gone through delete_*.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for EntityState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.