Struct fizyr_rpc::interface_example::Client
source · pub struct Client<F: Format> { /* private fields */ }
Expand description
RPC client for the Supermarket interface.
Implementations§
source§impl<F: Format> Client<F>
impl<F: Format> Client<F>
sourcepub fn new(peer: PeerWriteHandle<F::Body>) -> Self
pub fn new(peer: PeerWriteHandle<F::Body>) -> Self
Create a new interface-specific RPC client from a raw write handle.
sourcepub fn close_handle(&self) -> PeerCloseHandle<F::Body>
pub fn close_handle(&self) -> PeerCloseHandle<F::Body>
Make a close handle for the peer.
The close handle can be used to close the connection with the remote peer. It can be cloned and moved around independently.
sourcepub async fn greet_cashier(&self, request: &String) -> Result<String, Error>
pub async fn greet_cashier(&self, request: &String) -> Result<String, Error>
Greet the cashier.
The cashier will reply with their own greeting.
sourcepub async fn buy_tomatoes(
&self,
request: &BuyTomatoesRequest
) -> Result<SentRequestHandle<F>, Error>
pub async fn buy_tomatoes( &self, request: &BuyTomatoesRequest ) -> Result<SentRequestHandle<F>, Error>
Purchase tomatoes.
The response of the cashier depends on the update messages exchanged.
If you run away after they have sent the price
, or if you pay with a nun-fungable token,
they will respond with BuyTomatoesResponse::ICalledSecurity
.
If you pay with the correct amount, they will respond with BuyTomatoesResponse::ThankYouComeAgain
.
sourcepub async fn send_mutter(&self, body: &String) -> Result<(), Error>where
F: EncodeBody<String>,
pub async fn send_mutter(&self, body: &String) -> Result<(), Error>where
F: EncodeBody<String>,
Send a mutter
stream message to the remote peer.
Trait Implementations§
Auto Trait Implementations§
impl<F> !RefUnwindSafe for Client<F>
impl<F> Send for Client<F>
impl<F> Sync for Client<F>
impl<F> Unpin for Client<F>
impl<F> !UnwindSafe for Client<F>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more