ReactiveUI.Primitives.Extensions.ObserverArrayHelpers
Pure-plumbing helpers for swap-on-write IObserver<T> arrays. Centralizes the
empty-array short-circuit on broadcast and the not-present short-circuit on remove so the
operator hot paths stay branchless on the steady state. Every branch is a pure function
over its inputs and is directly RxVoid-testable through this class.
Snapshots the supplied observer array and fans the value out to every observer in order.
Returns silently if the array is empty (which happens during the race between the last
unsubscribe and an already-scheduled broadcast).
public static IObserver<T>[] RemoveOrNull<T>(IObserver<T>[] current, IObserver<T> observer, IObserver<T>[] empty)
Returns a new observer array with observer removed, or
null if the observer was not in the array (which happens during
the race between an idempotent subscription dispose and a previous successful remove).