Gutenberg

Interface IDocumentRenderer<T>

An interface for objects which know how to render a Document<T>.

Declaration
public interface IDocumentRenderer<in T>
Type Parameters
Name Description

T

The type of annotations in the document.

Methods

NewLine(CancellationToken)

Write a line break into the output stream.

Declaration
ValueTask NewLine(CancellationToken cancellationToken = null)
Parameters
Type Name Description

CancellationToken

cancellationToken

A CancellationToken.

Returns
Type Description

ValueTask

A ValueTask which will complete when the line break has been written to the output stream.

PopAnnotation(CancellationToken)

Discard the value of a previous call to PushAnnotation(T, CancellationToken).

Declaration
ValueTask PopAnnotation(CancellationToken cancellationToken = null)
Parameters
Type Name Description

CancellationToken

cancellationToken

A CancellationToken.

Returns
Type Description

ValueTask

A ValueTask which will complete when the value has been popped from the stack.

PushAnnotation(T, CancellationToken)

Accept an annotation.

Declaration
ValueTask PushAnnotation(T value, CancellationToken cancellationToken = null)
Parameters
Type Name Description

T

value

The annotation to push onto the stack.

CancellationToken

cancellationToken

A CancellationToken.

Returns
Type Description

ValueTask

A ValueTask which will complete when the value has been pushed onto the stack.

Text(ReadOnlyMemory<Char>, CancellationToken)

Write some text into the output stream.

Declaration
ValueTask Text(ReadOnlyMemory<char> memory, CancellationToken cancellationToken = null)
Parameters
Type Name Description

ReadOnlyMemory<Char>

memory

The text to write to the output stream.

CancellationToken

cancellationToken

A CancellationToken.

Returns
Type Description

ValueTask

A ValueTask which will complete when the text has been written to the output stream.

WhiteSpace(Int32, CancellationToken)

Write the given amount of blank space into the output stream.

Declaration
ValueTask WhiteSpace(int amount, CancellationToken cancellationToken = null)
Parameters
Type Name Description

Int32

amount

The amount of white space to write.

CancellationToken

cancellationToken

A CancellationToken.

Returns
Type Description

ValueTask

A ValueTask which will complete when the white space has been written to the output stream.

Extension Methods

DocumentRendererExtensions.MapAnnotations<T, U>(IDocumentRenderer<U>, Func<T, U>)
DocumentRendererExtensions.MapAnnotations<T, U>(IDocumentRenderer<U>, Func<T, ValueTask<U>>)