From a5d234e0c204f38fc2fbd9827e120f0513b84bb3 Mon Sep 17 00:00:00 2001 From: Yu-Vitaqua-fer-Chronos Date: Thu, 25 Jan 2024 21:57:01 +0000 Subject: [PATCH] Doc edits --- src/nulid.nim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/nulid.nim b/src/nulid.nim index ff64d04..234c056 100644 --- a/src/nulid.nim +++ b/src/nulid.nim @@ -58,7 +58,7 @@ type ULIDGenerator* = ref object ## A `ULID` generator object, contains details needed to follow the spec. ## A generator was made to be compliant with the ULID spec and also to be - ## threadsafe not use globals that could change. + ## threadsafe. when NoLocks: lastTime: int64 # Timestamp of last ULID, 48 bits when not defined(js): @@ -328,9 +328,12 @@ func `$`*(ulid: ULID): string = result = JsBigInt.encode(ulid.toInt128(), 26) # std/json support -proc `%`*(u: ULID): JsonNode = newJString($u) +proc `%`*(u: ULID): JsonNode = + ## Serializes a `ULID` to JSON. + newJString($u) proc to*(j: JsonNode, _: typedesc[ULID]): ULID = + ## Deserializes a `ULID` from JSON. if j.kind != JString: raise newException(JsonKindError, "Expected a string!")