mirror of
https://github.com/OMGeeky/tarpc.git
synced 2025-12-30 16:18:56 +01:00
Update README and service macro doc comment
This commit is contained in:
14
README.md
14
README.md
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user