Crate python_comm_macros[][src]

Expand description

在函数中自动设置局部变量 __func__ 为当前函数名

用法

use python_comm_macros::auto_func_name;

#[auto_func_name]
fn test_name() -> String {
  return String::from(__func__);
}

assert_eq!(test_name(), "test_name");

Bug

有 auto_func_name 属性的函数, 用 /// 产生的文档注释在 cargo doc 中为空, 改为 auto_func_name2 解决

有 auto_func_name 属性的函数, 用 //! 在内部注释导致 rust 报错时找不到代码

有 auto_func_name2 属性的函数, 内部不允许用 //! 生成注释

Attribute Macros

auto_func_name

在函数中自动设置局部变量 __func__ 为当前函数名

auto_func_name2