macro_rules! rail_async {
($fut:expr $(,)?) => { ... };
}Expand description
Wraps a future in an AsyncErrorPipeline.
This macro provides a convenient way to create an async error pipeline
from a future that returns a Result.
ยงExamples
use error_rail::prelude_async::*;
#[derive(Debug)]
struct Data;
#[derive(Debug)]
struct ApiError;
async fn fetch_data(_id: u64) -> Result<Data, ApiError> {
Err(ApiError)
}
async fn example(id: u64) -> BoxedResult<Data, ApiError> {
rail_async!(fetch_data(id))
.with_context("fetching data")
.finish_boxed()
.await
}