mirror of https://github.com/vacp2p/nim-libp2p.git
adding bool suport to protobuf methods
This commit is contained in:
parent
003b72ec27
commit
875ec346e6
|
@ -90,6 +90,11 @@ proc initProtoField*(index: int, value: SomeVarint): ProtoField =
|
||||||
else:
|
else:
|
||||||
result.vint = cast[uint64](value)
|
result.vint = cast[uint64](value)
|
||||||
|
|
||||||
|
proc initProtoField*(index: int, value: bool): ProtoField =
|
||||||
|
## Initialize ProtoField with integer value.
|
||||||
|
result = ProtoField(kind: Varint, index: index)
|
||||||
|
result.vint = byte(value)
|
||||||
|
|
||||||
proc initProtoField*(index: int, value: openarray[byte]): ProtoField =
|
proc initProtoField*(index: int, value: openarray[byte]): ProtoField =
|
||||||
## Initialize ProtoField with bytes array.
|
## Initialize ProtoField with bytes array.
|
||||||
result = ProtoField(kind: Length, index: index)
|
result = ProtoField(kind: Length, index: index)
|
||||||
|
|
Loading…
Reference in New Issue