Stream.Replacereplace_all, streamed: each Leftmost_longest match m is replaced by f m, everything else passes through unchanged.
feed returns the next piece of the output; input is held back only while it could still belong to a match (at most one longest-pattern length), so pieces flow promptly. Replace.flush returns the final piece: the concatenation of all pieces equals replace_all ~f of the concatenated input.