uvcc
libuv C++ bindings
uv::write Class Reference

Stream write request type. More...

#include "request-stream.hpp"

Inheritance diagram for uv::write:
uv::request

Public Types

using uv_t = ::uv_write_t
 
using on_request_t = std::function< void(write _request, buffer _buffer) >
 The function type of the callback called after data was written on a stream. More...
 
- Public Types inherited from uv::request
using uv_t = ::uv_req_t
 
using on_destroy_t = std::function< void(void *_data) >
 The function type of the callback called when the request object is about to be destroyed.
 

Public Member Functions

 write (const write &)=default
 
writeoperator= (const write &)=default
 
 write (write &&) noexcept=default
 
writeoperator= (write &&) noexcept=default
 
on_request_ton_request () const noexcept
 
stream handle () const noexcept
 The stream which this write request has been running on.
 
stream send_handle () const noexcept
 The handle of the stream to be sent over a pipe using this write request.
 
int run (stream &_stream, const buffer &_buf)
 Run the request. More...
 
int run (pipe &_pipe, const buffer &_buf, stream &_send_handle)
 The overload for sending handles over a pipe. More...
 
int try_write (stream &_stream, const buffer &_buf)
 
 operator const uv_t * () const noexcept
 
 operator uv_t * () noexcept
 
- Public Member Functions inherited from uv::request
 request (const request &_that)
 
requestoperator= (const request &_that)
 
 request (request &&_that) noexcept
 
requestoperator= (request &&_that) noexcept
 
void swap (request &_that) noexcept
 
std::uintptr_t id () const noexcept
 
long nrefs () const noexcept
 The current number of existing references to the same object as this request variable refers to.
 
int uv_status () const noexcept
 The status value returned by the last executed libuv API function on this request.
 
on_destroy_ton_destroy () const noexcept
 
::uv_req_type type () const noexcept
 The tag indicating a libuv type of the request. More...
 
const char * type_name () const noexcept
 A string containing the name of the request type.
 
void *const & data () const noexcept
 The pointer to the user-defined arbitrary data. libuv and uvcc does not use this field.
 
void *& data () noexcept
 
int cancel () noexcept
 Cancel a pending request. More...
 
 operator const uv_t * () const noexcept
 
 operator uv_t * () noexcept
 
 operator bool () const noexcept
 Equivalent to (uv_status() >= 0).
 

Detailed Description

Stream write request type.

See also
libuv API documentation: uv_stream_t — Stream handle.

Definition at line 126 of file request-stream.hpp.

Member Typedef Documentation

◆ on_request_t

using uv::write::on_request_t = std::function< void(write _request, buffer _buffer) >

The function type of the callback called after data was written on a stream.

See also
libuv API documentation: uv_write_cb.

Definition at line 137 of file request-stream.hpp.

Member Function Documentation

◆ run() [1/2]

int uv::write::run ( stream _stream,
const buffer _buf 
)
inline

Run the request.

See also
libuv API documentation: uv_write().

Definition at line 186 of file request-stream.hpp.

◆ run() [2/2]

int uv::write::run ( pipe _pipe,
const buffer _buf,
stream _send_handle 
)
inline

The overload for sending handles over a pipe.

See also
libuv API documentation: uv_write2().

Definition at line 218 of file request-stream.hpp.

◆ try_write()

int uv::write::try_write ( stream _stream,
const buffer _buf 
)
inline

The wrapper for a corresponding libuv function.

Note
It tries to execute and complete immediately and does not call the request callback.
See also
libuv API documentation: uv_try_write().

Definition at line 255 of file request-stream.hpp.


The documentation for this class was generated from the following file: