import std/typetraits, preserves type Notify*[E] {.preservesRecord: "notify".} = ref object `summary`*: string `body`*: Preserve[E] `timeout`*: int `urgency`*: Urgency `Urgency`* {.preservesOr, pure.} = enum `Low`, `Normal`, `Critical` proc `$`*[E](x: Notify[E]): string = `$`(toPreserve(x, E)) proc encode*[E](x: Notify[E]): seq[byte] = encode(toPreserve(x, E))