Home Explore Blog CI



neovim

22th chunk of `runtime/doc/luvref.txt`
5dd400c6487310094db91682e4ba0001bc7ea71c9fc480680000000100000fa0
 either be a Lua string or a table of strings. If a
                table is passed in, the C backend will use writev to send all
                strings in a single system call.

                The optional `callback` is for knowing when the write is
                complete.

                Returns: `uv_write_t userdata` or `fail`

uv.write2({stream}, {data}, {send_handle} [, {callback}])          *uv.write2()*

                > method form `stream:write2(data, send_handle, [callback])`

                Parameters:
                - `stream`: `userdata` for sub-type of |uv_stream_t|
                - `data`: `buffer`
                - `send_handle`: `userdata` for sub-type of |uv_stream_t|
                - `callback`: `callable` or `nil`
                  - `err`: `nil` or `string`

                Extended write function for sending handles over a pipe. The
                pipe must be initialized with `ipc` option `true`.

                Returns: `uv_write_t userdata` or `fail`

                Note: `send_handle` must be a TCP socket or pipe, which is a
                server or a connection (listening or connected state). Bound
                sockets or pipes will be assumed to be servers.

uv.try_write({stream}, {data})                                  *uv.try_write()*

                > method form `stream:try_write(data)`

                Parameters:
                - `stream`: `userdata` for sub-type of |uv_stream_t|
                - `data`: `buffer`

                Same as |uv.write()|, but won't queue a write request if it
                can't be completed immediately.

                Will return number of bytes written (can be less than the
                supplied buffer size).

                Returns: `integer` or `fail`

uv.try_write2({stream}, {data}, {send_handle})                 *uv.try_write2()*

                > method form `stream:try_write2(data, send_handle)`

                Parameters:
                - `stream`: `userdata` for sub-type of |uv_stream_t|
                - `data`: `buffer`
                - `send_handle`: `userdata` for sub-type of |uv_stream_t|

                Like |uv.write2()|, but with the properties of
                |uv.try_write()|. Not supported on Windows, where it returns
                `UV_EAGAIN`.

                Will return number of bytes written (can be less than the
                supplied buffer size).

                Returns: `integer` or `fail`

uv.is_readable({stream})                                      *uv.is_readable()*

                > method form `stream:is_readable()`

                Parameters:
                - `stream`: `userdata` for sub-type of |uv_stream_t|

                Returns `true` if the stream is readable, `false` otherwise.

                Returns: `boolean`

uv.is_writable({stream})                                      *uv.is_writable()*

                > method form `stream:is_writable()`

                Parameters:
                - `stream`: `userdata` for sub-type of |uv_stream_t|

                Returns `true` if the stream is writable, `false` otherwise.

                Returns: `boolean`

uv.stream_set_blocking({stream}, {blocking})          *uv.stream_set_blocking()*

                > method form `stream:set_blocking(blocking)`

                Parameters:
                - `stream`: `userdata` for sub-type of |uv_stream_t|
                - `blocking`: `boolean`

                Enable or disable blocking mode for a stream.

                When blocking mode is enabled all writes complete
                synchronously. The interface remains unchanged otherwise, e.g.
                completion or failure of the operation will still be reported
                through a callback which is made asynchronously.

                Returns: `0` or `fail`

                WARNING: Relying too much on this API is not recommended. It
                is likely to change significantly in the future. Currently
          

Title: Libuv Stream Write, Readability, Writability, and Blocking Functions
Summary
This section details libuv stream functions for writing and checking stream status. It covers `uv.write2()`, which is an extended write function to send handles over a pipe. It also describes `uv.try_write()` and `uv.try_write2()`, which are similar to `uv.write()` and `uv.write2()` respectively, but do not queue write requests if they cannot be completed immediately. Additionally, it explains `uv.is_readable()` and `uv.is_writable()`, which return boolean values indicating whether a stream is readable or writable. Finally, it details `uv.stream_set_blocking()`, which enables or disables blocking mode for a stream, causing writes to complete synchronously, and notes that this API is subject to change.