macro_rules! plugin_info {
() => { ... };
(title = $title:literal $(,)?) => { ... };
(namespace = $namespace:literal $(,)?) => { ... };
(namespace = $namespace:literal, title = $title:literal $(,)?) => { ... };
(title = $title:literal, namespace = $namespace:literal $(,)?) => { ... };
(@default) => { ... };
(@given $namespace:literal) => { ... };
(@build $namespace:expr) => { ... };
($($other:tt)*) => { ... };
}Expand description
What a plugin says about itself, filled from the Cargo.toml of the crate
that calls it: a PluginInfo with the calling crate’s
CARGO_PKG_NAME, CARGO_CRATE_NAME, CARGO_PKG_VERSION,
CARGO_PKG_DESCRIPTION, CARGO_PKG_HOMEPAGE, CARGO_PKG_REPOSITORY and
CARGO_PKG_LICENSE (an empty value gives None).
The namespace defaults to the package name without a leading
navree-plugin-, else without a leading navree-, with every - turned
into _ (navree-plugin-announcements gives announcements, acme-crm
gives acme_crm). Two optional keys, in any order: namespace = ".." sets
another namespace, title = ".." a display name. A namespace is a
lower-case letter followed by up to 63 lower-case letters, digits or _;
any other namespace, or a package name that gives none, is a compile error.
let info = navree_kernel::plugin_info!(namespace = "notice_board", title = "Notice board");
assert_eq!(info.namespace, "notice_board");
assert_eq!(info.title, Some("Notice board"));An unknown key and a namespace outside the grammar do not compile:
let _ = navree_kernel::plugin_info!(name = "announcements");let _ = navree_kernel::plugin_info!(namespace = "Notice-Board");