/ tests / custom_formatters_types.nim
custom_formatters_types.nim
 1  import chronicles/formats
 2  
 3  type
 4    AttestationData* = object
 5      peer*: Peer
 6      attestation*: string
 7      signature*: string
 8  
 9    Peer* = object
10      privData: seq[int]
11      name*: string
12  
13  expandIt(AttestationData):
14    attestation = it.attestation
15    peer = it.peer
16  
17    # This shouldn't be renamed
18    it = "not renamed"
19  
20    # But the quote syntax can be used to derive names from the original property name
21    `it sig` = it.signature
22    `it` = "renamed"
23    `"complex_" it "_concatenation"` = Peer(name: "X")
24  
25  formatIt(Peer):
26    it.name