Writing custom #[derive(Html)]


#1
  1. I know about #[derive(Debug)].

  2. I want learn how to build #[derive(Html)], which is like Debug, except it outputs a HTML fragment, which when viewed, pretty-prints the struct. (For example, the struct becomes a table, with lhs = field name, rhs = recursive Html of the data).

  3. I have no idea how to approach this problem (but am decently familiar with Rust). What resources are recommended?

  4. This is not a “hw question”, feel free to post full solution if it is easy to do :slight_smile:


#2

“Custom derive” is what you’re looking for.