StormByte-Buffer 4.0.0
C++26 buffer module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Buffer::PipeOutput Class Referencefinal

Synchronous, non-owning stage output borrow with const mutation forwarding. More...

#include <StormByte/buffer/pipe.hxx>

Public Member Functions

 PipeOutput (WriteOnly &output) noexcept
 Borrow a live stream output.
bool Write (const StormByte::Safe::Binary &data) const noexcept
 Copy bytes to the borrowed writer.
bool Write (StormByte::Safe::Binary &&data) const noexcept
 Move bytes to the borrowed writer.
bool Write (std::string_view text) const noexcept
 Copy length-aware text without a trailing NUL.
bool IsWritable () const noexcept
 Query whether the writer accepts more data.
void Close () const noexcept
 Close the borrowed output and wake readers.
void SetError () const noexcept
 Fail the borrowed output and wake waiters.

Detailed Description

Synchronous, non-owning stage output borrow with const mutation forwarding.

Warning
Neither this facade nor its copies may outlive the callback. Constness does not make the underlying writer immutable or thread-safe.

Constructor & Destructor Documentation

◆ PipeOutput()

StormByte::Buffer::PipeOutput::PipeOutput ( WriteOnly & output)
explicitnoexcept

Borrow a live stream output.

Parameters
outputBuffer kept alive by the caller for the whole invocation.

Member Function Documentation

◆ Close()

void StormByte::Buffer::PipeOutput::Close ( ) const
noexcept

Close the borrowed output and wake readers.

◆ IsWritable()

bool StormByte::Buffer::PipeOutput::IsWritable ( ) const
noexcept

Query whether the writer accepts more data.

Returns
Whether the stream is writable.

◆ SetError()

void StormByte::Buffer::PipeOutput::SetError ( ) const
noexcept

Fail the borrowed output and wake waiters.

◆ Write() [1/3]

bool StormByte::Buffer::PipeOutput::Write ( const StormByte::Safe::Binary & data) const
noexcept

Copy bytes to the borrowed writer.

Parameters
dataBytes to append.
Returns
Whether the write succeeded.

◆ Write() [2/3]

bool StormByte::Buffer::PipeOutput::Write ( std::string_view text) const
noexcept

Copy length-aware text without a trailing NUL.

Parameters
textText to append, including embedded NULs. Borrowed only for this write.
Returns
Whether the write succeeded.

◆ Write() [3/3]

bool StormByte::Buffer::PipeOutput::Write ( StormByte::Safe::Binary && data) const
noexcept

Move bytes to the borrowed writer.

Parameters
dataBytes to append.
Returns
Whether the write succeeded.

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