mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-10 23:06:34 +00:00
29614e2e52
* Simplifying libwaku.nim by extracting config parser to config.nim * Adding json_base_event.nim * Starting to control-version the libwaku.h We are creating this libwaku.h inspired by the one that is automatically generated by the nim compiler when `make libwaku` is invoked. Therefore, the self-generated header is then placed in: nimcache/release/libwaku/libwaku.h * Better waku_example.c organization * libwaku.nim: better memory management We need to create a 'cstring' internally from the 'const char*' passed from outside the library. We invoke 'allocShared' in order to create the internal 'cstring', and invoke 'deallocShared' in order to manually free the memory.
18 lines
343 B
Nim
18 lines
343 B
Nim
|
|
import
|
|
std/json
|
|
import
|
|
./json_base_event
|
|
|
|
type JsonErrorEvent* = ref object of JsonEvent
|
|
message*: string
|
|
|
|
proc new*(T: type JsonErrorEvent,
|
|
message: string): T =
|
|
|
|
return JsonErrorEvent(
|
|
eventType: "error",
|
|
message: message)
|
|
|
|
method `$`*(jsonError: JsonErrorEvent): string =
|
|
$( %* jsonError ) |