refactor: derive Ruby action namespaces from Rust catalog

This commit is contained in:
Valdemar Lorenzen
2026-10-09 17:07:29 +02:00
parent dbafaf6266
commit 18dc8cc155
5 changed files with 67 additions and 34 deletions
+9
View File
@@ -476,6 +476,15 @@ const CORE_ACTIONS: &[(&str, Action, &[Mode])] = &[
),
];
/// Serializes the authoritative action names without copying the catalog.
pub(crate) struct CoreActionCatalog;
impl Serialize for CoreActionCatalog {
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
serializer.collect_seq(CORE_ACTIONS.iter().map(|(name, _, _)| *name))
}
}
impl Action {
fn named(mode: Mode, name: &str) -> Option<Self> {
CORE_ACTIONS