Class ExecutableExtensions
- Namespace
- Executables
- Assembly
- executables.dll
Extension methods for composing and adapting executables.
public static class ExecutableExtensions
- Inheritance
-
ExecutableExtensions
- Inherited Members
Methods
Accumulate<T1, T2, T3>(IExecutable<T1, T2>, Func<T2, T3>)
Appends a projection while preserving the previous result in the returned tuple.
[Pure]
public static IExecutable<T1, (T2, T3)> Accumulate<T1, T2, T3>(this IExecutable<T1, T2> first, Func<T2, T3> second)
Parameters
firstIExecutable<T1, T2>Executable that produces the value passed to
second.secondFunc<T2, T3>Delegate that computes an additional value from the result of
first.
Returns
- IExecutable<T1, (T2, T3)>
Executable that returns both the original result and the appended value.
Type Parameters
T1T2T3
Exceptions
- ArgumentNullException
secondis null.
Accumulate<T1, T2, T3, T4>(IExecutable<T1, (T2, T3)>, Func<T2, T3, T4>)
Appends a projection while preserving the accumulated tuple produced by the previous stage.
[Pure]
public static IExecutable<T1, (T2, T3, T4)> Accumulate<T1, T2, T3, T4>(this IExecutable<T1, (T2, T3)> first, Func<T2, T3, T4> second)
Parameters
firstIExecutable<T1, (T2, T3)>Executable that produces the tuple passed to
second.secondFunc<T2, T3, T4>Delegate that computes an additional value from the accumulated tuple items.
Returns
- IExecutable<T1, (T2, T3, T4)>
Executable that returns the original tuple items plus the appended value.
Type Parameters
T1T2T3T4
Exceptions
- ArgumentNullException
secondis null.
Accumulate<T1, T2, T3, T4, T5>(IExecutable<T1, (T2, T3, T4)>, Func<T2, T3, T4, T5>)
Appends a projection while preserving the accumulated tuple produced by the previous stage.
[Pure]
public static IExecutable<T1, (T2, T3, T4, T5)> Accumulate<T1, T2, T3, T4, T5>(this IExecutable<T1, (T2, T3, T4)> first, Func<T2, T3, T4, T5> second)
Parameters
firstIExecutable<T1, (T2, T3, T4)>Executable that produces the tuple passed to
second.secondFunc<T2, T3, T4, T5>Delegate that computes an additional value from the accumulated tuple items.
Returns
- IExecutable<T1, (T2, T3, T4, T5)>
Executable that returns the original tuple items plus the appended value.
Type Parameters
T1T2T3T4T5
Exceptions
- ArgumentNullException
secondis null.
AsCommand<T>(ICommand<T>)
Returns the same command instance.
[Pure]
public static ICommand<T> AsCommand<T>(this ICommand<T> command)
Parameters
commandICommand<T>
Returns
- ICommand<T>
The original command.
Type Parameters
T
AsCommand<T>(IExecutable<T, bool>)
Converts an executable to a command.
[Pure]
public static ICommand<T> AsCommand<T>(this IExecutable<T, bool> executable)
Parameters
executableIExecutable<T, bool>
Returns
- ICommand<T>
Command wrapping the executable.
Type Parameters
T
AsExecutable<T1, T2>(IExecutable<T1, T2>)
Returns the same executable instance.
[Pure]
public static IExecutable<T1, T2> AsExecutable<T1, T2>(this IExecutable<T1, T2> executable)
Parameters
executableIExecutable<T1, T2>
Returns
- IExecutable<T1, T2>
Type Parameters
T1T2
AsHandler<T1, T2>(Handler<T1, T2>)
Returns the same handler instance.
[Pure]
public static Handler<T1, T2> AsHandler<T1, T2>(this Handler<T1, T2> handler)
Parameters
handlerHandler<T1, T2>
Returns
- Handler<T1, T2>
The original handler.
Type Parameters
T1T2
AsHandler<T1, T2>(IExecutable<T1, T2>)
Converts an executable to a handler.
[Pure]
public static Handler<T1, T2> AsHandler<T1, T2>(this IExecutable<T1, T2> executable)
Parameters
executableIExecutable<T1, T2>
Returns
- Handler<T1, T2>
Handler wrapping the executable.
Type Parameters
T1T2
AsQuery<T1, T2>(IExecutable<T1, T2>)
Converts an executable to a query.
[Pure]
public static IQuery<T1, T2> AsQuery<T1, T2>(this IExecutable<T1, T2> executable)
Parameters
executableIExecutable<T1, T2>
Returns
- IQuery<T1, T2>
Query wrapping the executable.
Type Parameters
T1T2
AsQuery<T1, T2>(IQuery<T1, T2>)
Returns the same query instance.
[Pure]
public static IQuery<T1, T2> AsQuery<T1, T2>(this IQuery<T1, T2> query)
Parameters
queryIQuery<T1, T2>
Returns
- IQuery<T1, T2>
The original query.
Type Parameters
T1T2
AsSubscriber<T>(IExecutable<T, Unit>)
Converts an executable to a subscriber.
[Pure]
public static ISubscriber<T> AsSubscriber<T>(this IExecutable<T, Unit> executable)
Parameters
executableIExecutable<T, Unit>
Returns
- ISubscriber<T>
Subscriber wrapping the executable.
Type Parameters
T
AsSubscriber<T>(ISubscriber<T>)
Returns the same subscriber instance.
[Pure]
public static ISubscriber<T> AsSubscriber<T>(this ISubscriber<T> subscriber)
Parameters
subscriberISubscriber<T>
Returns
- ISubscriber<T>
The original subscriber.
Type Parameters
T
First<T1, T2, T3, TNew>(IExecutable<T1, (T2, T3)>, IExecutable<T2, TNew>)
Maps the first item of a tuple result.
[Pure]
public static IExecutable<T1, (TNew, T3)> First<T1, T2, T3, TNew>(this IExecutable<T1, (T2, T3)> fork, IExecutable<T2, TNew> map)
Parameters
forkIExecutable<T1, (T2, T3)>Executable that returns a tuple.
mapIExecutable<T2, TNew>Executable applied to the first tuple item.
Returns
- IExecutable<T1, (TNew, T3)>
Executable with transformed first tuple item.
Type Parameters
T1T2T3TNew
Exceptions
- ArgumentNullException
mapis null.
First<T1, T2, T3, TNew>(IExecutable<T1, (T2, T3)>, Func<T2, TNew>)
Maps the first item of a tuple result with a delegate.
[Pure]
public static IExecutable<T1, (TNew, T3)> First<T1, T2, T3, TNew>(this IExecutable<T1, (T2, T3)> fork, Func<T2, TNew> map)
Parameters
forkIExecutable<T1, (T2, T3)>Executable that returns a tuple.
mapFunc<T2, TNew>Delegate applied to the first tuple item.
Returns
- IExecutable<T1, (TNew, T3)>
Executable with transformed first tuple item.
Type Parameters
T1T2T3TNew
Exceptions
- ArgumentNullException
mapis null.
FlatMap<T1, T2, T3>(IExecutable<T1, T2>, IExecutable<T2, IExecutable<T2, T3>>)
Chains an executable with another executable-producing executable and flattens the nested result.
[Pure]
public static IExecutable<T1, T3> FlatMap<T1, T2, T3>(this IExecutable<T1, T2> first, IExecutable<T2, IExecutable<T2, T3>> second)
Parameters
firstIExecutable<T1, T2>Executable invoked first.
secondIExecutable<T2, IExecutable<T2, T3>>Executable that receives the result of
firstand returns the next executable to run.
Returns
- IExecutable<T1, T3>
Executable that executes both stages as a single pipeline.
Type Parameters
T1T2T3
Exceptions
- ArgumentNullException
secondis null.
FlatMap<T1, T2, T3>(IExecutable<T1, T2>, Func<T2, IExecutable<T2, T3>>)
Chains an executable with a delegate that selects the next executable to run and flattens the nested result.
[Pure]
public static IExecutable<T1, T3> FlatMap<T1, T2, T3>(this IExecutable<T1, T2> first, Func<T2, IExecutable<T2, T3>> second)
Parameters
firstIExecutable<T1, T2>Executable invoked first.
secondFunc<T2, IExecutable<T2, T3>>Delegate that receives the result of
firstand returns the next executable to run.
Returns
- IExecutable<T1, T3>
Executable that executes both stages as a single pipeline.
Type Parameters
T1T2T3
Exceptions
- ArgumentNullException
secondis null.
Fork<T1, T2, T3, T4>(IExecutable<T1, T2>, IExecutable<T2, T3>, IExecutable<T2, T4>)
Branches execution into two executables and returns both results.
[Pure]
public static IExecutable<T1, (T3, T4)> Fork<T1, T2, T3, T4>(this IExecutable<T1, T2> executable, IExecutable<T2, T3> firstBranch, IExecutable<T2, T4> secondBranch)
Parameters
executableIExecutable<T1, T2>Executable that produces the shared branch input.
firstBranchIExecutable<T2, T3>First branch executable.
secondBranchIExecutable<T2, T4>Second branch executable.
Returns
- IExecutable<T1, (T3, T4)>
Executable that returns both branch results.
Type Parameters
T1T2T3T4
Exceptions
- ArgumentNullException
firstBranchorsecondBranchis null.
Fork<T1, T2, T3, T4>(IExecutable<T1, T2>, Func<T2, T3>, Func<T2, T4>)
Branches execution into two delegates and returns both results.
[Pure]
public static IExecutable<T1, (T3, T4)> Fork<T1, T2, T3, T4>(this IExecutable<T1, T2> executable, Func<T2, T3> firstBranch, Func<T2, T4> secondBranch)
Parameters
executableIExecutable<T1, T2>Executable that produces the shared branch input.
firstBranchFunc<T2, T3>First branch delegate.
secondBranchFunc<T2, T4>Second branch delegate.
Returns
- IExecutable<T1, (T3, T4)>
Executable that returns both branch results.
Type Parameters
T1T2T3T4
Exceptions
- ArgumentNullException
firstBranchorsecondBranchis null.
MapIso<T1, T2>(IExecutable<T2, T2>, IIso<T1, T2>)
Adapts an endomorphism through an isomorphism.
[Pure]
public static IExecutable<T1, T1> MapIso<T1, T2>(this IExecutable<T2, T2> executable, IIso<T1, T2> iso)
Parameters
executableIExecutable<T2, T2>Executable that transforms values of type
T2.isoIIso<T1, T2>Isomorphism used to convert values into and out of
T2.
Returns
- IExecutable<T1, T1>
Executable that transforms values of type
T1by mapping throughiso.
Type Parameters
T1External input and output type.
T2Internal input and output type of the executable.
Map<T1, T2, T3, T4>(IExecutable<T2, T3>, Func<T1, T2>, Func<T3, T4>)
Adapts an executable to different external input and output types by applying delegate mappings around it.
[Pure]
public static IExecutable<T1, T4> Map<T1, T2, T3, T4>(this IExecutable<T2, T3> executable, Func<T1, T2> incoming, Func<T3, T4> outgoing)
Parameters
executableIExecutable<T2, T3>Executable being adapted.
incomingFunc<T1, T2>Delegate that converts external input to the executable input type.
outgoingFunc<T3, T4>Delegate that converts executable output to the external output type.
Returns
- IExecutable<T1, T4>
Executable with adapted input and output contracts.
Type Parameters
T1T2T3T4
Exceptions
- ArgumentNullException
incomingoroutgoingis null.
Merge<T1, T2, T3, T4>(IExecutable<T1, (T2, T3)>, Func<T2, T3, T4>)
Merges a tuple result with a delegate.
[Pure]
public static IExecutable<T1, T4> Merge<T1, T2, T3, T4>(this IExecutable<T1, (T2, T3)> fork, Func<T2, T3, T4> merge)
Parameters
forkIExecutable<T1, (T2, T3)>Executable that returns a tuple.
mergeFunc<T2, T3, T4>Delegate that combines tuple items into a single result.
Returns
- IExecutable<T1, T4>
Executable that returns the merged result.
Type Parameters
T1T2T3T4
Exceptions
- ArgumentNullException
mergeis null.
Merge<T1, T2, T3, T4, T5>(IExecutable<T1, (T2, T3, T4)>, Func<T2, T3, T4, T5>)
Merges a three-item tuple result with a delegate.
[Pure]
public static IExecutable<T1, T5> Merge<T1, T2, T3, T4, T5>(this IExecutable<T1, (T2, T3, T4)> executable, Func<T2, T3, T4, T5> merge)
Parameters
executableIExecutable<T1, (T2, T3, T4)>Executable that returns a three-item tuple.
mergeFunc<T2, T3, T4, T5>Delegate that combines tuple items into a single result.
Returns
- IExecutable<T1, T5>
Executable that returns the merged result.
Type Parameters
T1T2T3T4T5
Exceptions
- ArgumentNullException
mergeis null.
Merge<T1, T2, T3, T4, T5, T6>(IExecutable<T1, (T2, T3, T4, T5)>, Func<T2, T3, T4, T5, T6>)
Merges a four-item tuple result with a delegate.
[Pure]
public static IExecutable<T1, T6> Merge<T1, T2, T3, T4, T5, T6>(this IExecutable<T1, (T2, T3, T4, T5)> executable, Func<T2, T3, T4, T5, T6> merge)
Parameters
executableIExecutable<T1, (T2, T3, T4, T5)>Executable that returns a four-item tuple.
mergeFunc<T2, T3, T4, T5, T6>Delegate that combines tuple items into a single result.
Returns
- IExecutable<T1, T6>
Executable that returns the merged result.
Type Parameters
T1T2T3T4T5T6
Exceptions
- ArgumentNullException
mergeis null.
Second<T1, T2, T3, TNew>(IExecutable<T1, (T2, T3)>, IExecutable<T3, TNew>)
Maps the second item of a tuple result.
[Pure]
public static IExecutable<T1, (T2, TNew)> Second<T1, T2, T3, TNew>(this IExecutable<T1, (T2, T3)> fork, IExecutable<T3, TNew> map)
Parameters
forkIExecutable<T1, (T2, T3)>Executable that returns a tuple.
mapIExecutable<T3, TNew>Executable applied to the second tuple item.
Returns
- IExecutable<T1, (T2, TNew)>
Executable with transformed second tuple item.
Type Parameters
T1T2T3TNew
Exceptions
- ArgumentNullException
mapis null.
Second<T1, T2, T3, TNew>(IExecutable<T1, (T2, T3)>, Func<T3, TNew>)
Maps the second item of a tuple result with a delegate.
[Pure]
public static IExecutable<T1, (T2, TNew)> Second<T1, T2, T3, TNew>(this IExecutable<T1, (T2, T3)> fork, Func<T3, TNew> map)
Parameters
forkIExecutable<T1, (T2, T3)>Executable that returns a tuple.
mapFunc<T3, TNew>Delegate applied to the second tuple item.
Returns
- IExecutable<T1, (T2, TNew)>
Executable with transformed second tuple item.
Type Parameters
T1T2T3TNew
Exceptions
- ArgumentNullException
mapis null.
Swap<T1, T2, T3>(IExecutable<T1, (T2, T3)>)
Swaps items in a tuple result.
[Pure]
public static IExecutable<T1, (T3, T2)> Swap<T1, T2, T3>(this IExecutable<T1, (T2, T3)> fork)
Parameters
forkIExecutable<T1, (T2, T3)>Executable that returns a tuple.
Returns
- IExecutable<T1, (T3, T2)>
Executable that returns the tuple with reversed item order.
Type Parameters
T1T2T3
ToAsyncExecutable<T1, T2>(IExecutable<T1, T2>)
Converts a synchronous executable to an asynchronous executable.
[Pure]
public static IAsyncExecutable<T1, T2> ToAsyncExecutable<T1, T2>(this IExecutable<T1, T2> executable)
Parameters
executableIExecutable<T1, T2>
Returns
- IAsyncExecutable<T1, T2>
Asynchronous proxy executable.
Type Parameters
T1T2