Add isNil for Preserve
Not a ref type, but add `isNil` for checking if a Perserve is zero-initialized.
This commit is contained in:
parent
8985060055
commit
f0c1ebe85e
|
@ -59,6 +59,10 @@ proc assertValid*(prs: Preserve) =
|
||||||
else:
|
else:
|
||||||
discard
|
discard
|
||||||
|
|
||||||
|
proc isNil*(prs: Preserve): bool =
|
||||||
|
## Check if ``prs`` is equivalent to the zero-initialized ``Preserve``.
|
||||||
|
prs.kind == pkBoolean and prs.bool == false
|
||||||
|
|
||||||
proc `<`(x, y: string | seq[byte]): bool =
|
proc `<`(x, y: string | seq[byte]): bool =
|
||||||
for i in 0 .. min(x.high, y.high):
|
for i in 0 .. min(x.high, y.high):
|
||||||
if x[i] < y[i]:
|
if x[i] < y[i]:
|
||||||
|
|
Loading…
Reference in New Issue