Update README and service macro doc comment

This commit is contained in:
Tim Kuehn
2016-02-18 21:23:42 -08:00
parent 250a7fd7b9
commit 58cbe6f4ea
2 changed files with 13 additions and 10 deletions

View File

@@ -53,14 +53,12 @@ fn main() {
}
```
The `service!` macro expands to a collection of items that collectively form an
rpc service. In the above example, the macro is called within the
`hello_service` module. This module will contain a `Client` type, a `Service`
trait, and a `serve` function. `serve` can be used to start a server listening
on a tcp port. A `Client` (or `AsyncClient`) can connect to such a service. Any
type implementing the `Service` trait can be passed to `serve`. These generated
types are specific to the echo service, and make it easy and ergonomic to write
servers without dealing with sockets or serialization directly. See the
The `service!` macro expands to a collection of items that collectively form an rpc service. In the
above example, the macro is called within the `hello_service` module. This module will contain a
`Client` (and `AsyncClient`) type, and a `Service` trait. The trait provides `default fn`s for
starting the service: `spawn` and `spawn_with_config`, which start the service listening on a tcp
port. A `Client` (or `AsyncClient`) can connect to such a service. These generated types make it
easy and ergonomic to write servers without dealing with sockets or serialization directly. See the
tarpc_examples package for more sophisticated examples.
## Documentation

View File

@@ -218,17 +218,22 @@ macro_rules! impl_deserialize {
/// # }
/// ```
///
/// There are two rpc names reserved for the default fns `spawn` and `spawn_with_config`.
///
/// Attributes can be attached to each rpc. These attributes
/// will then be attached to the generated `Service` trait's
/// corresponding method, as well as to the `Client` stub's rpcs methods.
///
/// The following items are expanded in the enclosing module:
///
/// * `Service` -- the trait defining the RPC service
/// * `Service` -- the trait defining the RPC service. It comes with two default methods for
/// starting the server:
/// 1. `spawn` starts the service in another thread using default configuration.
/// 2. `spawn_with_config` starts the service in another thread using the specified
/// `Config`.
/// * `Client` -- a client that makes synchronous requests to the RPC server
/// * `AsyncClient` -- a client that makes asynchronous requests to the RPC server
/// * `Future` -- a handle for asynchronously retrieving the result of an RPC
/// * `serve` -- the function that spawns the RPC server
///
/// **Warning**: In addition to the above items, there are a few expanded items that
/// are considered implementation details. As with the above items, shadowing