如何查看由Parity Substrate中的宏生成的最终代码? [英] How can I look at the final code generated by the macros in Parity Substrate?

查看:139
本文介绍了如何查看由Parity Substrate中的宏生成的最终代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Substrate使用许多宏来简化编写运行时模块的过程:

Substrate uses a lot of macros to make it easier to write runtime modules:

  • construct_runtime!
  • decl_module!
  • decl_storage!
  • decl_event!
  • 等...

但是,很难理解这些宏的实际作用以及最终代码的外观.我该如何深入研究这些宏和扩展?

However, it is hard to understand what these macros actually do and what the final code looks like. How can I dig deeper into these macros and expansions?

推荐答案

对我来说,最舒适的解决方案是使用 cargo expand

To me, the most comfortable solution is to use cargo expand

https://github.com/dtolnay/cargo-expand

cargo install cargo-expand

然后只需从板条箱中调用它即可

then just call it from your crate

cargo expand

这篇关于如何查看由Parity Substrate中的宏生成的最终代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆