AnyConstraint

public struct AnyConstraint<T, E> : Constraint where E : Error

A type-erased Constraint.

  • A type that provides information about what kind of values the constraint can be evaluated with.

    Declaration

    Swift

    public typealias InputType = T
  • Declaration

    Swift

    public typealias ErrorType = E
  • Creates a type-erased Constraint that wraps the given instance.

    Declaration

    Swift

    public init<C>(_ constraint: C) where T == C.InputType, E == C.ErrorType, C : Constraint
  • Evaluates the input against the receiver.

    Declaration

    Swift

    public func evaluate(with input: T) -> Result<Void, Summary<E>>

    Parameters

    input

    The input to be validated.

    Return Value

    .success if the input is valid,.failure containing the Summary of the failing Constraints otherwise.