client_handle/lib.rs
1#![doc = include_str!("../README.md")]
2
3/// Generates a client handle that uses tokio channels
4/// to send the messages between tasks.
5///
6/// The macro should be applied to a trait as shown below:
7///
8/// ```rust
9/// use client_handle::async_tokio_handle;
10///
11/// #[async_tokio_handle]
12/// trait MyTrait {
13/// fn double_echo(&self, input: u64) -> u64 {
14/// input * 2
15/// }
16/// }
17///
18/// struct Receiver;
19///
20/// impl MyTrait for Receiver {}
21///
22/// #[tokio::main]
23/// async fn main() {
24/// let receiver = Receiver;
25/// let handle = receiver.to_async_handle(32);
26/// let result = handle.double_echo(4).await;
27/// assert_eq!(result, 8);
28/// }
29/// ```
30#[cfg(feature = "tokio")]
31pub use client_handle_derive::async_tokio_handle;