pub struct DataReader<T>where
T: DdsType,{ /* private fields */ }Expand description
Typed DataReader — entnimmt Samples, die der RTPS-Reader fuer das Topic empfangen hat.
Live-Mode: rx: Some liefert Samples aus der Runtime-mpsc.
Offline-Mode: in-memory inbox fuer Unit-Tests.
Implementations§
Source§impl<T> DataReader<T>where
T: DdsType,
impl<T> DataReader<T>where
T: DdsType,
Sourcepub fn with_filter<F>(self, filter: F) -> DataReader<T>
pub fn with_filter<F>(self, filter: F) -> DataReader<T>
Setzt einen Content-Filter, der auf jedem Sample im take()-
Pfad evaluiert wird. Rueckgabe false verwirft das Sample.
Builder-Stil: reader.with_filter(|s| s.value > 0).
.7a — SQL-Expression-Syntax via set_filter_expression
folgt in .
Sourcepub fn subscription_handle(&self) -> InstanceHandle
pub fn subscription_handle(&self) -> InstanceHandle
Spec §2.2.2.5.3.6 / §2.2.2.1.1 — InstanceHandle dieses
DataReaders. Stabile Identitaet fuer
DomainParticipant::contains_entity.
Sourcepub fn set_listener(
&self,
listener: Option<Arc<dyn DataReaderListener>>,
mask: u32,
)
pub fn set_listener( &self, listener: Option<Arc<dyn DataReaderListener>>, mask: u32, )
setzt den DataReaderListener + StatusMask. None
loescht den Slot. Spec §2.2.2.5.7.x set_listener.
Sourcepub fn get_listener(&self) -> Option<Arc<dyn DataReaderListener>>
pub fn get_listener(&self) -> Option<Arc<dyn DataReaderListener>>
aktueller Listener-Klon, sofern vorhanden.
Sourcepub fn qos(&self) -> DataReaderQos
pub fn qos(&self) -> DataReaderQos
Aktuelle QoS (cloned, .1).
Sourcepub fn take(&self) -> Result<Vec<T>, DdsError>
pub fn take(&self) -> Result<Vec<T>, DdsError>
Nimmt alle zwischengespeicherten Samples und entfernt sie aus der Inbox. Liefert leeren Vec wenn nichts da ist.
§Errors
WireErrorwenn ein gespeicherter Payload sich nicht mehr decoden laesst (type-eval mismatch).
Sourcepub fn read(&self) -> Result<Vec<T>, DdsError>
pub fn read(&self) -> Result<Vec<T>, DdsError>
Liest alle Samples ohne sie zu entfernen. aktuell identisch
zu take minus entfernen. Sample-State (ReadCondition
§2.2.2.5.8) folgt im Wire-Up.
§Errors
Wie take.
Sourcepub fn matched_publication_count(&self) -> usize
pub fn matched_publication_count(&self) -> usize
Anzahl matched Remote-Writer. Im Offline-Mode immer 0.
Spec: OMG DDS 1.4 §2.2.2.5.3.15 get_matched_publications.
Seiteneffekt — bei einer Aenderung des Matched-Count
gegenueber dem letzten Aufruf wird on_subscription_matched
via Bubble-Up-Kette gefeuert (Spec §2.2.4.2.6.7).
Sourcepub fn wait_for_matched_publication(
&self,
min_count: usize,
timeout: Duration,
) -> Result<(), DdsError>
pub fn wait_for_matched_publication( &self, min_count: usize, timeout: Duration, ) -> Result<(), DdsError>
Blockiert, bis mindestens min_count Remote-Writer matched
sind oder timeout verstreicht. Event-driven via Runtime-Condvar
(D.5e Phase-1) — wakup direkt wenn SEDP einen Match propagiert,
kein 20-ms-Polling mehr.
§Errors
DdsError::Timeout wenn min_count im Zeitfenster nicht
erreicht wird.
Sourcepub fn requested_deadline_missed_count(&self) -> u64
pub fn requested_deadline_missed_count(&self) -> u64
Counter fuer requested-Deadline-Verletzungen (Spec
§2.2.4.2.11 REQUESTED_DEADLINE_MISSED_STATUS). Monoton steigend;
steigt um 1 pro abgelaufenem Deadline-Fenster ohne empfangenes
Sample. Offline / INFINITE → 0.
feuert ggf. on_requested_deadline_missed.
Sourcepub fn requested_incompatible_qos_status(
&self,
) -> RequestedIncompatibleQosStatus
pub fn requested_incompatible_qos_status( &self, ) -> RequestedIncompatibleQosStatus
aktueller RequestedIncompatibleQosStatus. Spec
§2.2.4.2.6.5. Triggert ggf. on_requested_incompatible_qos.
Sourcepub fn sample_lost_count(&self) -> u64
pub fn sample_lost_count(&self) -> u64
SampleLost-Counter. Spec §2.2.4.2.6.2.
Sourcepub fn sample_rejected_status(&self) -> SampleRejectedStatus
pub fn sample_rejected_status(&self) -> SampleRejectedStatus
SampleRejected-Status. Spec §2.2.4.2.6.3.
Sourcepub fn drive_listeners(&self)
pub fn drive_listeners(&self)
pollt alle Reader-Statuses einmal und feuert pending Listener. Convenience-Helper fuer Tests + periodische Tick-Aufrufer.
Sourcepub fn liveliness_changed_status(&self) -> (bool, u64, u64)
pub fn liveliness_changed_status(&self) -> (bool, u64, u64)
Liveliness-Status des matched Writers (Spec §2.2.4.2.14
LIVELINESS_CHANGED_STATUS): (alive, alive_count, not_alive_count).
alive: aktueller Zustand (true = Writer hat Sample innerhalb seiner Lease-Duration geliefert).alive_count: Zaehler der “not_alive → alive”-Transitions.not_alive_count: Zaehler der “alive → not_alive”-Transitions.
Offline / INFINITE-Lease → (false, 0, 0) / (true, 0, 0) je
nach Init. Fuer v1.3 wird nur LivelinessKind::Automatic ueberwacht.
Sourcepub fn wait_for_data(&self, timeout: Duration) -> Result<(), DdsError>
pub fn wait_for_data(&self, timeout: Duration) -> Result<(), DdsError>
Blockiert, bis mindestens ein Sample verfuegbar ist oder der
Timeout abgelaufen ist. Das Sample wird dabei nicht entnommen —
es wird in einen Staging-Buffer gelegt, den der naechste take()
ausliest. Damit bleibt wait_for_data + take() der kanonische
Subscriber-Loop, statt busy-polling im Application-Code.
Spec-Analog: OMG DDS 1.4 §2.2.2.5.8 ReadCondition + WaitSet.
Diese API liefert die wichtigste Semantik (wake-on-data) ohne die
komplette WaitSet/Condition-Infrastruktur.
§Errors
DdsError::Timeout wenn im Zeitfenster nichts ankommt.
Sourcepub fn instance_tracker(&self) -> InstanceTracker
pub fn instance_tracker(&self) -> InstanceTracker
Liefert den aktuellen InstanceTracker (geteilt mit der
internen Buchhaltung). Hauptsaechlich fuer Tests / Inspection.
Sourcepub fn notify_writer_liveliness_lost(&self, writer_guid: [u8; 16]) -> usize
pub fn notify_writer_liveliness_lost(&self, writer_guid: [u8; 16]) -> usize
Spec §2.2.3.23 — Hook fuer “Writer X hat Liveliness verloren”. Macht zwei Dinge:
- clear OWNERSHIP=EXCLUSIVE-Owner fuer alle Instanzen, deren
Owner dieser Writer war (so dass der naechste Sample eines
anderen Writers via
should_accept_sample_under_exclusive_ownershipneu gewinnen kann); - liefert die Anzahl betroffener Instanzen zurueck.
Wird aus dem WLP-Pfad gerufen, sobald ein Writer-Lease abgelaufen
ist (siehe wlp::WlpEndpoint::lost_peers).
Sourcepub fn notify_participant_liveliness_lost(&self, prefix: [u8; 12]) -> usize
pub fn notify_participant_liveliness_lost(&self, prefix: [u8; 12]) -> usize
Wie Self::notify_writer_liveliness_lost, aber Match nur ueber
die ersten 12 Bytes (GuidPrefix). Erlaubt Failover, wenn nur die
Participant-Identitaet (z.B. bei SPDP-Lease-Expiry) bekannt ist.
Sourcepub fn lookup_instance(&self, instance: &T) -> InstanceHandle
pub fn lookup_instance(&self, instance: &T) -> InstanceHandle
Macht aus einem Sample-Wert den dazugehoerigen lokalen
InstanceHandle, oder HANDLE_NIL wenn unbekannt /
non-keyed. Spec §2.2.2.5.3.26 lookup_instance (Reader-Variante).
Sourcepub fn get_key_value(&self, handle: InstanceHandle) -> Result<T, DdsError>
pub fn get_key_value(&self, handle: InstanceHandle) -> Result<T, DdsError>
Spec §2.2.2.5.3.25 get_key_value. Liefert den Sample-Wert mit
nur den @key-Feldern befuellt (rekonstruiert aus dem
gespeicherten Key-Holder via T::decode).
§Errors
BadParameter wenn handle unbekannt; WireError wenn
T::decode den Key-Stream nicht rekonstruieren kann.
Sourcepub fn take_with_info(&self) -> Result<Vec<Sample<T>>, DdsError>
pub fn take_with_info(&self) -> Result<Vec<Sample<T>>, DdsError>
take mit voller SampleInfo. Spec §2.2.2.5.3.5
take. Konsumiert die Samples aus dem Cache (NOT_READ → READ-
Transition entfaellt, weil sie weg sind).
§Errors
Wie Self::take.
Sourcepub fn read_with_info(&self) -> Result<Vec<Sample<T>>, DdsError>
pub fn read_with_info(&self) -> Result<Vec<Sample<T>>, DdsError>
read mit voller SampleInfo. Konsumiert nicht — markiert
die Samples nur als READ (Spec §2.2.2.5.3.4).
§Errors
Wie Self::read.
Sourcepub fn take_filtered(
&self,
sample_mask: u32,
view_mask: u32,
instance_mask: u32,
) -> Result<Vec<Sample<T>>, DdsError>
pub fn take_filtered( &self, sample_mask: u32, view_mask: u32, instance_mask: u32, ) -> Result<Vec<Sample<T>>, DdsError>
Sourcepub fn read_filtered(
&self,
sample_mask: u32,
view_mask: u32,
instance_mask: u32,
) -> Result<Vec<Sample<T>>, DdsError>
pub fn read_filtered( &self, sample_mask: u32, view_mask: u32, instance_mask: u32, ) -> Result<Vec<Sample<T>>, DdsError>
Sourcepub fn read_w_condition(
&self,
condition: &Arc<QueryCondition>,
) -> Result<Vec<Sample<T>>, DdsError>
pub fn read_w_condition( &self, condition: &Arc<QueryCondition>, ) -> Result<Vec<Sample<T>>, DdsError>
read_w_condition (Spec §2.2.2.5.3.7) — wendet zusaetzlich zur
State-Mask den SQL-Filter der QueryCondition pro Sample an.
Samples bleiben im Cache (Sample-State NOT_READ → READ).
§Errors
PreconditionNotMet bei Lock-Poisoning oder SQL-Eval-Fehler.
Sourcepub fn take_w_condition(
&self,
condition: &Arc<QueryCondition>,
) -> Result<Vec<Sample<T>>, DdsError>
pub fn take_w_condition( &self, condition: &Arc<QueryCondition>, ) -> Result<Vec<Sample<T>>, DdsError>
take_w_condition (Spec §2.2.2.5.3.8) — wie read_w_condition,
aber konsumiert die Samples (entfernt aus dem Cache).
§Errors
PreconditionNotMet bei Lock-Poisoning oder SQL-Eval-Fehler.
Sourcepub fn read_instance(
&self,
handle: InstanceHandle,
) -> Result<Vec<Sample<T>>, DdsError>
pub fn read_instance( &self, handle: InstanceHandle, ) -> Result<Vec<Sample<T>>, DdsError>
read_instance (Spec §2.2.2.5.3.27). Liefert nur Samples der
angegebenen Instanz.
§Errors
BadParameter wenn handle == HANDLE_NIL.
Sourcepub fn take_instance(
&self,
handle: InstanceHandle,
) -> Result<Vec<Sample<T>>, DdsError>
pub fn take_instance( &self, handle: InstanceHandle, ) -> Result<Vec<Sample<T>>, DdsError>
take_instance (Spec §2.2.2.5.3.27, Take-Variante). Konsumiert.
§Errors
BadParameter wenn handle == HANDLE_NIL.
Sourcepub fn read_next_instance(
&self,
previous: InstanceHandle,
) -> Result<Vec<Sample<T>>, DdsError>
pub fn read_next_instance( &self, previous: InstanceHandle, ) -> Result<Vec<Sample<T>>, DdsError>
read_next_instance (Spec §2.2.2.5.3.28). Liefert die Samples
der naechsten Instanz (nach Sortier-Ordnung) hinter
previous.
previous == HANDLE_NIL startet beim ersten Handle.
§Errors
Wie read.
Sourcepub fn take_next_instance(
&self,
previous: InstanceHandle,
) -> Result<Vec<Sample<T>>, DdsError>
pub fn take_next_instance( &self, previous: InstanceHandle, ) -> Result<Vec<Sample<T>>, DdsError>
Trait Implementations§
Source§impl<T> Debug for DataReader<T>where
T: DdsType,
impl<T> Debug for DataReader<T>where
T: DdsType,
Source§impl<T> Entity for DataReader<T>where
T: DdsType,
Available on crate feature std only.
impl<T> Entity for DataReader<T>where
T: DdsType,
std only.Source§fn set_qos(&self, qos: <DataReader<T> as Entity>::Qos) -> Result<(), DdsError>
fn set_qos(&self, qos: <DataReader<T> as Entity>::Qos) -> Result<(), DdsError>
Spec §2.2.3 / §2.2.2.5.3: DURABILITY, RELIABILITY, HISTORY, RESOURCE_LIMITS, OWNERSHIP sind Changeable=NO post-enable.
Source§type Qos = DataReaderQos
type Qos = DataReaderQos
DomainParticipantQos,
DataWriterQos, …).Source§fn get_qos(&self) -> <DataReader<T> as Entity>::Qos
fn get_qos(&self) -> <DataReader<T> as Entity>::Qos
get_qos.Source§fn enable(&self) -> Result<(), DdsError>
fn enable(&self) -> Result<(), DdsError>
enable. Read moreSource§fn entity_state(&self) -> Arc<EntityState>
fn entity_state(&self) -> Arc<EntityState>
Arc<EntityState>.Source§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Source§fn get_status_condition(&self) -> StatusCondition
fn get_status_condition(&self) -> StatusCondition
StatusCondition dieser Entity.
Spec §2.2.2.1.6 get_status_condition.Source§fn get_status_changes(&self) -> u32
fn get_status_changes(&self) -> u32
get_status_changes.Source§fn get_instance_handle(&self) -> InstanceHandle
fn get_instance_handle(&self) -> InstanceHandle
get_instance_handle.