mirror of https://github.com/status-im/nim-rlp.git
support for encoding and decoding of bool values
This commit is contained in:
parent
3b2ce4e464
commit
961cc48b11
4
rlp.nim
4
rlp.nim
|
@ -293,6 +293,10 @@ proc readImpl(rlp: var Rlp, T: typedesc[enum]): T =
|
|||
result = type(result)(rlp.toInt(int))
|
||||
rlp.skipElem
|
||||
|
||||
proc readImpl(rlp: var Rlp, T: typedesc[bool]): T =
|
||||
result = rlp.toInt(int) != 0
|
||||
rlp.skipElem
|
||||
|
||||
proc readImpl[R, E](rlp: var Rlp, T: type array[R, E]): T =
|
||||
mixin read
|
||||
|
||||
|
|
|
@ -191,6 +191,9 @@ template appendImpl(self; i: Integer) =
|
|||
template appendImpl(self; e: enum) =
|
||||
appendImpl(self, int(e))
|
||||
|
||||
template appendImpl(self; b: bool) =
|
||||
appendImpl(self, int(b))
|
||||
|
||||
proc appendImpl[T](self; listOrBlob: openarray[T]) =
|
||||
mixin append
|
||||
|
||||
|
|
Loading…
Reference in New Issue