diff options
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. |