Require rpc fns to be written in anticipation of allowing arbitrary items in the generated module

This commit is contained in:
Tim Kuehn
2016-01-12 20:23:00 -08:00
parent 27d80adf06
commit 3031bd7cb0
2 changed files with 6 additions and 6 deletions

View File

@@ -9,8 +9,8 @@
//! # #[macro_use] extern crate tarpc;
//! # extern crate serde;
//! rpc_service!(my_server:
//! hello(name: String) -> String;
//! add(x: i32, y: i32) -> i32;
//! rpc hello(name: String) -> String;
//! rpc add(x: i32, y: i32) -> i32;
//! );
//!
//! use self::my_server::*;

View File

@@ -49,7 +49,7 @@ macro_rules! request_variant {
// The main macro that creates RPC services.
#[macro_export]
macro_rules! rpc_service { ($server:ident:
$( $fn_name:ident( $( $arg:ident : $in_:ty ),* ) -> $out:ty;)*) => {
$( rpc $fn_name:ident( $( $arg:ident : $in_:ty ),* ) -> $out:ty;)*) => {
#[doc="A module containing an rpc service and client stub."]
pub mod $server {
@@ -116,9 +116,9 @@ macro_rules! rpc_service { ($server:ident:
#[allow(dead_code)]
mod test {
rpc_service!(my_server:
hello(foo: super::Foo) -> super::Foo;
rpc hello(foo: super::Foo) -> super::Foo;
add(x: i32, y: i32) -> i32;
rpc add(x: i32, y: i32) -> i32;
);
use self::my_server::*;
@@ -154,6 +154,6 @@ mod test {
// This is a test of a service with a fn that takes no args
rpc_service! {foo:
hello() -> String;
rpc hello() -> String;
}
}