Gutenberg

Class DocumentRendererExtensions

Extension methods for IDocumentRenderer<T>

Inheritance
  • Object
  • DocumentRendererExtensions
Declaration
public static class DocumentRendererExtensions : Object

Methods

MapAnnotations<T, U>(IDocumentRenderer<U>, Func<T, U>)

Creates an IDocumentRenderer<T> which wraps the specified renderer by applying a Func<T,TResult> to all of the annotations in the input Document<T>.

Declaration
public static IDocumentRenderer<T> MapAnnotations<T, U>(this IDocumentRenderer<U> renderer, Func<T, U> selector)
Parameters
Type Name Description

IDocumentRenderer<U>

renderer

The wrapped document renderer

Func<T, U>

selector

The function to apply to the annotations

Returns
Type Description

IDocumentRenderer<T>

An IDocumentRenderer<T> which wraps an renderer by applying a Func<T,TResult> to all of the annotations in the input Document<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>.

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

Creates an IDocumentRenderer<T> which wraps the specified renderer by applying an asynchronous Func<T,TResult> to all of the annotations in the input Document<T>.

Declaration
public static IDocumentRenderer<T> MapAnnotations<T, U>(this IDocumentRenderer<U> renderer, Func<T, ValueTask<U>> selector)
Parameters
Type Name Description

IDocumentRenderer<U>

renderer

The wrapped document renderer

Func<T, ValueTask<U>>

selector

The function to apply to the annotations

Returns
Type Description

IDocumentRenderer<T>

An IDocumentRenderer<T> which wraps an renderer by applying a Func<T,TResult> to all of the annotations in the input Document<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>.