mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-04 06:53:12 +00:00
17 lines
404 B
Nim
17 lines
404 B
Nim
import results, std/strutils
|
|
|
|
type HealthStatus* {.pure.} = enum
|
|
INITIALIZING
|
|
SYNCHRONIZING
|
|
READY
|
|
NOT_READY
|
|
NOT_MOUNTED
|
|
SHUTTING_DOWN
|
|
|
|
proc init*(t: typedesc[HealthStatus], strRep: string): Result[HealthStatus, string] =
|
|
try:
|
|
let status = parseEnum[HealthStatus](strRep)
|
|
return ok(status)
|
|
except ValueError:
|
|
return err("Invalid HealthStatus string representation: " & strRep)
|