mirror of
https://github.com/vacp2p/mix.git
synced 2026-01-10 00:18:17 -05:00
chore: add comments to public API (#83)
This commit is contained in:
3
mix.nim
3
mix.nim
@@ -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]).} =
|
||||
|
||||
Reference in New Issue
Block a user