pub(crate) fn process_func(mut func: ItemFn) -> ItemFn {
    let output = func.sig.output;
    // Currently, use quote/syn to automatically generate it,
    // don't know if there is a better way.
    // Seems hard to parse new ReturnType only or construct ReturnType by hand.
    let dummy_func = match output {
        ReturnType::Default => {
            quote! {
                fn dummy() -> sentinel_rs::Result<()> {}
            }
        }
        ReturnType::Type(_, return_type) => {
            quote! {
                fn dummy() -> sentinel_rs::Result<#return_type> {}
            }
        }
    };
    let dummy_func: ItemFn = syn::parse2(dummy_func).unwrap();
    // replace the old ReturnType to the dummy function ReturnType
    func.sig.output = dummy_func.sig.output;
    func
}
/// Extract the original ReturnType and wrap it with Result<T,E>
Extract the original ReturnType and wrap it with Result
Extract the original ReturnType and wrap it with Result
pub(crate) fn process_func(mut func: ItemFn) -> ItemFn {
    let output = func.sig.output;
    // Currently, use quote/syn to automatically generate it,
    // don't know if there is a better way.
    // Seems hard to parse new ReturnType only or construct ReturnType by hand.
    let dummy_func = match output {
        ReturnType::Default => {
            quote! {
                fn dummy() -> sentinel_rs::Result<()> {}
            }
        }
        ReturnType::Type(_, return_type) => {
            quote! {
                fn dummy() -> sentinel_rs::Result<#return_type> {}
            }
        }
    };
    let dummy_func: ItemFn = syn::parse2(dummy_func).unwrap();
    // replace the old ReturnType to the dummy function ReturnType
    func.sig.output = dummy_func.sig.output;
    func
}
pub ( crate ) fn process_func ( mut func : ItemFn ) -> ItemFn { let output = func . sig . output ; // Currently, use quote/syn to automatically generate it, // don't know if there is a better way. // Seems hard to parse new ReturnType only or construct ReturnType by hand. let dummy_func = match output { ReturnType :: Default => { quote ! { fn dummy ( ) sentinel_rs Result ( ) { } } } ReturnType :: Type ( _ , return_type ) => { quote ! { fn dummy ( ) sentinel_rs Result return_type { } } } } ; let dummy_func : ItemFn = syn :: parse2 ( dummy_func ) . unwrap ( ) ; // replace the old ReturnType to the dummy function ReturnType func . sig . output = dummy_func . sig . output ; func }
Extract the original ReturnType and wrap it with Result<T,E>
Extract the original ReturnType and wrap it with Result<T E >
func
ItemFn
func
ItemFn