public static void AdviseNotNull <T>(this ISource <T> me, Lifetime lifetime, Action <T> handler) where T : class { me.Advise(lifetime, v => { if (v != null) { handler(v); } }); }
public static void AdviseNotNull <T>(this ISource <T?> me, Lifetime lifetime, Action <T> handler) where T : struct { me.Advise(lifetime, v => { if (v != null) { handler(v.Value); } }); }
public static void AdviseUntil <T>(this ISource <T> me, Lifetime lifetime, Func <T, bool> handler) { if (!lifetime.IsAlive) { return; } var definition = Lifetime.Define(lifetime); me.Advise(definition.Lifetime, v => { if (handler(v)) { definition.Terminate(); } }); }
public void Advise(Lifetime lifetime, Action <R> handler) { myOriginal.Advise(lifetime, x => handler(myMap(x))); }
public static void Advise(this ISource <Unit> me, Lifetime lifetime, Action handler) { me.Advise(lifetime, _ => { handler(); }); }