Bounded owner of last committed and pending frames; never performs I/O in submit. One executor owns every call and destruction; external synchronization is needed for transfer. The output reference must outlive this non-movable writer. No callbacks, background work or implicit destructor flush. Destroying with pending output requires closing that output session before any other writer is used. A deadline/stop without error retains the exact transaction. Any transport error or inconsistent progress permanently poisons this writer and invalidates its committed frame. Recovery requires closing/joining the old transport, then a new writer whose first full transaction sends CAN and the mode baseline. This requires terminal support for CAN abort of this encoder's CSI/UTF-8 prefixes; arbitrary external output requires an owner-established fresh parser instead. Reopening alone does not reset the parser. Never restart output while the old native worker can write.
More...
#include <diff.hpp>
|
| | FrameWriter (FrameOutput &output, FrameWriterLimits limits={}, std::shared_ptr< Diagnostics > diagnostics={}) noexcept |
| | Borrow exclusive output.
|
|
| FrameWriter (const FrameWriter &)=delete |
| | Exclusive output cannot be shared by copying.
|
|
FrameWriter & | operator= (const FrameWriter &)=delete |
| | Exclusive output cannot be reassigned.
|
| std::expected< void, FrameError > | submit (CellBuffer &&frame, DiagnosticContext context={}) |
| | Encode and take frame only on success; reject busy/poisoned/limits without I/O. Semantically unchanged frames commit immediately without output. Accepted frames invalidate caller views through move; rejection retains them. Allocation errors are returned. Submission invalidates any previously borrowed committed-frame view.
|
| TerminalWrite | flush (TerminalDeadline deadline, std::stop_token stop={}) |
| | Perform transport I/O; commit only after complete, consistent progress. Must run outside paint/measure/layout. Stop/deadline without errors retain the frame. An accompanying error normalizes the result status to error and preserves its details. Transport exceptions poison state then propagate; no automatic retry occurs.
|
| const CellBuffer * | committedFrame () const noexcept |
| | Borrow last fully transmitted frame; null initially/after error. This is historical during partial output, not the current physical screen. Expires on successful submit, completing/error flush, or writer destruction.
|
| bool | pending () const noexcept |
| | Whether a transaction still requires completion; no allocation/errors.
|
| bool | poisoned () const noexcept |
| | Whether unknown side effects permanently prohibit further output.
|
Bounded owner of last committed and pending frames; never performs I/O in submit. One executor owns every call and destruction; external synchronization is needed for transfer. The output reference must outlive this non-movable writer. No callbacks, background work or implicit destructor flush. Destroying with pending output requires closing that output session before any other writer is used. A deadline/stop without error retains the exact transaction. Any transport error or inconsistent progress permanently poisons this writer and invalidates its committed frame. Recovery requires closing/joining the old transport, then a new writer whose first full transaction sends CAN and the mode baseline. This requires terminal support for CAN abort of this encoder's CSI/UTF-8 prefixes; arbitrary external output requires an owner-established fresh parser instead. Reopening alone does not reset the parser. Never restart output while the old native worker can write.
◆ FrameWriter()
Borrow exclusive output.
- Parameters
-
| output | Transport that outlives the writer and receives no competing submissions. |
| limits | Per-transaction output and per-frame storage caps; submit reports any excess. |
| diagnostics | Optional shared metadata recorder; records no terminal bytes. |
◆ committedFrame()
| const CellBuffer * portals::FrameWriter::committedFrame |
( |
| ) |
const |
|
nodiscardnoexcept |
Borrow last fully transmitted frame; null initially/after error. This is historical during partial output, not the current physical screen. Expires on successful submit, completing/error flush, or writer destruction.
- Returns
- Borrowed last completed frame, or null when no valid committed belief exists.
◆ flush()
Perform transport I/O; commit only after complete, consistent progress. Must run outside paint/measure/layout. Stop/deadline without errors retain the frame. An accompanying error normalizes the result status to error and preserves its details. Transport exceptions poison state then propagate; no automatic retry occurs.
- Parameters
-
| deadline | Absolute monotonic deadline passed to the transport. |
| stop | Cooperative stop request for this call. |
- Returns
- Completed and pending bytes with the final status; errors mean the committed belief is invalid.
- Note
- Exceptions from the output adapter propagate only after the writer is poisoned.
◆ pending()
| bool portals::FrameWriter::pending |
( |
| ) |
const |
|
nodiscardnoexcept |
Whether a transaction still requires completion; no allocation/errors.
- Returns
- True while a desired frame still has an incomplete transaction.
◆ poisoned()
| bool portals::FrameWriter::poisoned |
( |
| ) |
const |
|
nodiscardnoexcept |
Whether unknown side effects permanently prohibit further output.
- Returns
- True after an uncertain or inconsistent transport result; this state cannot be reset.
◆ submit()
Encode and take frame only on success; reject busy/poisoned/limits without I/O. Semantically unchanged frames commit immediately without output. Accepted frames invalidate caller views through move; rejection retains them. Allocation errors are returned. Submission invalidates any previously borrowed committed-frame view.
- Parameters
-
| frame | Desired owning frame, consumed only after successful validation and encoding. |
| context | Token from WidgetTree::diagnosticFrame, linking the actual output to invalidation. |
- Returns
- Success when accepted, or pending, poisoned, FRAME_LIMIT, OUTPUT_LIMIT or ALLOCATION_FAILURE.
The documentation for this class was generated from the following file: