Skip to main content

help

Macro help 

Source
help!() { /* proc-macro */ }
Expand description

创建带有增强错误报告和智能提示的包装类型。 Creates a wrapper type with enhanced error reporting and smart hints.

此宏定义一个代理底层类型(如 syn::Ident)的包装结构体,允许附加自定义的错误信息和帮助文本。

若启用了 vacro-parser 支持,还可以提供 example 字段。这将激活智能提示联动,使解析器在报错时显示具体的代码示例而非类型名。

help!(Arithmetic: syn::Expr {
    error: "expected an arithmetic expression",
    help: "try using explicit values or operations",
    example: "1 + 2" // 可选:用于 vacro-parser 智能提示
});

Defines a wrapper struct that proxies an underlying type (like syn::Ident), allowing custom error messages and help text to be attached.

If vacro-parser support is enabled, the example field can be provided. This activates smart hint synergy, causing the parser to show specific code examples instead of type names when errors occur.

help!(Arithmetic: syn::Expr {
    error: "expected an arithmetic expression",
    help: "try using explicit values or operations",
    example: "1 + 2" // Optional: for vacro-parser smart hints
});