ActionBranchPath

@MainActor
public struct ActionBranchPath<ContentType> where ContentType : ContentTypeable

A single branching path in an ActionBranch, pairing a BranchConditionable condition with an action and an optional output transformer.

When an ActionBranch performs, it evaluates each path’s condition in order and runs the first matching action. The path’s optional transformer converts the action’s output before the branch forwards the result through its output conduit to the next sequence step.

Note

Do not create these directly. Use ActionBranchConfiguration‘s .branch(when:action:transformer:) builder method, which constructs ActionBranchPath objects automatically when building the ActionBranch.

  • The condition that determines whether this branch path is selected.

    Declaration

    Swift

    @MainActor
    public let condition: any BranchConditionable<ContentType>
  • The action to run when this path is selected.

    Declaration

    Swift

    @MainActor
    public let action: any ActionPerformable<ContentType>
  • An optional transformer applied to the branch path’s result before forwarding to the next sequence step. Use this when the path’s output shape differs from what the downstream step expects.

    Declaration

    Swift

    @MainActor
    public let transformer: (any ContentTransformable<ContentType, ContentType>)?
  • Undocumented

    Declaration

    Swift

    @MainActor
    public init(condition: any BranchConditionable<ContentType>, action: any ActionPerformable<ContentType>, transformer: (any ContentTransformable<ContentType, ContentType>)? = nil)