MultiPublisher

A basic publisher (and subscriber) implementation that will pipe data to subscribers of the matching type.

@safe
alias MultiPublisher(IPipes...) = MultiPublisherImpl!(staticMap!(AllPublishers, IPipes))

Examples

Setting up a publisher that separately produces two different types.

auto multi = new MultiPublisher!(Publisher!int, Publisher!string);

int resultInt;
string resultString;
multi.then((int a) => resultInt = a);
multi.then((string a) => resultString = a);

multi(1);
assert(resultInt == 1);
assert(resultString == "");

multi("Hello!");
assert(resultInt == 1);
assert(resultString == "Hello!");

Meta