* Mangle a lot of names in macro expansion.
To lower the chance of any issues, prefix idents in service expansion with __tarpc_service.
In future_enum, prefix with __future_enum. The pattern is basically __macro_name_ident.
Any imported enum variant will conflict with a let binding or a function arg, so we basically
can't use any generic idents at all. Example:
enum Req { request(..) }
use self::Req::request;
fn make_request(request: Request) { ... }
^^^^^^^ conflict here
Additionally, suffix generated associated types with Fut to avoid conflicts with camelcased rpcs.
Why someone would do that, I don't know, but we shouldn't allow that wart.
* Trim long macro lines
* Extend snake_to_camel plugin to replace {} in the doc string with the origin snake-cased ident.
Also, track tokio-rs master.
This is really ad-hoc, undiscoverable, and unintuitive, but there's no way to programmatically create doc strings
in regular code, and I want to produce better doc strings for the associated types.
Given `fn foo_bar`:
Before: `/// The type of future returned by the function of the same name.`
After: ``/// The type of future returned by `{}`.``
=> `/// The type of future returned by foo_bar.`
* Fix some docs
* Use a helper fn on pipeline::Frame instead of handrolled match.
* Don't hide docs for ClientFuture.
It's exposed in the Connect impl of FutureService -- the tradeoff for not generating *another* item -- and hiding it breaks doc links.
* Formatting
* Rename snake_to_camel plugin => tarpc-plugins
* Update README
* Mangle a lot of names in macro expansion.
To lower the chance of any issues, prefix idents in service expansion with __tarpc_service.
In future_enum, prefix with __future_enum. The pattern is basically __macro_name_ident.
Any imported enum variant will conflict with a let binding or a function arg, so we basically
can't use any generic idents at all. Example:
enum Req { request(..) }
use self::Req::request;
fn make_request(request: Request) { ... }
^^^^^^^ conflict here
Additionally, suffix generated associated types with Fut to avoid conflicts with camelcased rpcs.
Why someone would do that, I don't know, but we shouldn't allow that wart.
Previously, the enum couldn't be declared in the fn it was used in, because
they were part of the same repeating pattern in the macro syntax, and you can't
nest the same repeating pattern. I fixed this by expanding it early,
as a macro argument separate from the repeating fn pattern.
* Rewrite tarpc on top of tokio.
* Add examples
* Move error types to their own module.
Also, cull unused error variants.
* Remove unused fn
* Remove CanonicalRpcError* types. They're 100% useless.
* Track tokio master (WIP)
* The great error revamp.
Removed the canonical rpc error type. Instead, the user declares
the error type for each rpc:
In the above example, the error type is Baz. Declaring an error is
optional; if none is specified, it defaults to Never, a convenience
struct that wraps the never type (exclamation mark) to impl Serialize, Deserialize,
Error, etc. Also adds the convenience type StringError for easily
using a String as an error type.
* Add missing license header
* Minor cleanup
* Rename StringError => Message
* Create a sync::Connect trait.
Along with this, the existing Connect trait moves to future::Connect. The future
and sync modules are reexported from the crate root.
Additionally, the utility errors Never and Message are no longer reexported from
the crate root.
* Update readme
* Track tokio/futures master. Add a Spawn utility trait to replace the removed forget.
* Fix pre-push hook
* Add doc comment to SyncServiceExt.
* Fix up some documentation
* Track tokio-proto master
* Don't set tcp nodelay
* Make future::Connect take an associated type for the future.
* Unbox FutureClient::connect return type
* Use type alias instead of newtype struct for ClientFuture
* Fix benches/latency.rs
* Write a plugin to convert lower_snake_case idents/types to UpperCamelCase.
Use it to add associated types to FutureService instead of boxing the return futures.
* Specify plugin = true in snake_to_camel/Cargo.toml. Weird things happen otherwise.
* Add clippy.toml
serve_async was taking a SocketAddr, and then binding to it. This is fine if
your'e always sure of the exact address you want to bind to, but in some cases
you don't know.
One such case is when you want the OS to assign you and ephemeral port number,
like we do in our tests. In this case, you pass 0.0.0.0:0 as the address, and
then call bind. After that, you don't know which address the listener bound to,
so we can't make the subsequent call to TcpStream::connect without getting a
weird error.
This is fixed by the ServeHandle object exposing a local_addr() method, which
returns the address that the listener bound to.