# Macros for efficient development
[](https://crates.io/crates/poee)
[](https://gitlab.com/andrew_ryan/poee)
[](https://gitlab.com/andrew_ryan/poee/-/raw/master/LICENSE)
# Examples
### Spawns a new asynchronous task, returning a JoinHandle for it.
```rust
#[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.
```rust
#[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
```rust
fn main(){
async fn demo(){
println!("demo");
}
poee::sync_fn(demo());
}
```