Skip to main content

Requester

Struct Requester 

Source
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>

Source

pub fn new(participant: &DomainParticipant, service: &str) -> Result<Self>

A requester of the service service, on its default topics.

Source

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,

Source

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>

Source

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).

Source

pub fn request_datawriter(&self) -> &DataWriter<Req>

The writer of the requests.

Source

pub fn reply_datareader(&self) -> &DataReader<Rep>

The reader of the replies.

Source

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).

Source

pub fn wait_for_service(&self, timeout: Duration) -> bool

Waits until is_service_matched, or timeout passes; returns whether it is.

Source

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.

Source

pub fn take_replies(&self, request: &SampleIdentity) -> Result<Vec<Rep>>

Takes the replies come so far to the request request.

Source

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.

Source

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.

Source

pub fn request(&self, request: &Req, timeout: Duration) -> Result<Rep>

Sends a request and waits for its first reply.

Trait Implementations§

Source§

impl<Req, Rep> Debug for Requester<Req, Rep>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Req, Rep> !Freeze for Requester<Req, Rep>

§

impl<Req, Rep> !RefUnwindSafe for Requester<Req, Rep>

§

impl<Req, Rep> !UnwindSafe for Requester<Req, Rep>

§

impl<Req, Rep> Forget for Requester<Req, Rep>

§

impl<Req, Rep> Move for Requester<Req, Rep>

§

impl<Req, Rep> Send for Requester<Req, Rep>
where Arc<Shared>: Send, Arc<dyn SampleType<Req>>: Send, Arc<LoanCheck>: Send, Arc<dyn SampleType<Rep>>: Send, Mutex<HashMap<SampleIdentity, Vec<Rep>>>: Send, Mutex<(i64, HashMap<i64, SampleIdentity>)>: Send, RawVecInner: Send, Mutex<()>: Send,

§

impl<Req, Rep> Sync for Requester<Req, Rep>
where Arc<Shared>: Sync, Arc<dyn SampleType<Req>>: Sync, Arc<LoanCheck>: Sync, Arc<dyn SampleType<Rep>>: Sync, Mutex<HashMap<SampleIdentity, Vec<Rep>>>: Sync, Mutex<(i64, HashMap<i64, SampleIdentity>)>: Sync, RawVecInner: Sync, Mutex<()>: Sync,

§

impl<Req, Rep> Unpin for Requester<Req, Rep>
where Rep: Unpin, Arc<Shared>: Unpin, Arc<dyn SampleType<Req>>: Unpin, Arc<LoanCheck>: Unpin, Arc<dyn SampleType<Rep>>: Unpin, Align4<u32>: Unpin, Align1<u8>: Unpin, *const u8 is !null: Unpin,

§

impl<Req, Rep> UnsafeUnpin for Requester<Req, Rep>
where *const ArcInner<Shared> is !null: UnsafeUnpin, PhantomData<ArcInner<Shared>>: UnsafeUnpin, *const ArcInner<dyn SampleType<Req>> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn SampleType<Req>>>: UnsafeUnpin, *const ArcInner<LoanCheck> is !null: UnsafeUnpin, PhantomData<ArcInner<LoanCheck>>: UnsafeUnpin, *const ArcInner<dyn SampleType<Rep>> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn SampleType<Rep>>>: UnsafeUnpin, Align4<u32>: UnsafeUnpin, Align1<u8>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<(SampleIdentity, Vec<Rep>)>: UnsafeUnpin, PhantomData<(i64, SampleIdentity)>: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.