fn call<P: Serialize>(
        &self,
        languageId: Option<&str>,
        method: &str,
        params: P,
    ) -> Result<Value> {
        let id = self.update(|state| {
            state.id += 1;
            Ok(state.id)
        })?;

        let method_call = rpc::MethodCall {
            jsonrpc: Some(rpc::Version::V2),
            id: rpc::Id::Num(id),
            method: method.into(),
            params: Some(params.to_params()?),
        };

        let (tx, cx) = channel();
        self.update(|state| {
            state.txs.insert(id, tx);
            Ok(())
        })?;

        let message = serde_json::to_string(&method_call)?;
        info!("=> {}", message);
        self.write(languageId, &message)?;

        cx.recv_timeout(std::time::Duration::from_secs(60 * 5))?
    }
/// RPC method call.
/// TODO: make return value generic.
RPC method call.
TODO: make return value generic.
RPC method call . TODO : make return value generic .
fn call<P: Serialize>(
        &self,
        languageId: Option<&str>,
        method: &str,
        params: P,
    ) -> Result<Value> {
        let id = self.update(|state| {
            state.id += 1;
            Ok(state.id)
        })?;
        let method_call = rpc::MethodCall {
            jsonrpc: Some(rpc::Version::V2),
            id: rpc::Id::Num(id),
            method: method.into(),
            params: Some(params.to_params()?),
        };
        let (tx, cx) = channel();
        self.update(|state| {
            state.txs.insert(id, tx);
            Ok(())
        })?;
        let message = serde_json::to_string(&method_call)?;
        info!("=> {}", message);
        self.write(languageId, &message)?;
        cx.recv_timeout(std::time::Duration::from_secs(60 * 5))?
    }
fn call < P : Serialize > ( & self , languageId : Option < & str > , method : & str , params : P , ) -> Result < Value > { let id = self . update ( | state | { state . id += 1 ; Ok ( state . id ) } ) ? ; let method_call = rpc :: MethodCall { jsonrpc : Some ( rpc :: Version :: V2 ) , id : rpc :: Id :: Num ( id ) , method : method . into ( ) , params : Some ( params . to_params ( ) ? ) , } ; let ( tx , cx ) = channel ( ) ; self . update ( | state | { state . txs . insert ( id , tx ) ; Ok ( ( ) ) } ) ? ; let message = serde_json :: to_string ( & method_call ) ? ; info ! ( " " message ) ; self . write ( languageId , & message ) ? ; cx . recv_timeout ( std :: time :: Duration :: from_secs ( 60 * 5 ) ) ? }
RPC method call.
RPC method call .
&self
languageId
Option<&str>
method
&str
params
P
&self
languageId
Option<&str>
method
&str
params
P