15 lines
264 B
Nim
15 lines
264 B
Nim
|
|
||
|
import
|
||
|
std/typetraits, preserves
|
||
|
|
||
|
type
|
||
|
JsonSocket* {.preservesRecord: "json-socket".} = object
|
||
|
`label`*: Symbol
|
||
|
`path`*: string
|
||
|
|
||
|
proc `$`*(x: JsonSocket): string =
|
||
|
`$`(toPreserve(x))
|
||
|
|
||
|
proc encode*(x: JsonSocket): seq[byte] =
|
||
|
encode(toPreserve(x))
|