Skip to content

ReplPageSource

Convenience factories for result-flow page sources.

public static class ReplPageSource

Create<T>(Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>)

Section titled “Create<T>(Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>)”

Creates a page source from a fetch delegate.

public static IReplPageSource<T> Create<T>(Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>> fetch)
  • T: Item type.
  • fetch (Func<ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>): Delegate that fetches one page for each request.

IReplPageSource<T> - A page source consumable by Repl renderers.

Create<T, TState>(TState, Func<TState, ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>)

Section titled “Create<T, TState>(TState, Func<TState, ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>)”

Creates a page source from a fetch delegate and explicit state.

public static IReplPageSource<T> Create<T, TState>(TState state, Func<TState, ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>> fetch)
  • T: Item type.
  • TState: State type.
  • state (TState): State passed to the fetch delegate.
  • fetch (Func<TState, ReplPageRequest, CancellationToken, ValueTask<ReplPage<T>>>): Delegate that fetches one page for each request.

IReplPageSource<T> - A page source consumable by Repl renderers.

FromAsyncEnumerable<T>(Func<CancellationToken, IAsyncEnumerable<T>>, Func<T, bool>?, int?)

Section titled “FromAsyncEnumerable<T>(Func<CancellationToken, IAsyncEnumerable<T>>, Func<T, bool>?, int?)”

Creates an offset-cursor page source over an async stream factory.

public static IReplPageSource<T> FromAsyncEnumerable<T>(Func<CancellationToken, IAsyncEnumerable<T>> createItems, Func<T, bool>? filter = null, int? maxSourceItemsToScan = null)
  • T: Item type.
  • createItems (Func<CancellationToken, IAsyncEnumerable<T>>): Factory that creates the async stream for each page request.
  • filter (Func<T, bool>): Optional client-side filter applied before final paging.
  • maxSourceItemsToScan (int?): Maximum source rows to scan while filling one filtered page.

IReplPageSource<T> - A page source consumable by Repl renderers.

FromAsyncEnumerable<T, TState>(TState, Func<TState, CancellationToken, IAsyncEnumerable<T>>, Func<TState, T, bool>?, int?)

Section titled “FromAsyncEnumerable<T, TState>(TState, Func<TState, CancellationToken, IAsyncEnumerable<T>>, Func<TState, T, bool>?, int?)”

Creates an offset-cursor page source over an async stream factory, with explicit state.

public static IReplPageSource<T> FromAsyncEnumerable<T, TState>(TState state, Func<TState, CancellationToken, IAsyncEnumerable<T>> createItems, Func<TState, T, bool>? filter = null, int? maxSourceItemsToScan = null)
  • T: Item type.
  • TState: State type.
  • state (TState): State passed to the stream factory and filter delegate.
  • createItems (Func<TState, CancellationToken, IAsyncEnumerable<T>>): Factory that creates the async stream for each page request.
  • filter (Func<TState, T, bool>): Optional client-side filter applied before final paging.
  • maxSourceItemsToScan (int?): Maximum source rows to scan while filling one filtered page.

IReplPageSource<T> - A page source consumable by Repl renderers.

FromItems<T>(IReadOnlyList<T>, Func<T, bool>?)

Section titled “FromItems<T>(IReadOnlyList<T>, Func<T, bool>?)”

Creates an offset-cursor page source over an in-memory list.

public static IReplPageSource<T> FromItems<T>(IReadOnlyList<T> items, Func<T, bool>? filter = null)
  • T: Item type.
  • items (IReadOnlyList<T>): Items to expose as pages.
  • filter (Func<T, bool>): Optional client-side filter applied before final paging.

IReplPageSource<T> - A page source consumable by Repl renderers.

FromItems<T, TState>(IReadOnlyList<T>, TState, Func<TState, T, bool>?)

Section titled “FromItems<T, TState>(IReadOnlyList<T>, TState, Func<TState, T, bool>?)”

Creates an offset-cursor page source over an in-memory list and explicit state.

public static IReplPageSource<T> FromItems<T, TState>(IReadOnlyList<T> items, TState state, Func<TState, T, bool>? filter = null)
  • T: Item type.
  • TState: State type.
  • items (IReadOnlyList<T>): Items to expose as pages.
  • state (TState): State passed to the filter delegate.
  • filter (Func<TState, T, bool>): Optional client-side filter applied before final paging.

IReplPageSource<T> - A page source consumable by Repl renderers.

FromOffset<T>(Func<int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>, long?, Func<T, bool>?, int?)

Section titled “FromOffset<T>(Func<int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>, long?, Func<T, bool>?, int?)”

Creates an offset-cursor page source over a store that can fetch by offset and take.

public static IReplPageSource<T> FromOffset<T>(Func<int, int, CancellationToken, ValueTask<IReadOnlyList<T>>> fetch, long? totalCount = null, Func<T, bool>? filter = null, int? maxSourceItemsToScan = null)
  • T: Item type.
  • fetch (Func<int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>): Delegate called with offset, take, and cancellation token.
  • totalCount (long?): Total item count, when known without expensive enumeration.
  • filter (Func<T, bool>): Optional client-side filter applied after source fetches and before final paging.
  • maxSourceItemsToScan (int?): Maximum source rows to scan while filling one filtered page.

IReplPageSource<T> - A page source consumable by Repl renderers.

FromOffset<T, TState>(TState, Func<TState, int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>, long?, Func<TState, T, bool>?, int?)

Section titled “FromOffset<T, TState>(TState, Func<TState, int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>, long?, Func<TState, T, bool>?, int?)”

Creates an offset-cursor page source over a store that can fetch by offset and take, with explicit state.

public static IReplPageSource<T> FromOffset<T, TState>(TState state, Func<TState, int, int, CancellationToken, ValueTask<IReadOnlyList<T>>> fetch, long? totalCount = null, Func<TState, T, bool>? filter = null, int? maxSourceItemsToScan = null)
  • T: Item type.
  • TState: State type.
  • state (TState): State passed to the fetch and filter delegates.
  • fetch (Func<TState, int, int, CancellationToken, ValueTask<IReadOnlyList<T>>>): Delegate called with state, offset, take, and cancellation token.
  • totalCount (long?): Total item count, when known without expensive enumeration.
  • filter (Func<TState, T, bool>): Optional client-side filter applied after source fetches and before final paging.
  • maxSourceItemsToScan (int?): Maximum source rows to scan while filling one filtered page.

IReplPageSource<T> - A page source consumable by Repl renderers.