Skip to main content

localizable_error

Macro localizable_error 

Source
macro_rules! localizable_error {
    ($name:ident {
        $($variant:ident $(($($field:ty),*))? => $key:expr),* $(,)?
    }) => { ... };
}
Expand description

错误类型宏

用于创建可本地化的错误类型

§语法

支持两种形式:

  1. 简单形式(无参数):Variant => "key"
  2. 带参数形式:Variant(ty1, ty2) => "key"