TypeConstraint

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

Undocumented

  • Declaration

    Swift

    public typealias InputType = T
  • Declaration

    Swift

    public typealias ErrorType = E
  • Create a new CollectionConstraint instance

    Declaration

    Swift

    public init()
  • Set a Constraint on a property from the root object.

    Declaration

    Swift

    public mutating func set<C, V>(for keyPath: KeyPath<T, V>, constraint: C) where E == C.ErrorType, C : Constraint, V == C.InputType

    Parameters

    constraint

    A Constraint on the property at the provided KeyPath.

    keyPath

    The KeyPath for the property we set the Constraint on.

  • Set a Constraint on a property from the root object.

    Declaration

    Swift

    public mutating func set<C, V>(for keyPath: KeyPath<T, V>, constraintBuilder: () -> C) where E == C.ErrorType, C : Constraint, V == C.InputType

    Parameters

    constraint

    A Constraint on the property at the provided KeyPath.

    keyPath

    The KeyPath for the property we set the Constraint on.

  • Evaluates the input on the set key pathConstraints.

    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.