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
instanceDeclaration
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 providedKeyPath
.keyPath
The
KeyPath
for the property we set theConstraint
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 providedKeyPath
.keyPath
The
KeyPath
for the property we set theConstraint
on. -
Evaluates the input on the set key path
Constraint
s.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 theSummary
of the failingConstraint
s otherwise.