[−][src]Crate safina
This is a safe Rust async runtime.
Related crates:
Features
forbid(unsafe_code)
- Depends only on
std
- Good test coverage (100%)
Limitations
- Requires Rust
nightly
, for OnceCell and Wake trait - Allocates memory
- Not optimized
Examples
safina::increase_threads_to(1); let (sender, receiver) = std::sync::mpsc::channel(); safina::spawn(Box::pin(async move { sender.send(()).unwrap(); })); receiver.recv().unwrap();
std::thread::spawn(safina::work); let result = safina::block_on(Box::pin(async { prepare_request().await?; execute_request().await }))?;
Documentation
https://docs.rs/safina
Alternatives
- smol
- popular
- Contains generous amounts of
unsafe
code
- async-std
- popular
- Contains generous amounts of
unsafe
code
- tokio
- very popular
- Fast, internally complicated, and full of
unsafe
- nostd_async
Release Process
- Edit
Cargo.toml
and bump version number. - Run
./release.sh
Changelog
- v0.1.0 - First published version
TO DO
- DONE - Implement
spawn
- DONE - Implement
block_on
- DONE - Implement
increase_threads_to
- DONE - Drop finished futures
- DONE - Handle task panic
- DONE - Add
stop_threads
,allow_threads
, andincrease_threads_to
. - DONE - Add tests
- DONE - Add docs
- DONE - Publish on crates.io
- Add a stress test
- Add a benchmark
- Make a version of the crate that uses
unsafe
once_cell
and unsafeRawWaker
and builds with Ruststable
.
Structs
ThreadStopTimeout | Returned by |
Functions
allow_threads | Clears the signal for worker threads to stop.
Call this after |
block_on | Executes the future on the current thread and returns its result. Panics if the future panics. |
increase_threads_to | Spawns new worker threads until the total number of workers is |
num_threads_running | The number of worker threads currently running. |
spawn | Adds a task that will execute |
stop_threads | Signals all threads to stop. Waits for them all to stop. |
work | Use the current thread as a worker in the runtime. |