snafu_derive/report/
yes_async.rs

1use quote::quote;
2
3pub fn async_body(block: Box<syn::Block>) -> syn::Result<proc_macro2::TokenStream> {
4    if cfg!(feature = "rust_1_61") {
5        Ok(quote! {
6            {
7                let __snafu_body = async #block;
8                <::snafu::Report<_> as ::core::convert::From<_>>::from(__snafu_body.await)
9            }
10        })
11    } else {
12        Ok(quote! {
13            {
14                let __snafu_body = async #block;
15                ::core::result::Result::map_err(__snafu_body.await, ::snafu::Report::from_error)
16            }
17        })
18    }
19}