mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-07-31 17:03:14 +00:00
* change all usage of std.options.Option[T] to results.Opt[T] * fix broken apps and examples (to validate refactor) * removed all std/options code added for libp2p v2 migration * add broker Opt codec to persistency/backend_comm.nim * add a readValue overload for Opt[T] in tools/confutils/cli_args.nim * keep Option where required (Presto, confutils' config_file.nim) * Change generateRlnProof error handling * Fix imports
29 lines
625 B
Nim
29 lines
625 B
Nim
import results
|
|
|
|
type PagingDirection* {.pure.} = enum
|
|
## PagingDirection determines the direction of pagination
|
|
BACKWARD = uint32(0)
|
|
FORWARD = uint32(1)
|
|
|
|
proc default*(): PagingDirection {.inline.} =
|
|
PagingDirection.FORWARD
|
|
|
|
proc into*(b: bool): PagingDirection =
|
|
PagingDirection(b)
|
|
|
|
proc into*(b: Opt[bool]): PagingDirection =
|
|
if b.isNone():
|
|
return default()
|
|
b.get().into()
|
|
|
|
proc into*(d: PagingDirection): bool =
|
|
d == PagingDirection.FORWARD
|
|
|
|
proc into*(d: Opt[PagingDirection]): bool =
|
|
if d.isNone():
|
|
return false
|
|
d.get().into()
|
|
|
|
proc into*(s: string): PagingDirection =
|
|
(s == "true").into()
|