Attribute Macro rocket::async_test

source ·
#[async_test]
Expand description

Retrofits supports for async fn in unit tests.

Simply decorate a test async fn with #[async_test] instead of #[test]:

#[cfg(test)]
mod tests {
    #[async_test]
    async fn test() {
        /* .. */
    }
}

The attribute rewrites the function to execute inside of a Rocket-compatible async runtime.