Skip to content

simple bare bones executor for async futures in rust.

Notifications You must be signed in to change notification settings

mdrokz/Async_Executor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Async_Executor

simple bare bones executor for async futures in rust.

Queuing async operations to a limited amount

use crate::executor::{new_queue_executor_and_spawn, SyncExecutor, SyncSpawner};

let (executor, spawner): (SyncExecutor<String>, SyncSpawner<String>) =
        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

  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);
  //  }));

Releases

No releases published

Packages

 
 
 

Languages