chore: add comments to public API (#83)

This commit is contained in:
richΛrd
2025-09-08 11:14:59 -04:00
committed by GitHub
parent f380a0eb8c
commit eb4b8d4ff1
5 changed files with 29 additions and 1 deletions

View File

@@ -26,12 +26,15 @@ export registerDestReadBehavior
export MixNodes
proc readLp*(maxSize: int): destReadBehaviorCb =
## create callback to read length prefixed msg, with the length encoded as a varint
return proc(
conn: Connection
): Future[seq[byte]] {.async: (raises: [CancelledError, LPStreamError]).} =
await conn.readLp(maxSize)
proc readExactly*(nBytes: int): destReadBehaviorCb =
## create callback that waits for `nbytes` to be available, then read
## them and return them
return proc(
conn: Connection
): Future[seq[byte]] {.async: (raises: [CancelledError, LPStreamError]).} =