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