31 lines
855 B
Nim
31 lines
855 B
Nim
|
|
import
|
|
preserves
|
|
|
|
type
|
|
Output* {.preservesRecord: "recv-json".} = object
|
|
`field0`*: Preserve[void]
|
|
|
|
JsonTranslatorArguments* {.preservesDictionary.} = object
|
|
`dataspace`* {.preservesEmbedded.}: Preserve[void]
|
|
|
|
JsonTranslatorConnected* {.preservesRecord: "connected".} = object
|
|
`path`*: string
|
|
|
|
JsonSocketTranslatorArguments* {.preservesDictionary.} = object
|
|
`dataspace`* {.preservesEmbedded.}: Preserve[void]
|
|
`socket`*: string
|
|
|
|
Input* {.preservesRecord: "send-json".} = object
|
|
`field0`*: Preserve[void]
|
|
|
|
proc `$`*(x: Output | JsonTranslatorArguments | JsonTranslatorConnected |
|
|
JsonSocketTranslatorArguments |
|
|
Input): string =
|
|
`$`(toPreserve(x))
|
|
|
|
proc encode*(x: Output | JsonTranslatorArguments | JsonTranslatorConnected |
|
|
JsonSocketTranslatorArguments |
|
|
Input): seq[byte] =
|
|
encode(toPreserve(x))
|