en	Streams

en	A __Stream__ is a communication channel where data is reliably transferred as an ordered sequence of bytes. Streams are either synchronous or asynchronous, and may allow reading, writing, or both. Note that a particular type may model more than one concept. For example, the networking types __socket__ and __ssl_stream__ support both __SyncStream__ and __AsyncStream__. All stream algorithms in Beast are declared as template functions using these concepts:

en	Stream Concepts

en	Concept

en	Description

en	__SyncReadStream__

en	Supports buffer-oriented blocking reads.

en	__SyncWriteStream__

en	Supports buffer-oriented blocking writes.

en	__SyncStream__

en	A stream supporting buffer-oriented blocking reads and writes.

en	__AsyncReadStream__

en	Supports buffer-oriented asynchronous reads.

en	__AsyncWriteStream__

en	Supports buffer-oriented asynchronous writes.

en	__AsyncStream__

en	A stream supporting buffer-oriented asynchronous reads and writes.

en	These template metafunctions check whether a given type meets the requirements for the various stream concepts, and some additional useful utilities. The library uses these type checks internally and also provides them as public interfaces so users may use the same techniques to augment their own code. The use of these type checks helps provide more concise errors during compilation:

en	Type Traits and Metafunctions

en	Name

en	Description

en	[link beast.ref.boost__beast__executor_type `executor_type`]

en	An alias for the type of object returned by `get_executor`.

en	[link beast.ref.boost__beast__has_get_executor `has_get_executor`]

en	Determine if the `get_executor` member function is present.

en	[link beast.ref.boost__beast__is_async_read_stream `is_async_read_stream`]

en	Determine if a type meets the requirements of __AsyncReadStream__.

en	[link beast.ref.boost__beast__is_async_stream `is_async_stream`]

en	Determine if a type meets the requirements of both __AsyncReadStream__ and __AsyncWriteStream__.

en	[link beast.ref.boost__beast__is_async_write_stream `is_async_write_stream`]

en	Determine if a type meets the requirements of __AsyncWriteStream__.

en	[link beast.ref.boost__beast__is_sync_read_stream `is_sync_read_stream`]

en	Determine if a type meets the requirements of __SyncReadStream__.

en	[link beast.ref.boost__beast__is_sync_stream `is_sync_stream`]

en	Determine if a type meets the requirements of both __SyncReadStream__ and __SyncWriteStream__.

en	[link beast.ref.boost__beast__is_sync_write_stream `is_sync_write_stream`]

en	Determine if a type meets the requirements of __SyncWriteStream__.

en	Using the type checks with `static_assert` on function or class template types will provide users with helpful error messages and prevent undefined behaviors. This example shows how a template function which writes to a synchronous stream may check its argument: