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.evaluate

    Declaration

    Swift

    public static func unit<A>(_ value: @autoclosure @escaping () -> A) -> Executable<A>

    Parameters

    value

    autoclosure that produces the value the Future (complete) event will contain

    Return Value

    Executable where F.Element is the element produced by the value block closure

  • Executable operation that schedules/forks a Callable

    Parameters

    block

    closure to evaluate when the operation is run

    Return Value

    Executable where F.Element is the element produced by the block closure

  • Map an Executable to new Executable transforming the F.Element self produced to F2.Element using the transform block.

    Declaration

    Swift

    public func map<B>(_ transform: @escaping Function<A, B>) -> Executable<B>

    Parameters

    transform

    closure 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 transform using the produced A

    Declaration

    Swift

    public func flatMap<B>(_ transform: @escaping Function<A, Executable<B>>) -> Executable<B>

    Parameters

    transform

    closure that takes A and should return an Executable<B>

    Return Value

    the Executable given by transform

  • Schedule self Executable (and/or its sub-chain) for execution on the given Executor

    Declaration

    Swift

    public func schedule(on executor: ExecutorType) -> Executable<A>

    Parameters

    executor

    the executor to schedule self.execute(on:) on