diff options
Diffstat (limited to 'src/bindings/constcharp.nim')
-rw-r--r-- | src/bindings/constcharp.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bindings/constcharp.nim b/src/bindings/constcharp.nim new file mode 100644 index 00000000..057b8acb --- /dev/null +++ b/src/bindings/constcharp.nim @@ -0,0 +1,6 @@ +type + cstringConstImpl {.importc: "const char*".} = cstring + cstringConst* = distinct cstringConstImpl + +proc `[]`*(s: cstringConst, i: int): char = cstring(s)[i] +proc `$`*(s: cstringConst): string {.borrow.} |