Executable
public class Executable<A>
Operation wrapping class to allow for closure mapping and scheduling Future
-
Apply function to execute the ExecutableOperation
Declaration
Swift
public func run(on scheduler: ExecutorType) -> Future<A>Return Value
Future for the scheduled operation
-
Unit operation that lazy initializes its value when scheduled on an Executor
Note
lazy evaluated: It’s not scheduled or evaluated on the given Executor, but on the calling one (e.g. the thread where the Executable (sub)chain is instantiated)See also
Self.evaluateDeclaration
Swift
public static func unit<A>(_ value: @autoclosure @escaping () -> A) -> Executable<A>Parameters
valueautoclosure that produces the value the Future (complete) event will contain
Return Value
Executable
where F.Element is the element produced by the valueblock closure -
Declaration
Swift
public static func evaluate<A>(_ block: @escaping Callable<A>) -> Executable<A>Parameters
blockclosure to evaluate when the operation is run
Return Value
Executable
where F.Element is the element produced by the blockclosure
-
Map an Executable to new Executable transforming the F.Element self produced to F2.Element using the
transformblock.Declaration
Swift
public func map<B>(_ transform: @escaping Function<A, B>) -> Executable<B>Parameters
transformclosure that transforms F.Element to F2.Element
Return Value
Executable
that allows for scheduling the mapping on an Executor -
Map an Executable to the given Executable by
transformusing the producedADeclaration
Swift
public func flatMap<B>(_ transform: @escaping Function<A, Executable<B>>) -> Executable<B>Parameters
transformclosure that takes
Aand should return anExecutable<B>Return Value
the Executable given by
transform -
Schedule
selfExecutable (and/or its sub-chain) for execution on the given ExecutorDeclaration
Swift
public func schedule(on executor: ExecutorType) -> Executable<A>Parameters
executorthe executor to schedule
self.execute(on:)onReturn Value
Executable that ignores its (down stream) passed in executor and uses the executor given by this function