toString --> $.

This commit is contained in:
Charles Blake
2015-08-03 12:26:08 -04:00
parent c6d609f88b
commit c373c7209a
2 changed files with 2 additions and 2 deletions

View File

@@ -254,7 +254,7 @@ type MemSlice* = object ## represent slice of a MemFile for iteration over deli
proc c_memcpy(a, b: pointer, n: int) {.importc: "memcpy", header: "<string.h>".}
proc toString*(ms: MemSlice): string {.inline.} =
proc `$`*(ms: MemSlice): string {.inline.} =
## Return a Nim string built from a MemSlice.
var buf = newString(ms.size)
c_memcpy(addr(buf[0]), ms.data, ms.size)

View File

@@ -2,5 +2,5 @@ import memfiles
var inp = memfiles.open("readme.txt")
for mem in memSlices(inp):
if mem.size > 3:
echo("#" & toString(mem) & "#")
echo("#" & $mem & "#")
close(inp)