Skip to main content

batch_impl_only

Attribute Macro batch_impl_only 

Source
#[batch_impl_only]
Expand description

#[batch_impl] 相同,但丢弃被标注的 trait 定义,只输出 impl 块。

用于 trait 已在别处定义、只需批量生成 impl 的场景。被标注的 trait 仅作为 指令系统的“签名真相源“:#name/#fill/#delegate 从它读取 item 签名, 开放扩展 #name(args){body} 把(方法名列表, body, 整个 trait)一起交给 用户的同名函数式宏(见 README「指令系统」)。语法与 #[batch_impl] 完全一致。

§示例

trait Greet { fn hello(&self) -> &str; }

#[batch_impl_only(usize #hello{"hi"})]
trait Greet { fn hello(&self) -> &str; } // 此 trait 定义被丢弃,不影响已有的定义
// 这样写而不用batch_trait是为了使用指令系统,建议按trait定义处按原样写