I've got this desirializer, for which i need to get the base of the types if they're distinct, i'm using distinctBase, but if the given type isn't distinct I get an error distinctBase expects a distinct type as argument. The given type was uint32, so i need a way to check if a type is distinct in order to only use distinctBase if the type is infact distinct. Here's part of the code in question
# Seq[Byte]
proc decode(data: string, outValue: var seq[byte], index: int) {.inline.} =
let location = fromHex[int](data[index*32*2..(index+1)*32*2-1])
var startIdx=location*2
var endIdx=location*2+32*2-1
let size = fromHex[int](data[startIdx..endIdx])
startIdx+=32*2
endIdx+=size*2
outValue = (data[startIdx..endIdx]).hexToSeqByte()
# Integer
proc decode(data: string, outValue: var SomeInteger, index: int) {.inline} =
let value = fromHex[SomeInteger](data[index*32*2..(index+1)*32*2-1])
outValue = value
proc decode[T: object](data: string, outValue: var T, index: int = 0) {.inline.} =
var i = index
for name, field in outValue.fieldPairs:
decode(data, distinctBase(field), i)
i+=1