Skip to main content

translate_enum

Macro translate_enum 

Source
macro_rules! translate_enum {
    ($target:expr, $value:expr, $map:expr, $(
        ($method:ident, { $($str_val:literal => $variant:expr),* $(,)? })
    ),* $(,)?) => { ... };
}
Expand description

Used to translate string values in serde_json::Value into enum variants via DataPack<String>, avoiding a lot of duplicate match-and-build code.