setItems iterator
This commit is contained in:
parent
b099475d25
commit
db3e302067
|
@ -5,8 +5,8 @@ import bigints
|
||||||
|
|
||||||
type
|
type
|
||||||
PreserveKind* = enum
|
PreserveKind* = enum
|
||||||
pkBoolean, pkFloat, pkDouble, pkSignedInteger, pkBigInteger, pkString, pkByteString,
|
pkBoolean, pkFloat, pkDouble, pkSignedInteger, pkBigInteger, pkString,
|
||||||
pkSymbol, pkRecord, pkSequence, pkSet, pkDictionary, pkEmbedded
|
pkByteString, pkSymbol, pkRecord, pkSequence, pkSet, pkDictionary, pkEmbedded
|
||||||
|
|
||||||
Preserve*[T] {.acyclic.} = object
|
Preserve*[T] {.acyclic.} = object
|
||||||
## Type that stores a Preserves value.
|
## Type that stores a Preserves value.
|
||||||
|
@ -144,8 +144,10 @@ proc fields*[T](prs: Preserve[T]): seq[Preserve[T]] {.inline.} =
|
||||||
|
|
||||||
iterator fields*[T](prs: Preserve[T]): Preserve[T] =
|
iterator fields*[T](prs: Preserve[T]): Preserve[T] =
|
||||||
## Iterate the fields of a record value.
|
## Iterate the fields of a record value.
|
||||||
for i in 1..prs.record.high:
|
for i in 1..prs.record.high: yield prs.record[i]
|
||||||
yield prs.record[i]
|
|
||||||
|
iterator setItems*[T](prs: Preserve[T]): Preserve[T] =
|
||||||
|
for v in prs.set.keys: yield v
|
||||||
|
|
||||||
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):
|
||||||
|
|
Loading…
Reference in New Issue