1 unstable release

0.1.0 May 29, 2023

#2122 in Development tools

MIT license

5KB

Macros for efficient development

Crates.io Rust license

Examples

Spawns a new asynchronous task, returning a JoinHandle for it.

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    poee::spawn(||{
        std::fs::write("demo0", "rust").unwrap();
    });
    fn demo(){
        std::fs::write("demo1", "rust").unwrap();
    }
    poee::spawn(demo);

    Ok(())
 }

Runs the provided closure on a thread where blocking is acceptable.

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
   poee::spawn_blocking(||{
       std::fs::write("demo0", "rust").unwrap();
   });
   fn demo(){
       std::fs::write("demo1", "rust").unwrap();
   }
   poee::spawn_blocking(demo);

   Ok(())
}    

executed on the async code in sync

fn main(){
   async fn demo(){
       println!("demo");
   }
   poee::sync_fn(demo());
}

Dependencies

~3–13MB
~115K SLoC