/// Request a response from the RPC server.
/// This returns a `ResponseAwaiter`, a `Future` that awaits a response.
Request a response from the RPC server.
This returns a `ResponseAwaiter`, a `Future` that awaits a response.
Request a response from the RPC server . This returns a ` ResponseAwaiter ` a ` Future ` that awaits a response .
pub fn request(&self, method: impl Into<String>, params: Option<Value>) -> ResponseAwaiter {
        // fetch the next ID
        let id = self.request_id.fetch_sub(-1, Ordering::SeqCst);
        // write out the request
        self.write_request(rpc::RequestId::Int(id), method, params);
        // create a channel to send the response over
        let (tx, rx) = oneshot::channel::<rpc::Response>();
        // insert the transmitter into the dashmap
        self.awaiter_txs.insert(rpc::RequestId::Int(id), tx);
        // return back with an awaiter to await the receiver
        ResponseAwaiter(rx)
    }
pub fn request ( & self , method : impl Into < String > , params : Option < Value > ) -> ResponseAwaiter { // fetch the next ID let id = self . request_id . fetch_sub ( - 1 , Ordering :: SeqCst ) ; // write out the request self . write_request ( rpc :: RequestId :: Int ( id ) , method , params ) ; // create a channel to send the response over let ( tx , rx ) = oneshot :: channel :: < rpc :: Response > ( ) ; // insert the transmitter into the dashmap self . awaiter_txs . insert ( rpc :: RequestId :: Int ( id ) , tx ) ; // return back with an awaiter to await the receiver ResponseAwaiter ( rx ) }
Request a response from the RPC server.
Request a response from the RPC server .
&self
method
impl Into<String>
params
Option<Value>