pipe

fnauto pipe(SourceArgs, TargetArgs)( ref Hap!SourceArgs source, Hap!TargetArgs * target, void delegate(SourceArgs, ref Hap!TargetArgs) @safe transform) @safe

Pipe 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

sourceThe upstream hap to listen to.
targetThe downstream hap to emit transformed values into; must outlive the returned registration.
transformA function that maps source args to target args.

Returns

A Registration for the pipe connection.