1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright (C) 2026 ren-yamanashi
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License, version 2.0,
// as published by the Free Software Foundation.
//
// This program is designed to work with certain software (including
// but not limited to OpenSSL) that is licensed under separate terms,
// as designated in a particular file or component or in included license
// documentation. The authors of this program hereby grant you an additional
// permission to link the program and your derivative works with the
// separately licensed software that they have either included with
// the program or referenced in the documentation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <https://www.gnu.org/licenses/>.
//! Procedural macros for `mysql-handler` engine cdylibs.
//!
//! The single macro this crate exposes, [`plugin`], generates the
//! three `#[unsafe(no_mangle)] pub static` items mysqld dlsyms at
//! `INSTALL PLUGIN` time, plus the panic-safe init wrapper that
//! registers the engine factory.
// `pub(crate)` on internal items is required for `unreachable_pub`;
// the resulting `redundant_pub_crate` lint is a false positive here.
use TokenStream;
use ;
use cratePluginArgs;
/// 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
///
/// ```ignore
/// 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 {}
/// ```