# safina-executor
[](https://crates.io/crates/safina-executor)
[](http://www.apache.org/licenses/LICENSE-2.0)
[](https://github.com/rust-secure-code/safety-dance/)
[](https://gitlab.com/leonhard-llc/safina-rs/-/pipelines)
This is a safe Rust async executor.
It is part of [`safina`](https://crates.io/crates/safina), a safe async runtime.
## Features
- `forbid(unsafe_code)`
- Depends only on `std`
- Good test coverage (100%)
## Limitations
- Requires Rust `nightly`, for
[OnceCell](https://doc.rust-lang.org/std/lazy/struct.OnceCell.html)
and
[Wake trait](https://doc.rust-lang.org/std/task/trait.Wake.html)
- Allocates memory
- Not optimized
## Documentation
https://docs.rs/safina-executor
## Examples
```rust
safina_executor::increase_threads_to(1);
let (sender, receiver) = std::sync::mpsc::channel();
safina_executor::spawn(Box::pin(async move {
sender.send(()).unwrap();
}));
receiver.recv().unwrap();
```
```rust
std::thread::spawn(safina_executor::work);
let result = safina_executor::block_on(Box::pin(async {
prepare_request().await?;
execute_request().await
}))?;
```
## Alternatives
- [smol](https://crates.io/crates/smol)
- popular
- Contains generous amounts of `unsafe` code
- [async-std](https://crates.io/crates/async-std)
- popular
- Contains generous amounts of `unsafe` code
- [tokio](https://crates.io/crates/tokio)
- very popular
- Fast, internally complicated, and full of `unsafe`
- [nostd_async](https://crates.io/crates/nostd_async)
## Release Process
1. Edit `Cargo.toml` and bump version number.
1. Run `./release.sh`
## Changelog
- v0.1.1 - Fix badge and update readme
- v0.1.0 - Renamed from `safina`
## 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`, and `increase_threads_to`.
- DONE - Add tests
- DONE - Add docs
- DONE - Publish on crates.io
- DONE - Add an #[async_test] macro
- Add a stress test
- Add a benchmark
- Make a version of the crate that uses
unsafe [`once_cell`](https://crates.io/crates/once_cell)
and unsafe [`RawWaker`](https://doc.rust-lang.org/std/task/struct.RawWaker.html)
and builds with Rust `stable`.
- Add an #[async_main] macro
License: Apache-2.0