Skip to main content

mf_macro/
lib.rs

1//! ModuForge-RS 声明式宏
2//!
3//! 该模块提供了 ModuForge 项目的声明式宏,包括:
4//! - `impl_extension!`:创建 Extension 实例(legacy)
5//! - `mf_extension!`:声明式扩展定义宏(类似 Deno 的 extension! 宏)
6//! - `mf_extension_with_config!`:带配置支持的扩展宏
7//! - `mf_ops!`:声明操作函数宏
8//! - `mf_op!`:创建操作函数
9//! - `mf_global_attr!`:创建全局属性项
10//! - `impl_plugin!`:快速实现 Plugin trait(legacy)
11//! - `mf_plugin!`:声明式插件定义宏
12//! - `mf_plugin_with_config!`:带配置支持的插件宏
13//! - `mf_plugin_metadata!`:创建插件元数据
14//! - `mf_plugin_config!`:创建插件配置
15//! - `impl_state_field!`:快速实现 StateField trait
16//! - `derive_plugin_state!`:为类型实现 Resource trait
17//! - `mark!`:创建 Mark 实例
18//! - `node!`:创建 Node 实例
19//!
20//! > 注意:异步命令属性宏 `#[impl_command]` 现由 `moduforge-macros-derive`
21//! > 提供,请直接从该 crate 导入。
22//!
23//! ## 使用方法
24//!
25//! ```toml
26//! [dependencies]
27//! mf-macro = { path = "../macro" }
28//! mf-derive = { path = "../derive" } # 如果需要使用 #[impl_command]
29//! ```
30//!
31//! ```rust
32//! use mf_macro::{
33//!     mark, node, impl_plugin,
34//!     mf_extension, mf_extension_with_config, mf_ops, mf_op, mf_global_attr,
35//!     mf_plugin, mf_plugin_with_config, mf_plugin_metadata, mf_plugin_config,
36//!     impl_state_field, derive_plugin_state
37//! };
38//! use mf_derive::impl_command; // #[impl_command] 请从 `mf_derive` 导入
39//! ```
40
41pub mod extension;
42pub mod mark;
43pub mod node;
44pub mod plugin;