Crates.io | loole |
lib.rs | loole |
version | 0.4.0 |
source | src |
created_at | 2023-10-01 10:28:12.832325 |
updated_at | 2024-10-15 15:42:11.061385 |
description | A safe async/sync multi-producer, multi-consumer channel |
homepage | |
repository | https://github.com/mahdi-shojaee/loole |
max_upload_size | |
id | 989145 |
size | 155,942 |
A safe async/sync multi-producer multi-consumer channel.
fn main() {
let (tx, rx) = loole::unbounded();
std::thread::spawn(move || {
for i in 0..10 {
tx.send(i).unwrap();
}
});
let mut sum = 0;
while let Ok(i) = rx.recv() {
sum += i;
}
assert_eq!(sum, (0..10).sum());
}
#![forbid(unsafe_code)]
!To use Loole, place the following line under the [dependencies]
section in your Cargo.toml
:
loole = "0.4.0"
Benchmarks measure throughput, which is the number of messages sent and received per second, for messages of 264 bytes each.
To run benchmarks on your local machine, run the following command:
Prior to executing this command, ensure Node.js is installed.
cargo run --release -p benchmark
The above command will generate and update the benchmark images in the README.md file.
Benchmark results on:
OS: Ubuntu Linux 23.10, Kernel: 6.5.0-13
CPU: Intel Core i7-13700K (16/24-core/thread)
Measures: Messages per second. (higher is better)
Messages size: 264 bytes.
Measures: Messages per second. (higher is better)
Messages size: 264 bytes.
Measures: Messages per second. (higher is better)
Messages size: 264 bytes.
This project is licensed under the MIT license.