Skip to content

Extension Methods

kimja edited this page Sep 28, 2026 · 4 revisions

🧩 Extension Methods

WithLatestFromMatter / CombineLatestMatter

Tuple-returning convenience overloads defined in ScrollExtensions. Unlike the standard Rx versions, these take no result selector and always return a flat tuple. The Matter suffix distinguishes them from System.Reactive.Linq.ObservableEx overloads that share the same parameter signature β€” without it, CS0121 fires when both namespaces are in scope.

// WithLatestFromMatter: source is the trigger, other is "the current value of X"
// Silently drops source emissions that arrive before other has ever emitted.
source.WithLatestFromMatter(other)        // β†’ IObservable<(T1, T2)>
source.WithLatestFromMatter(ctx1, ctx2)   // β†’ IObservable<(T1, T2, T3)>

// CombineLatestMatter: emits whenever either stream fires, always pairing with the latest of the other
streamA.CombineLatestMatter(streamB)             // β†’ IObservable<(T1, T2)>
streamA.CombineLatestMatter(streamB, streamC)    // β†’ IObservable<(T1, T2, T3)>

IsRespondingTo

Check whether a response corresponds to a specific request - Ask uses this internally to filter the response stream. Use it directly when you need a different lifecycle than Ask provides (e.g. observing every response to a long-lived request, or correlating inside a Weave you already own):

var myRequest = new InventoryRequest("weapons");
Q += rzeka.Weave<InventoryResponse>(
    this,
    responses => responses
        .Where(r => r.IsRespondingTo(myRequest))
        .Subscribe(r => ShowWeaponsInventory(r.Items))
);
rzeka.Pluck(this, myRequest);

Prefer Ask for the standard request/response round-trip - it bundles the Weave + Pluck pair and the IsRespondingTo filter for you.

Clone this wiki locally