BridgeComponentBase
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Polly.Utils.Pipeline
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
internal abstract class BridgeComponentBase : PipelineComponent
{
private readonly object _strategy;
protected BridgeComponentBase(object strategy)
{
_strategy = strategy;
}
public override ValueTask DisposeAsync()
{
IAsyncDisposable asyncDisposable = _strategy as IAsyncDisposable;
if (asyncDisposable != null)
return asyncDisposable.DisposeAsync();
(_strategy as IDisposable)?.Dispose();
return default(ValueTask);
}
[System.Runtime.CompilerServices.NullableContext(2)]
[return: System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1
})]
protected static Outcome<TTo> ConvertOutcome<TFrom, TTo>([System.Runtime.CompilerServices.Nullable(new byte[] {
0,
1
})] Outcome<TFrom> outcome)
{
if (outcome.ExceptionDispatchInfo != null)
return new Outcome<TTo>(outcome.ExceptionDispatchInfo);
return new Outcome<TTo>((TTo)(object)outcome.Result);
}
}
}