Sha256: 5514017a4e11878ac5e3e9c3eea1819369e7fe2184d2adf1bffc80429c57b8e6

Contents?: true

Size: 1.79 KB

Versions: 24

Compression:

Stored size: 1.79 KB

Contents

[/
 / Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
 /
 / Distributed under the Boost Software License, Version 1.0. (See accompanying
 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 /]

[section:WriteHandler Write handler requirements]

A write handler must meet the requirements for a [link
asio.reference.Handler handler]. A value `h` of a write handler class
should work correctly in the expression `h(ec, s)`, where `ec` is an lvalue of
type `const error_code` and `s` is an lvalue of type `const size_t`.

[heading Examples]

A free function as a write handler:

  void write_handler(
      const asio::error_code& ec,
      std::size_t bytes_transferred)
  {
    ...
  }

A write handler function object:

  struct write_handler
  {
    ...
    void operator()(
        const asio::error_code& ec,
        std::size_t bytes_transferred)
    {
      ...
    }
    ...
  };

A lambda as a write handler:

  socket.async_write(...
      [](const asio::error_code& ec,
        std::size_t bytes_transferred)
      {
        ...
      });

A non-static class member function adapted to a write handler using
`std::bind()`:

  void my_class::write_handler(
      const asio::error_code& ec,
      std::size_t bytes_transferred)
  {
    ...
  }
  ...
  socket.async_write(...,
      std::bind(&my_class::write_handler,
        this, std::placeholders::_1,
        std::placeholders::_2));

A non-static class member function adapted to a write handler using
`boost::bind()`:

  void my_class::write_handler(
      const asio::error_code& ec,
      std::size_t bytes_transferred)
  {
    ...
  }
  ...
  socket.async_write(...,
      boost::bind(&my_class::write_handler,
        this, asio::placeholders::error,
        asio::placeholders::bytes_transferred));

[endsect]

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
couchbase-3.0.0-universal-darwin-19 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.beta.1-universal-darwin-19 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.beta.1 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.5-x86_64-linux ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.5-universal-darwin-19 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.5-x86_64-darwin-19 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.5 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.4-x86_64-linux ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.4-x86_64-darwin-19 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.4-universal-darwin-19 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.4 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.3-x86_64-linux ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.3-x86_64-darwin-19 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.3-universal-darwin-19 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.3 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.2-x86_64-linux ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.2-x86_64-darwin-19 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.2-universal-darwin-19 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk
couchbase-3.0.0.alpha.2 ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk