9 releases
0.2.6 | Mar 25, 2024 |
---|---|
0.2.3 | Mar 25, 2024 |
0.1.4 | Mar 12, 2024 |
0.1.3 | Feb 27, 2024 |
#45 in #mpmc
50 downloads per month
Used in crosstalk
21KB
299 lines
crosstalk-macros
Please see: https://crates.io/crates/crosstalk
lib.rs
:
Crosstalk Macros
This crate provides macros for simplifying communication between threads using the Crosstalk library.
Benchmarks
The benchmarks module contains functions to benchmark different communication scenarios.
External Dependencies
This file imports external dependencies such as quote
and syn
for code generation and parsing.
Functionality
This file contains various functions for handling message transmission and reception between publishers and subscribers. The functions are designed to work efficiently and return when messages are successfully received. There are also functions for draining messages from subscribers and handling multiple publishers and subscribers.
Constants
The file defines constants for the number of publishers, subscribers, and messages used in the benchmarks.
Custom Structs
There are examples of custom structs like DetectorOutput
, though they are currently commented out for future use.
Topics Enum
An example enum TopicZoo
is defined for different topics that can be communicated between threads.
Utility Functions
Utility functions like write
and read
are provided for writing messages to publishers and reading messages from subscribers.
Error Handling
The code includes error handling for downcasting message types using the downcast
function.
Benchmarking
Benchmarks are set up for various communication scenarios to measure performance and efficiency.
Thread Management
The file manages threads for communication between publishers and subscribers, ensuring messages are received and processed correctly.
License
This code is licensed under the MIT license.
Dependencies
~300–750KB
~18K SLoC