Registration for the pipe connection.pipe
fn
auto pipe(SourceArgs, TargetArgs)(
ref Hap!SourceArgs source,
Hap!TargetArgs * target,
void delegate(SourceArgs, ref Hap!TargetArgs) @safe transform) @safePipe events from a source hap through a transform function to a target hap.
pipe registers a handler on the source hap that transforms each event and re-emits it on the target hap. The returned Registration can be used to disconnect the pipe.
The target is taken by pointer so the lifetime coupling stays explicit: the pipe stores only the pointer, therefore the target hap must outlive the returned registration. Detach the registration before the target goes out of scope.
Parameters
source | The upstream hap to listen to. |
target | The downstream hap to emit transformed values into; must outlive the returned registration. |
transform | A function that maps source args to target args. |
Returns
A