diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-03-05 16:13:23 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-03-05 16:13:23 +0100 |
commit | cc925d97f41c7909cf911102365929aabc7aae2e (patch) | |
tree | cc563ad8eba03f00f75e1f7d16ebdb58752e51ef /lib/pure/net.nim | |
parent | ef36a9dc3d0cce83442fda8c8d50738c470ca5c3 (diff) | |
download | Nim-cc925d97f41c7909cf911102365929aabc7aae2e.tar.gz |
the stdlib supports &= in more contexts; refs #3524
Diffstat (limited to 'lib/pure/net.nim')
-rw-r--r-- | lib/pure/net.nim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/pure/net.nim b/lib/pure/net.nim index dbb78c4de..b9764edd3 100644 --- a/lib/pure/net.nim +++ b/lib/pure/net.nim @@ -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. |