about summary refs log blame commit diff stats
path: root/src/bindings/constcharp.nim
blob: f1753147d61f3ff183e98e5a62dfc6d88df313ef (plain) (tree)
1
2
3
4
5
6



                                                       
                                                         
                                             
type
  cstringConstImpl {.importc: "const char*".} = cstring
  cstringConst* = distinct cstringConstImpl

proc `[]`*(s: cstringConst; i: int): char = cstring(s)[i]
proc `$`*(s: cstringConst): string {.borrow.}