Function: consult--async-merge

consult--async-merge is a natively compiled function defined in consult.el.

Signature

(consult--async-merge ASYNCS)

Documentation

Create merged async function from multiple ASYNCS.

Source Code

;; Defined in /nix/store/6higv2v1wk916v4ynnybyrdkfy2gq44d-emacs-packages-deps/share/emacs/site-lisp/elpa/consult-20261004.957/consult.el
(defun consult--async-merge (asyncs)
  "Create merged async function from multiple ASYNCS."
  (lambda (sink)
    (let* ((indicator (make-vector (length asyncs)  nil))
           (tail (make-vector (1+ (length indicator)) nil))
           (asyncs
            (seq-map-indexed
             (lambda (fun idx)
               (funcall fun (consult--async-merge-sink sink indicator tail (1+ idx))))
             asyncs)))
      (aset tail 0 (list nil)) ;; Guard element
      (lambda (action)
        (dolist (async asyncs)
          (funcall async action))
        (funcall sink action)))))