Skip to main content

register

Macro register 

Source
macro_rules! register {
    ( $($rest:tt)* ) => { ... };
}
Expand description

生成 plugin_alloc / plugin_free / plugin_dispatch 三个 ABI 导出(spec §6.1/§6.2)。 可挂载(任意顺序、可组合):

  • before_savefn(Note) -> Result<Note, String>
  • storage:impl storage::Storage 的类型
  • commandfn(&str /* 命令 id */, Value /* args */) -> Result<Value, PluginError>
  • uifn(&str /* view */, Value /* state */) -> Result<Value, PluginError>(返回 UiNode 树,spec §9.3)
  • editorfn(&str /* phase: before-save|input */, String /* text */) -> Result<String, PluginError> (编辑期文本变换,contributes.editoreditor.transform,spec §3.7/§6.5)