Skip to main content

plugin

Attribute Macro plugin 

Source
#[plugin]
Expand description

Attribute macro that turns a Default-constructible engine struct into a loadable MySQL plugin.

§Arguments

  • name: plugin name (string literal, ASCII, ≤ 64 bytes, no NUL). SQL identifies the engine by this name in INSTALL PLUGIN <name>.
  • description: human-readable description (string literal).
  • version: plugin version, any const expression evaluating to c_uint (commonly env!("CARGO_PKG_VERSION") parsed elsewhere or a literal like 0x0001).
  • license: any const expression of type [mysql_handler::license::License]. The discriminant is folded into the static initialiser at compile time.
  • author: author or organisation name (string literal).
  • handlerton (optional): path to a Default-constructible handlerton struct (typically a unit struct) implementing [mysql_handler::hton::Handlerton]. When supplied the generated rust__plugin_init additionally registers the handlerton so engine-level callbacks (transactions, savepoints, discovery) route through it. Omit when the engine only needs the per-handler surface.

§Example

use mysql_handler::prelude::*;

#[plugin(
    name = "my_engine",
    description = "Custom storage engine",
    version = 0x0001,
    license = License::Gpl,
    author = "me",
)]
#[derive(Default)]
pub struct MyEngine;

impl mysql_handler::engine::StorageEngine for MyEngine {}