decolor 0.1.1

Asynchronous runtime abstractions for implicit function decoloring.
Documentation

decolor

Build Status License Docs Latest Version rustc 1.31+

Asynchronous runtime abstractions for implicit function decoloring. Decolor is in https://github.com/refcell/decolor/labels/beta

Install | User Docs | Crate Docs | Reference | Contributing | License

What is decolor?

decolor is a procedural macro crate that implements a #[decolor] attribute macro used to "decolor" an asynchronous rust function. Concretely, the #[decolor] macro can be placed above an asynchronous function to safely 1 transform it into a "purple" function (a synchronous function that blocks on asynchronous functionality internally).

1: ...

Usage

Add decolor as a dependency with cargo.

cargo add decolor

A short example for building a purple function using the [decolor][decolor] decorator.

use decolor::decolor;
use tokio::time::{sleep, Duration};

#[decolor]
async fn foo() -> anyhow::Result<()> {
    sleep(Duration::from_secs(1)).await;
    println!("Hello, world!");
    Ok(())
}

fn main() {
    assert!(foo().is_ok());
}

Contributing

All contributions are welcome! Experimentation is highly encouraged and new issues are welcome.

Troubleshooting & Bug Reports

Please check existing issues for similar bugs or open an issue if no relevant issue already exists.

License

This project is licensed under the MIT License. Free and open-source, forever. All our rust are belong to you.