jsonrpc_client_core/example.rs
1// Copyright 2017 Amagicom AB.
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8
9jsonrpc_client!(
10 /// Just an example RPC client to showcase how to use the `jsonrpc_client` macro and what
11 /// the resulting structs look like.
12 pub struct ExampleRpcClient {
13 /// A method without any arguments and with no return value. Can still of course have
14 /// lots of side effects on the server where it executes.
15 pub fn nullary(&mut self) -> RpcRequest<()>;
16
17 /// Send a string to the server and it will presumably echo it back.
18 pub fn echo(&mut self, input: &str) -> RpcRequest<String>;
19
20 /// Example RPC method named "concat" that takes a `String` and an unsigned integer and
21 /// returns a `String`. From the name one could guess it will concatenate the two
22 /// arguments. But that of course depends on the server where this call is sent.
23 pub fn concat(&mut self, arg0: String, arg1: u64) -> RpcRequest<String>;
24 }
25);