mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 18:01:03 +00:00
Implements require_transactional (#7261)
* Implements require_transactional * support wasm * only enable for debug build * remove wasm support and add feature flag * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * only use check for debug_assertions * update per review * update docs * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * remove duplicated tests * fix test Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -41,3 +41,18 @@ pub fn transactional(_attr: TokenStream, input: TokenStream) -> Result<TokenStre
|
||||
|
||||
Ok(output.into())
|
||||
}
|
||||
|
||||
pub fn require_transactional(_attr: TokenStream, input: TokenStream) -> Result<TokenStream> {
|
||||
let ItemFn { attrs, vis, sig, block } = syn::parse(input)?;
|
||||
|
||||
let crate_ = generate_crate_access_2018()?;
|
||||
let output = quote! {
|
||||
#(#attrs)*
|
||||
#vis #sig {
|
||||
#crate_::storage::require_transaction();
|
||||
#block
|
||||
}
|
||||
};
|
||||
|
||||
Ok(output.into())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user