This is a safe Rust library for sharing or sending data between async tasks.
It is part of safina
, a safe async runtime.
forbid(unsafe_code)
std
safina-executor
or any async executorrust
use std::sync::Arc;
use safina_async_test::async_test;
use safina_sync::Mutex;
let shared_counter: Arc<Mutex<u32>> = get_shared_data();
{
let mut counter_guard = shared_counter.lock().await;
*counter_guard += 1;
// some_async_fn().await; // Cannot await while holding a MutexGuard.
}
some_async_fn().await; // Await is ok after releasing MutexGuard.
unsafe
codeunsafe
codeunsafe
unsafe
Mutex
with tests & docsPromise
Barrier
RwLock
WaitableBool
Channel
(single receiver)UnboundedChannel
WaitableQueue
(multiple receivers)UnboundedWaitableQueue
Topic
(copies message to every receiver)Cargo.toml
and bump version number../release.sh
License: Apache-2.0