<PackageReference Include="Polly.Core" Version="8.0.0-alpha.4" />

HedgingHandler<T>

sealed class HedgingHandler<T> : IEquatable<HedgingHandler<T>>
using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; namespace Polly.Hedging.Utils { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] internal sealed class HedgingHandler<[System.Runtime.CompilerServices.Nullable(2)] T> : IEquatable<HedgingHandler<T>> { [CompilerGenerated] private Type EqualityContract { [CompilerGenerated] get { return typeof(HedgingHandler<T>); } } [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 0 })] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 0 })] public Func<OutcomeArguments<T, HedgingPredicateArguments>, ValueTask<bool>> ShouldHandle { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 0 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 0 })] set; } [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2, 0, 0, 1 })] [field: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2, 0, 0, 1 })] public Func<HedgingActionGeneratorArguments<T>, Func<ValueTask<Outcome<T>>>> ActionGenerator { [return: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2, 0, 0, 1 })] get; [param: System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2, 0, 0, 1 })] set; } public bool IsGeneric { get; set; } public HedgingHandler([System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 0 })] Func<OutcomeArguments<T, HedgingPredicateArguments>, ValueTask<bool>> ShouldHandle, [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2, 0, 0, 1 })] Func<HedgingActionGeneratorArguments<T>, Func<ValueTask<Outcome<T>>>> ActionGenerator, bool IsGeneric) { ShouldHandle = ShouldHandle; ActionGenerator = ActionGenerator; IsGeneric = IsGeneric; base..ctor(); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0, 0, 1 })] public Func<ValueTask<Outcome<T>>> GenerateAction([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] HedgingActionGeneratorArguments<T> args) { if (IsGeneric) { HedgingActionGeneratorArguments<T> arg = new HedgingActionGeneratorArguments<T>(args.PrimaryContext, args.ActionContext, args.Attempt, args.Callback); return ActionGenerator(arg); } return CreateNonGenericAction(args); } [return: System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0, 0, 1 })] private Func<ValueTask<Outcome<T>>> CreateNonGenericAction([System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] HedgingActionGeneratorArguments<T> args) { Func<HedgingActionGeneratorArguments<object>, Func<ValueTask<Outcome<object>>>> func = (Func<HedgingActionGeneratorArguments<object>, Func<ValueTask<Outcome<object>>>>)ActionGenerator; <>c__DisplayClass16_0 <>4__this; Func<ValueTask<Outcome<object>>> action = func(new HedgingActionGeneratorArguments<object>(args.PrimaryContext, args.ActionContext, args.Attempt, delegate(ResilienceContext context) { <>c__DisplayClass16_0.<<CreateNonGenericAction>b__0>d stateMachine2 = default(<>c__DisplayClass16_0.<<CreateNonGenericAction>b__0>d); stateMachine2.<>t__builder = AsyncValueTaskMethodBuilder<Outcome<object>>.Create(); stateMachine2.<>4__this = <>4__this; stateMachine2.context = context; stateMachine2.<>1__state = -1; stateMachine2.<>t__builder.Start(ref stateMachine2); return stateMachine2.<>t__builder.Task; })); if (action == null) return null; return delegate { <>c__DisplayClass16_0.<<CreateNonGenericAction>b__1>d stateMachine = default(<>c__DisplayClass16_0.<<CreateNonGenericAction>b__1>d); stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<Outcome<T>>.Create(); stateMachine.<>4__this = <>4__this; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; }; } [CompilerGenerated] public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("HedgingHandler"); stringBuilder.Append(" { "); if (PrintMembers(stringBuilder)) stringBuilder.Append(' '); stringBuilder.Append('}'); return stringBuilder.ToString(); } [CompilerGenerated] private bool PrintMembers(StringBuilder builder) { RuntimeHelpers.EnsureSufficientExecutionStack(); builder.Append("ShouldHandle = "); builder.Append(ShouldHandle); builder.Append(", ActionGenerator = "); builder.Append(ActionGenerator); builder.Append(", IsGeneric = "); builder.Append(IsGeneric.ToString()); return true; } public static bool operator !=([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0 })] HedgingHandler<T> left, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0 })] HedgingHandler<T> right) { return !(left == right); } public static bool operator ==([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0 })] HedgingHandler<T> left, [System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0 })] HedgingHandler<T> right) { if ((object)left != right) return left?.Equals(right) ?? false; return true; } [CompilerGenerated] public override int GetHashCode() { return ((EqualityComparer<Type>.Default.GetHashCode(EqualityContract) * -1521134295 + EqualityComparer<Func<OutcomeArguments<T, HedgingPredicateArguments>, ValueTask<bool>>>.Default.GetHashCode(ShouldHandle)) * -1521134295 + EqualityComparer<Func<HedgingActionGeneratorArguments<T>, Func<ValueTask<Outcome<T>>>>>.Default.GetHashCode(ActionGenerator)) * -1521134295 + EqualityComparer<bool>.Default.GetHashCode(IsGeneric); } [System.Runtime.CompilerServices.NullableContext(2)] [CompilerGenerated] public override bool Equals(object obj) { return Equals(obj as HedgingHandler<T>); } [CompilerGenerated] public bool Equals([System.Runtime.CompilerServices.Nullable(new byte[] { 2, 0 })] HedgingHandler<T> other) { if ((object)this != other) { if ((object)other != null && EqualityContract == other.EqualityContract && EqualityComparer<Func<OutcomeArguments<T, HedgingPredicateArguments>, ValueTask<bool>>>.Default.Equals(ShouldHandle, other.ShouldHandle) && EqualityComparer<Func<HedgingActionGeneratorArguments<T>, Func<ValueTask<Outcome<T>>>>>.Default.Equals(ActionGenerator, other.ActionGenerator)) return EqualityComparer<bool>.Default.Equals(IsGeneric, other.IsGeneric); return false; } return true; } [CompilerGenerated] private HedgingHandler([System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0 })] HedgingHandler<T> original) { ShouldHandle = original.ShouldHandle; ActionGenerator = original.ActionGenerator; IsGeneric = original.IsGeneric; } [CompilerGenerated] public void Deconstruct([System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 0 })] out Func<OutcomeArguments<T, HedgingPredicateArguments>, ValueTask<bool>> ShouldHandle, [System.Runtime.CompilerServices.Nullable(new byte[] { 1, 0, 1, 2, 0, 0, 1 })] out Func<HedgingActionGeneratorArguments<T>, Func<ValueTask<Outcome<T>>>> ActionGenerator, out bool IsGeneric) { ShouldHandle = this.ShouldHandle; ActionGenerator = this.ActionGenerator; IsGeneric = this.IsGeneric; } } }