|
Clio
develop
The XRP Ledger API server.
|
The receiving end of a channel. More...
#include <Channel.hpp>
Public Member Functions | |
| Receiver (Receiver &&)=default | |
| Receiver (Receiver const &)=default | |
| Receiver (Receiver const &)=delete | |
| Receiver & | operator= (Receiver &&)=default |
| Receiver & | operator= (Receiver const &)=default |
| Receiver & | operator= (Receiver const &)=delete |
| std::optional< T > | tryReceive () |
| Attempts to receive data from the channel without blocking. | |
| std::optional< T > | asyncReceive (boost::asio::yield_context yield) |
| Asynchronously receives data from the channel using a coroutine. | |
| void | asyncReceive (std::invocable< std::optional< std::remove_cvref_t< T > > > auto &&fn) |
| Asynchronously receives data from the channel using a callback. | |
| bool | isClosed () const |
| Checks if the channel is closed. | |
Friends | |
| class | Channel< T, P, C > |
The receiving end of a channel.
Receiver is movable. For multi-consumer channels, Receiver is also copyable. Multiple receivers can consume from the same multi-consumer channel concurrently. When all Receiver instances are destroyed, the channel is closed and senders will fail to send.
|
inlinenodiscard |
Asynchronously receives data from the channel using a coroutine.
Blocks the coroutine until data is available or the channel is closed.
| yield | The Boost.Asio yield context for coroutine suspension |
|
inline |
Asynchronously receives data from the channel using a callback.
The callback is invoked when data is available or the channel is closed.
| fn | Callback function invoked with std::optional containing the value, or std::nullopt if closed |
|
inlinenodiscard |
Checks if the channel is closed.
A channel is closed when all Sender instances have been destroyed.
|
inline |
Attempts to receive data from the channel without blocking.