You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1021 B

11 months ago
std/typetraits, preserves
XdgOpen* {.preservesRecord: "xdg-open".} = object
`uris`*: seq[string]
11 months ago
UriRunnerConfigKind* {.pure.} = enum
`ListenOn`, `ActionHandler`
`UriRunnerConfig`*[E] {.preservesOr.} = ref object
case orKind*: UriRunnerConfigKind
of UriRunnerConfigKind.`ListenOn`:
`listenon`*: ListenOn[E]
11 months ago
of UriRunnerConfigKind.`ActionHandler`:
`actionhandler`*: ActionHandler[E]
11 months ago
ListenOn*[E] {.preservesRecord: "listen-on".} = ref object
`dataspace`*: Preserve[E]
ActionHandler*[E] {.preservesRecord: "action-handler".} = ref object
11 months ago
`pat`*: string
`action`*: Preserve[E]
`entity`*: Preserve[E]
11 months ago
proc `$`*[E](x: UriRunnerConfig[E] | ListenOn[E] | ActionHandler[E]): string =
11 months ago
`$`(toPreserve(x, E))
proc encode*[E](x: UriRunnerConfig[E] | ListenOn[E] | ActionHandler[E]): seq[
byte] =
11 months ago
encode(toPreserve(x, E))
proc `$`*(x: XdgOpen): string =
11 months ago
proc encode*(x: XdgOpen): seq[byte] =
11 months ago