Class MapAnnotationsDocumentRenderer<T, U>
An IDocumentRenderer<T> which wraps an IDocumentRenderer<T> by applying an asynchronous Func<T, TResult> to all of the annotations in the input Document<T>.
Inheritance
- object
- MapAnnotationsDocumentRenderer<T, U>
Implements
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()
Declaration
public class MapAnnotationsDocumentRenderer<T, U> : IDocumentRenderer<T>
Type Parameters
Name | Description |
---|---|
T |
The type of annotations in the input Document<T>. |
U |
The type of annotations accepted by the wrapped IDocumentRenderer<T>. |
Constructors
MapAnnotationsDocumentRenderer(Func<T, ValueTask<U>>, IDocumentRenderer<U>)
Creates a MapAnnotationsDocumentRenderer<T, U>.
Declaration
public MapAnnotationsDocumentRenderer(Func<T, ValueTask<U>> selector, IDocumentRenderer<U> wrapped)
Parameters
Type | Name | Description |
---|---|---|
selector |
The function to apply to the annotations. |
|
wrapped |
The wrapped document renderer. |
Methods
NewLine(CancellationToken)
Write a line break into the output stream.
Declaration
public ValueTask NewLine(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
cancellationToken |
Returns
Type | Description |
---|---|
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
public ValueTask PopAnnotation(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
cancellationToken |
Returns
Type | Description |
---|---|
A ValueTask which will complete when the value has been popped from the stack. |
PushAnnotation(T, CancellationToken)
Accept an annotation.
Declaration
public ValueTask PushAnnotation(T value, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
T |
value |
The annotation to push onto the stack. |
cancellationToken |
Returns
Type | Description |
---|---|
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
public ValueTask Text(ReadOnlyMemory<char> memory, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
memory |
The text to write to the output stream. |
|
cancellationToken |
Returns
Type | Description |
---|---|
A ValueTask which will complete when the text has been written to the output stream. |
WhiteSpace(int, CancellationToken)
Write the given amount
of
blank space into the output stream.
Declaration
public ValueTask WhiteSpace(int amount, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
amount |
The amount of white space to write. |
|
cancellationToken |
Returns
Type | Description |
---|---|
A ValueTask which will complete when the white space has been written to the output stream. |