rename toSeq to toSequence to avoid conflicting with system.toSeq

This commit is contained in:
Jaremy Creechley 2023-10-23 13:07:49 -07:00
parent 5dcd8ce628
commit 48157960f4
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
3 changed files with 7 additions and 7 deletions

View File

@ -87,7 +87,7 @@ proc setData*[T: byte | char](db: DataBuffer, data: openArray[T]) =
copyMem(db[].buf, baseAddr data, data.len())
db[].size = data.len()
proc toSeq*(self: DataBuffer): seq[byte] =
proc toSequence*(self: DataBuffer): seq[byte] =
## convert buffer to a seq type using copy and either a byte or char
##
@ -100,7 +100,7 @@ proc `@`*(self: DataBuffer): seq[byte] =
## either a byte or char
##
self.toSeq()
self.toSequence()
proc toString*(data: DataBuffer): string =
## convert buffer to string type using copy

View File

@ -242,7 +242,7 @@ proc get*[BT](self: ThreadProxy[BT],
let key = KeyId.new key.id()
self.tp.spawn getTask(ctx, ds, key)
return ctx[].res.toRes(v => v.toSeq())
return ctx[].res.toRes(v => v.toSequence())
proc close*[BT](self: ThreadProxy[BT]): Future[?!void] {.async.} =
await self.semaphore.closeAll()
@ -352,7 +352,7 @@ proc query*[BT](self: ThreadProxy[BT],
else:
let qres = ctx[].res.get()
let key = qres.key.map(proc (k: KeyId): Key = k.toKey())
let data = qres.data.toSeq()
let data = qres.data.toSequence()
return (?!QueryResponse).ok((key: key, data: data))
except CancelledError as exc:
trace "Cancelling thread future!", exc = exc.msg

View File

@ -45,7 +45,7 @@ proc thread2(val: int) {.thread.} =
echo "thread2: receiving "
let msg: DataBuffer = shareVal
echo "thread2: received: ", msg
check string.fromBytes(msg.toSeq()) == "hello world"
check string.fromBytes(msg.toSequence()) == "hello world"
# os.sleep(100)
proc runBasicTest() =
@ -104,10 +104,10 @@ suite "Share buffer test":
check Key.init($a).tryGet == k1
test "seq conversion":
check string.fromBytes(a.toSeq()) == "/a/b"
check string.fromBytes(a.toSequence()) == "/a/b"
test "seq conversion":
check a.toSeq() == "/a/b".toBytes
check a.toSequence() == "/a/b".toBytes
test "basic null terminate test":
let cstr = DataBuffer.new("test", {dbNullTerminate})