Serialize Data Structures With Key Value Pairs In Rust

April 2023

Add this to enums:

use serde::Serialize;

#[derive(Debug, PartialEq, Serialize)]
#[serde(tag = "type", content = "content", rename_all = "lowercase")]
pub enum Widget {
  Alfa,
  Bravo
}

That will display the type for each element so you can access them by key in (for example) minijinja

TODO

    ☐

    talk about the different parts there and the derive stuff that helps with the basic usage

end of line