| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | namespace IceRpc; |
| | 4 | |
|
| | 5 | | /// <summary>Adapts a function to the <see cref="IDispatcher" /> interface.</summary> |
| | 6 | | public class InlineDispatcher : IDispatcher |
| | 7 | | { |
| | 8 | | private readonly Func<IncomingRequest, CancellationToken, ValueTask<OutgoingResponse>> _function; |
| | 9 | |
|
| | 10 | | /// <summary>Constructs an InlineDispatcher using a delegate.</summary> |
| | 11 | | /// <param name="function">The function that implements the dispatcher's DispatchAsync method.</param> |
| 298 | 12 | | public InlineDispatcher(Func<IncomingRequest, CancellationToken, ValueTask<OutgoingResponse>> function) => |
| 298 | 13 | | _function = function; |
| | 14 | |
|
| | 15 | | /// <inheritdoc/> |
| | 16 | | public ValueTask<OutgoingResponse> DispatchAsync(IncomingRequest request, CancellationToken cancellationToken = defa |
| 1573 | 17 | | _function(request, cancellationToken); |
| | 18 | | } |