https://github.com/mdrokz/async_executor
simple bare bones executor for async futures in rust.
https://github.com/mdrokz/async_executor
async asynchronous-programming futures library rust rust-library scheduler
Last synced: 8 months ago
JSON representation
simple bare bones executor for async futures in rust.
- Host: GitHub
- URL: https://github.com/mdrokz/async_executor
- Owner: mdrokz
- Created: 2020-12-31T12:51:44.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-31T13:17:00.000Z (almost 5 years ago)
- Last Synced: 2025-01-11T03:27:43.110Z (9 months ago)
- Topics: async, asynchronous-programming, futures, library, rust, rust-library, scheduler
- Language: Rust
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Async_Executor
simple bare bones executor for async futures in rust.# Queuing async operations to a limited amount
```rust
use crate::executor::{new_queue_executor_and_spawn, SyncExecutor, SyncSpawner};
let (executor, spawner): (SyncExecutor, SyncSpawner) =
new_queue_executor_and_spawn(3);
for _ in 0..3 {
spawner.spawn(async {
println!("hello world");
30
})
}
executor.run_queued(Box::new(|v| {
println!("V {}", v);
}));```
# Normal Async Executor
```rust
use crate::executor::{new_executor_and_spawner, Executor, Spawner};
let (executor, spawner): (Executor<'_, String>, Spawner<'_, String>) =
new_queue_executor_and_spawn(3);spawner.spawn(async {
println!("test");
30
});
let r = executer.block_on();// for running an async loop
// executor.run(Box::new(|v| {
// println!("V {}", v);
// }));```