pub struct Requester<Req, Rep> { /* private fields */ }Expand description
The client side of a service: sends requests of type Req and gets
the replies of type Rep to them (DDS-RPC 1.0, 7.8.1).
Implementations§
Source§impl<Req: TopicType + 'static, Rep: TopicType + 'static> Requester<Req, Rep>
impl<Req: TopicType + 'static, Rep: TopicType + 'static> Requester<Req, Rep>
Sourcepub fn new(participant: &DomainParticipant, service: &str) -> Result<Self>
pub fn new(participant: &DomainParticipant, service: &str) -> Result<Self>
A requester of the service service, on its default topics.
Sourcepub fn with_config(
participant: &DomainParticipant,
config: &RpcConfig,
) -> Result<Self>
pub fn with_config( participant: &DomainParticipant, config: &RpcConfig, ) -> Result<Self>
A requester made as config says.
Source§impl<Req, Rep> Requester<Req, Rep>where
Req: TopicType + BasicRequest + Clone + 'static,
Rep: TopicType + DescribeType + BasicReply + 'static,
impl<Req, Rep> Requester<Req, Rep>where
Req: TopicType + BasicRequest + Clone + 'static,
Rep: TopicType + DescribeType + BasicReply + 'static,
Sourcepub fn basic(
participant: &DomainParticipant,
config: &RpcConfig,
) -> Result<Self>
pub fn basic( participant: &DomainParticipant, config: &RpcConfig, ) -> Result<Self>
A requester of the Basic Service Mapping (DDS-RPC 1.0, 7.5.1.1)
made as config says: it writes the identity of each request in
its header, with the service_instance_name of config (empty
when None) as the instance name, and takes the replies whose
header names one of its requests, through a content filtered topic
of the reply topic (7.2.1) that its reader announces.
Source§impl<Req, Rep> Requester<Req, Rep>
impl<Req, Rep> Requester<Req, Rep>
Sourcepub fn with_topics(
participant: &DomainParticipant,
request: &Topic<Req>,
reply: &Topic<Rep>,
config: &RpcConfig,
) -> Result<Self>
pub fn with_topics( participant: &DomainParticipant, request: &Topic<Req>, reply: &Topic<Rep>, config: &RpcConfig, ) -> Result<Self>
A requester on the topics given, of any sample type (such as
DynamicData), with the QoS of config (its
topic names are not used).
Sourcepub fn request_datawriter(&self) -> &DataWriter<Req>
pub fn request_datawriter(&self) -> &DataWriter<Req>
The writer of the requests.
Sourcepub fn reply_datareader(&self) -> &DataReader<Rep>
pub fn reply_datareader(&self) -> &DataReader<Rep>
The reader of the replies.
Sourcepub fn is_service_matched(&self) -> bool
pub fn is_service_matched(&self) -> bool
Whether a replier is matched: a request reader matched by the request writer, and its reply writer matched by the reply reader (DDS-RPC 1.0, 7.6.2.2.2).
Sourcepub fn wait_for_service(&self, timeout: Duration) -> bool
pub fn wait_for_service(&self, timeout: Duration) -> bool
Waits until is_service_matched, or
timeout passes; returns whether it is.
Sourcepub fn send_request(&self, request: &Req) -> Result<SampleIdentity>
pub fn send_request(&self, request: &Req) -> Result<SampleIdentity>
Sends a request; returns its identity, which its replies name.
When a request reader of Cyclone DDS is matched, the request carries the in-payload header too.
Sourcepub fn take_replies(&self, request: &SampleIdentity) -> Result<Vec<Rep>>
pub fn take_replies(&self, request: &SampleIdentity) -> Result<Vec<Rep>>
Takes the replies come so far to the request request.
Sourcepub fn take_all_replies(&self) -> Result<Vec<(SampleIdentity, Rep)>>
pub fn take_all_replies(&self) -> Result<Vec<(SampleIdentity, Rep)>>
Takes the replies come so far to any request of this requester, with the request each answers.
Sourcepub fn receive_reply(
&self,
request: &SampleIdentity,
timeout: Duration,
) -> Result<Rep>
pub fn receive_reply( &self, request: &SampleIdentity, timeout: Duration, ) -> Result<Rep>
Waits for a reply to request and takes it; fails with
Error::Timeout when timeout passes first.