Crates.io | events |
lib.rs | events |
version | 0.3.12 |
created_at | 2025-07-01 18:18:15.24079+00 |
updated_at | 2025-08-28 08:27:13.134573+00 |
description | High-performance signaling primitives for concurrent environments |
homepage | |
repository | https://github.com/folo-rs/folo |
max_upload_size | |
id | 1733474 |
size | 402,704 |
High-performance event signaling primitives for concurrent environments.
This package provides lightweight, efficient signaling mechanisms for communicating between different parts of an application. The API is designed to be simple to use while offering high performance in concurrent scenarios.
Both single-threaded and thread-safe variants are available for events and pools:
OnceEvent<T>
, OnceSender<E>
, OnceReceiver<E>
- Thread-safe event variantsLocalOnceEvent<T>
, LocalOnceSender<E>
, LocalOnceReceiver<E>
- Single-threaded event variantsOnceEventPool<T>
, PooledOnceSender<P>
, PooledOnceReceiver<P>
- Thread-safe pool variantsLocalOnceEventPool<T>
, PooledLocalOnceSender<P>
, PooledLocalOnceReceiver<P>
- Single-threaded pool variantsuse events::OnceEvent;
// Create a thread-safe event for passing a string message
let event = OnceEvent::<String>::new();
let (sender, receiver) = event.bind_by_ref();
// Send a message through the event
sender.send("Hello, World!".to_string());
// Receive the message (await since it's async)
let message = receiver.await.unwrap();
assert_eq!(message, "Hello, World!");
More details in the package documentation.
This is part of the Folo project that provides mechanisms for high-performance hardware-aware programming in Rust.