the stdlib supports &= in more contexts; refs #3524
This commit is contained in:
parent
ef36a9dc3d
commit
cc925d97f4
3 changed files with 10 additions and 0 deletions
|
|
@ -895,6 +895,10 @@ proc send*(socket: Socket, data: string,
|
|||
if sent != data.len:
|
||||
raiseOSError(osLastError(), "Could not send all data.")
|
||||
|
||||
template `&=`*(socket: Socket; data: typed) =
|
||||
## an alias for 'send'.
|
||||
send(socket, data)
|
||||
|
||||
proc trySend*(socket: Socket, data: string): bool {.tags: [WriteIOEffect].} =
|
||||
## Safe alternative to ``send``. Does not raise an EOS when an error occurs,
|
||||
## and instead returns ``false`` on failure.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue