svui/nim/svui.nim

15 lines
295 B
Nim

import
std/typetraits, preserves, std/tables
type
Svui*[E] {.preservesRecord: "svui".} = ref object
`attrs`*: Table[string, Preserve[E]]
`svg`*: string
proc `$`*[E](x: Svui[E]): string =
`$`(toPreserve(x, E))
proc encode*[E](x: Svui[E]): seq[byte] =
encode(toPreserve(x, E))