channel_protocol/
lib.rs

1//! # Channel Protocol
2//! A procedural macro to generate channel protocol clients.
3//! You can use function oriented communication between threads instead of communicating by sending messages through channels.
4//! This is an abstraction over channels that makes inter-thread communication easier to use and read.
5//!
6//! ## Example
7//! ```
8#![doc = include_str!("../examples/sync.rs")]
9//! ```
10mod channel_protocol;
11mod client;
12mod enum_message;
13mod handler;
14mod render;
15
16use proc_macro::TokenStream;
17/// Expect a trait definition as input and generate a channel protocol based on it.
18#[proc_macro_attribute]
19pub fn channel_protocol(_attr_content: TokenStream, input: TokenStream) -> TokenStream {
20    channel_protocol::build(input.into()).into()
21}