Urhengulas
a3f1064efe
Cargo.toml: Clean + update dependencies
2020-10-18 16:03:04 -07:00
Johann Hemmann
026083d653
Bump tokio from 0.2 to 0.3 ( #319 )
...
# Bump `tokio` from 0.2 to 0.3
* `Cargo.toml`:
* bump `tokio` from 0.2 to 0.3
* bump `tokio-util` from 0.3 to 0.4
* remove feature `time` from `tokio`
* fix alphabetical order of dependencies
* `tarpc::rpc`:
* `client, server`: `tokio::time::Elapsed` -> `tokio::time::error::Elapsed`
* `client, transport`, `::tests`: Fix `#[tokio::test]` macro usage
* `tarpc::serde_transport`:
* `TcpListener.incoming().poll_next(...)` -> `TcpListener.poll_accept(...)`
-> https://github.com/tokio-rs/tokio/discussions/2983
* Adapt `AsyncRead`, `AsynWrite` implements in tests
* `README.md`, `tarpc::lib`: Adapt tokio version in docs
# Satisfy clippy
* replace `match`-statements with `matches!(...)`-macro
2020-10-17 17:33:08 -07:00
Tim Kuehn
d27f341bde
Prepare release of v0.22.0
v0.22.0
2020-08-19 18:35:36 -07:00
Tim Kuehn
2264ebecfc
Remove serde_transport::tcp::connect_with.
...
Instead, serde_transport::tcp::connect returns a future named Connect
that has methods to directly access the framing config. This is
consistent with how serde_transport::tcp::listen returns a future with
methods to access the framing config. In addition to this consistency,
it reduces the API surface and provides a simpler user transition from
"zero config" to "some config".
2020-08-19 17:51:53 -07:00
Tim Kuehn
3207affb4a
Update pre-commit for changes to cargo fmt.
...
--write-mode is now --check.
2020-08-19 17:51:20 -07:00
Andre B. Reis
0602afd50c
Make connect() and connect_with() take a FnOnce for the codec ( #315 )
2020-08-19 16:15:26 -07:00
Tim Kuehn
4343e12217
Fix incorrect documentation
2020-08-18 02:58:11 -07:00
Tim Kuehn
7fda862fb8
Run cargo fmt
2020-08-18 02:55:24 -07:00
Tim Kuehn
aa7b875b1a
Expose framing config in serde_transport.
2020-08-18 02:47:41 -07:00
Tim Kuehn
54d6e0e3b6
Add license headers
2020-08-04 17:33:41 -07:00
Tim Kuehn
bea3b442aa
Move mod.rs files up one directory.
...
It's easier in IDEs if the files aren't all named the same.
2020-08-04 17:25:53 -07:00
Tim Kuehn
954a2502e7
Remove duplicate rustdoc
2020-08-02 22:24:09 -07:00
Tim Kuehn
e3f34917c5
Prepare v0.21.1
v0.21.1
2020-08-02 21:34:13 -07:00
Tim Kuehn
f65dd05949
Enable documentation for optional features on docs.rs
2020-08-02 20:57:21 -07:00
Tim Kuehn
240c436b34
Ensure Context is Sync.
2020-08-01 14:01:07 -07:00
Tim Kuehn
c9803688cc
Ensure Context is Send.
2020-08-01 13:49:25 -07:00
Tim Kuehn
4987094483
Compression example.
...
Follow-up work: some extension points would be useful allow enabling compression on a per-request basis.
Fixes https://github.com/google/tarpc/issues/200
2020-08-01 13:45:16 -07:00
Tim Kuehn
ff55080193
Minor refactor
2020-07-30 13:11:13 -07:00
Tim Kuehn
258193c932
PubSub example needs to populate the subscription topics.
2020-07-30 11:14:13 -07:00
Tim Kuehn
67823ef5de
Get rid of sleeps in PubSub example.
2020-07-30 01:27:31 -07:00
Tim Kuehn
a671457243
Add topics to PubSub example
2020-07-29 22:51:04 -07:00
Tim Kuehn
cf654549da
Add documentation to PubSub example.
2020-07-29 18:05:35 -07:00
Tim Kuehn
6a01e32a2d
Shut down client dispatch immediately when read half of transport is closed.
...
Clients can't receive any responses when the read half is closed, which means they can't verify if their requests were served. Therefore, there is no point in writing further requests after the read half is closed.
2020-07-29 13:50:42 -07:00
Tim Kuehn
e6597fab03
Add some error context to client dispatch.
...
I'm taking this opportunity to experiment with anyhow. So far, results are promising. It was a bit hard to use with Poll<Option<Result<T, E>>> types, so I added a crate-internal helper trait for that.
2020-07-29 12:07:07 -07:00
Tim Kuehn
ebd245a93d
Rewrite pubsub example to have the subscriber connect to the publisher.
...
Fixes https://github.com/google/tarpc/issues/313
2020-07-28 22:10:17 -07:00
Tim Kuehn
3ebc3b5845
Add accessor fns.
...
- ClientHandler::get_pin_channel
- BaseChannel::get_pin_ref
- serde_transport::Transport::get_ref
2020-07-28 21:27:36 -07:00
Tim Kuehn
0e5973109d
Make docs.rs document feature-gated public items.
2020-07-28 19:43:43 -07:00
Tim Kuehn
5f02d7383a
Add tests for correct diagnostic output from proc macro-generated compiler errors.
2020-07-27 01:17:06 -07:00
Tim Kuehn
2bae148529
Address clippy lints
2020-07-27 00:04:45 -07:00
Tim Kuehn
42a2e03aab
Add better diagnostics for missing 'async' in impls using #[tarpc::server]
2020-07-26 23:47:48 -07:00
Tim Kuehn
b566d0c646
Use #[tarpc::server] in example-service
2020-07-26 18:26:41 -07:00
Jon Cinque
b359f16767
Add concurrent tests using join and join_all
...
These tests are essentially copies of the `concurrent` test,
specifically using `join` and `join_all`. Note that for the `join_all`
example to work, all of the `Client` clones must be created before *any*
requests are added, otherwise there will be a lifetime problem with the
second request, saying that second client, `c2`, is still borrowed when
`req1` is dropped. It would require a larger redesign to fix this
issue.
2020-07-24 09:51:05 -07:00
Greg Fitzgerald
f8681ab134
Migrate examples to tarpc::server
2020-07-22 14:03:23 -07:00
Tim Kuehn
7e521768ab
Prepare for v0.21.0 release.
v0.21.0
2020-06-26 20:05:02 -07:00
Tim Kuehn
e9b1e7d101
Use #[non_exhaustive] in lieu of _NonExhaustive enum variant.
2020-06-26 19:47:20 -07:00
Taiki Endo
f0322fb892
Remove uses of pin_project::project attribute
...
pin-project will deprecate the project attribute due to some unfixable
limitations.
Refs: https://github.com/taiki-e/pin-project/issues/225
2020-06-05 20:34:44 -07:00
Patrick Elsen
617daebb88
Add tarpc::server proc-macro as syntactic sugar for async methods. ( #302 )
...
The tarpc::server proc-macro can be used to annotate implementations of
services to turn async functions into the proper declarations needed
for tarpc to be able to call them.
This uses the assert_type_eq crate to check that the transformations
applied by the tarpc::server proc macro are correct and lead to code
that compiles.
2020-05-16 10:25:25 -07:00
Tim Kuehn
a11d4fff58
Remove raii_counter
2020-04-22 02:13:02 -07:00
Tim
bf42a04d83
Move the request timeout so that it surrounds the entire call, not just the response future. ( #295 )
...
* Move the request timeout so that it surrounds the entire call, not just the response future.
This will enable the timeout earlier, so that a backlog in the outbound request buffer can not cause requests to stall indefinitely.
* Run cargo fmt
2020-02-25 14:42:40 -08:00
Tim Kuehn
06528d6953
Fix clippy lint.
2019-12-19 12:28:26 -08:00
Tim Kuehn
9f00395746
Replace _non_exhaustive fields with #[non_exhaustive] attribute.
...
The attribute landed on stable rust (1.40.0) today.
Fixes https://github.com/google/tarpc/issues/275
2019-12-19 12:14:34 -08:00
Tim Kuehn
e0674cd57f
Make pre-push run on rust stable.
2019-12-19 12:06:06 -08:00
Tim Kuehn
7e49bd9ee7
Clean up badges a bit.
2019-12-16 13:21:00 -08:00
Tim Kuehn
8a1baa9c4e
Remove usage of unsafe in rpc::client::channel.
...
pin_project is actually able to handle the complexities of enum Futures.
2019-12-16 11:10:57 -08:00
Oleg Nosov
31c713d188
Allow raw identifiers + fixed naming + place all code generation methods in impl ( #291 )
...
Allows defining services using raw identifiers like:
```rust
pub mod service {
#[tarpc::service]
pub trait r#trait {
async fn r#fn(x: i32) -> Result<u8, String>;
}
}
```
Also:
- Refactored names (ident -> type)
- All code generation methods placed in impl
2019-12-12 10:13:57 -08:00
Tim Kuehn
d905bc1591
Prepare for tarpc release v0.20.0
v0.20.0
2019-12-11 20:47:56 -08:00
Tim Kuehn
7f946c7f83
Make tokio a hard dependency.
...
Fixes #289
2019-12-11 20:08:36 -08:00
Tim Kuehn
36cfdb6c6f
Fix tokio dependency for example-service
2019-12-11 20:01:06 -08:00
Tim Kuehn
dbabe9774f
Clean up proc macro code to make clippy happy.
...
I made a separate TokenStream-returning fn for each item in the previously-huge quote block.
The service fn now primarily performs the duty of creating idents and joining all the TokenStreams.
2019-12-11 17:20:03 -08:00
Tim Kuehn
deb041b8d3
Replace travis-ci badge with github CI workflow badge
2019-12-11 12:54:56 -08:00