Functions

The following functions are available globally.

  • Checks for inequality between two Failable values iw the same stored type but different validations.

    Declaration

    Swift

    public func != <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: BinaryInteger

    Parameters

    lhs

    The left value to check.

    rhs

    The right value to check.

    Return Value

    The boolean value that represents whether the value are non-equal or not.

  • Produces the remainder of dividing a Failable value by another, where the Validations types are different.

    Declaration

    Swift

    public func % <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws -> Failable<T, AppendedValidations<T, V1, V2>> where T: BinaryInteger

    Parameters

    lhs

    The dividend in the equation.

    rhs

    The divisor in the equation.

    Return Value

    The remainder of the division problem, with the validations of both Failalble types passed in.

  • Produces the result of a bitwise AND operatoion on two Failable values, where the Validations types are different.

    Declaration

    Swift

    public func & <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws -> Failable<T, AppendedValidations<T, V1, V2>> where T: BinaryInteger

    Parameters

    lhs

    The left value for the operation.

    rhs

    The right value for the operation.

    Return Value

    The result of the operation, with the validations of both Failalble types passed in.

  • Produces the product of two Failable values, where the Validations types are different.

    Declaration

    Swift

    public func * <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws -> Failable<T, AppendedValidations<T, V1, V2>> where T: BinaryInteger

    Parameters

    lhs

    The value to multiply.

    rhs

    The value to multiply the first value by.

    Return Value

    The product of the equation, with the validations of both Failalble types passed in.

  • Produces the sum of two Failable values, where the Validations types are different.

    Declaration

    Swift

    public func + <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws -> Failable<T, AppendedValidations<T, V1, V2>> where T: BinaryInteger

    Parameters

    lhs

    The left value to add.

    rhs

    The right value to add.

    Return Value

    The sum of the two values, with the validations of both Failalble types passed in.

  • Produces the difference of two Failable values, where the Validations types are different.

    Declaration

    Swift

    public func - <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws -> Failable<T, AppendedValidations<T, V1, V2>> where T: BinaryInteger

    Parameters

    lhs

    The value to subtract from.

    rhs

    The value to subtract from the left value.

    Return Value

    The difference of the two values, with the validations of both Failalble types passed in.

  • Produces the quotient of dividing on Failable value by another, where the Validations types are different.

    Declaration

    Swift

    public func / <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws -> Failable<T, AppendedValidations<T, V1, V2>> where T: BinaryInteger

    Parameters

    lhs

    The dividend in the equation.

    rhs

    The divisor in the equation.

    Return Value

    The quotient of the division problem, with the validations of both Failalble types passed in.

  • Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument, where the Validations types are different.

    Declaration

    Swift

    public func <= <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: BinaryInteger

    Parameters

    lhs

    The left value to check.

    rhs

    The right value to check.

    Return Value

    The boolean value that represents whether the first value is less than or equal to the second.

  • Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument, where the Validations types are different.

    Declaration

    Swift

    public func > <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: BinaryInteger

    Parameters

    lhs

    The left value to check.

    rhs

    The right value to check.

    Return Value

    The boolean value that represents whether the first value is greater than the second.

  • Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument, where the Validations types are different.

    Declaration

    Swift

    public func >= <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: BinaryInteger

    Parameters

    lhs

    The left value to check.

    rhs

    The right value to check.

    Return Value

    The boolean value that represents whether the first value is greater than or equal to the second.

  • Returns the result of performing a bitwise XOR operation on the two given values, where the Validations types are different.

    Declaration

    Swift

    public func ^ <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws -> Failable<T, AppendedValidations<T, V1, V2>> where T: BinaryInteger

    Parameters

    lhs

    The left value in the operation.

    rhs

    The right value in the operation.

    Return Value

    The result of the XOR operation, with the validation types from both values passed in.

  • Returns the result of performing a bitwise OR operation on the two given values, where the Validations types are different.

    Declaration

    Swift

    public func | <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws -> Failable<T, AppendedValidations<T, V1, V2>> where T: BinaryInteger

    Parameters

    lhs

    The left value in the operation.

    rhs

    The right value in the operation.

    Return Value

    The result of the OR operation, with the validation types from both values passed in.

  • Checks for equality of the value property from two Failable instances where type T is the same and comforms to Equatable, but the Validations are different.

    Declaration

    Swift

    public func == <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: Equatable

    Parameters

    lhs

    The left Failable instance to compare.

    rhs

    The right Failable instance to compare.

  • Checks for inequality of the value property from two Failable instances where type T is the same and comforms to Equatable, but the Validations are different.

    Declaration

    Swift

    public func != <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: Equatable

    Parameters

    lhs

    The left Failable instance to compare.

    rhs

    The right Failable instance to compare.

  • Declaration

    Swift

    public func ..< <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws
        -> Failable<Range<T>, ElementValidation<Range<T>, AppendedValidations<T, V1, V2>>> where T: Comparable
  • Checks that the value property from one Failable instance is great than another, where type T is the same and comforms to Comparable, but the Validations are different.

    Declaration

    Swift

    public func > <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: Comparable

    Parameters

    lhs

    The left Failable instance to compare.

    rhs

    The right Failable instance to compare.

  • Checks that the value property from one Failable instance is less than another, where type T is the same and comforms to Comparable, but the Validations are different.

    Declaration

    Swift

    public func < <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: Comparable

    Parameters

    lhs

    The left Failable instance to compare.

    rhs

    The right Failable instance to compare.

  • Checks that the value property from one Failable instance is great than or equal to another, where type T is the same and comforms to Comparable, but the Validations are different.

    Declaration

    Swift

    public func >= <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: Comparable

    Parameters

    lhs

    The left Failable instance to compare.

    rhs

    The right Failable instance to compare.

  • Checks that the value property from one Failable instance is less than or equal to another, where type T is the same and comforms to Comparable, but the Validations are different.

    Declaration

    Swift

    public func <= <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: Comparable

    Parameters

    lhs

    The left Failable instance to compare.

    rhs

    The right Failable instance to compare.

  • Returns the product of the two given Failable values, wrapping the result in case of any overflow.

    Declaration

    Swift

    public func &* <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws
        -> Failable<T, AppendedValidations<T, V1, V2>> where T: FixedWidthInteger

    Parameters

    lhs

    The left value to multiply.

    rhs

    The right value to mutiply.

    Return Value

    The product of the multiplcation equation, with validation types from the values passed in mixed.

  • Returns the sum of the two given values, wrapping the result in case of any overflow.

    Declaration

    Swift

    public func &+ <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws
        -> Failable<T, AppendedValidations<T, V1, V2>> where T: FixedWidthInteger

    Parameters

    lhs

    The left value to add.

    rhs

    The right value to add.

    Return Value

    The sum of the addition equation, with validation types from the values passed in mixed.

  • Returns the difference of the two given values, wrapping the result in case of any overflow.

    Declaration

    Swift

    public func &- <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws
        -> Failable<T, AppendedValidations<T, V1, V2>> where T: FixedWidthInteger

    Parameters

    lhs

    The value to subtract from.

    rhs

    The value to subtract from the left value.

    Return Value

    The difference of the subtraction equation, with validation types from the values passed in mixed.

  • Returns the result of shifting a value’s binary representation the specified number of digits to the left, masking the shift amount to the type’s bit width.

    Declaration

    Swift

    public func &<< <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws
        -> Failable<T, AppendedValidations<T, V1, V2>> where T: FixedWidthInteger

    Parameters

    lhs

    The value to shift.

    rhs

    The amount to shift the left value by.

    Return Value

    The result of the shift operation, with validation types from the values passed in mixed.

  • Returns the result of shifting a value’s binary representation the specified number of digits to the right, masking the shift amount to the type’s bit width.

    Declaration

    Swift

    public func &>> <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws
        -> Failable<T, AppendedValidations<T, V1, V2>> where T: FixedWidthInteger

    Parameters

    lhs

    The value to shift.

    rhs

    The amount to shift the left value by.

    Return Value

    The result of the shift operation, with validation types from the values passed in mixed.

  • Undocumented

    Declaration

    Swift

    public func < <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: FloatingPoint
  • Undocumented

    Declaration

    Swift

    public func <= <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: FloatingPoint
  • Undocumented

    Declaration

    Swift

    public func > <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: FloatingPoint
  • Undocumented

    Declaration

    Swift

    public func >= <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>) -> Bool where T: FloatingPoint
  • Multiplies two Failable values and produces their product, rounding to a representable value.

    Declaration

    Swift

    public func * <T, V1, V2>(_ lhs: Failable<T, V1>, _ rhs: Failable<T, V2>)throws
        -> Failable<T, AppendedValidations<T, V1, V2>> where T: FloatingPoint

    Parameters

    lhs

    The left value to multiply.

    rhs

    The right value to multiply.

    Return Value

    The product of the multiplcation equation, where the validation is the validations of the two values passed in.

  • Adds two Failable values and produces their sum, rounding to a representable value.

    Declaration

    Swift

    public func + <T, V1, V2>(_ lhs: Failable<T, V1>, _ rhs: Failable<T, V2>)throws
        -> Failable<T, AppendedValidations<T, V1, V2>> where T: FloatingPoint

    Parameters

    lhs

    The left value to add.

    rhs

    The right value to add.

    Return Value

    The sum of the addition equation, where the validation is the validations of the two values passed in.

  • Subtracts two Failable values and produces their difference, rounding to a representable value.

    Declaration

    Swift

    public func - <T, V1, V2>(_ lhs: Failable<T, V1>, _ rhs: Failable<T, V2>)throws
        -> Failable<T, AppendedValidations<T, V1, V2>> where T: FloatingPoint

    Parameters

    lhs

    The value to subtract from.

    rhs

    The value to subtract from the left value.

    Return Value

    The difference of the subtraction equation, where the validation is the validations of the two values passed in.

  • Divides two Failable values and produces their quotient, rounding to a representable value.

    Declaration

    Swift

    public func / <T, V1, V2>(_ lhs: Failable<T, V1>, _ rhs: Failable<T, V2>)throws
        -> Failable<T, AppendedValidations<T, V1, V2>> where T: FloatingPoint

    Parameters

    lhs

    The value to subtract from.

    rhs

    The value to subtract from the left value.

    Return Value

    The quotient of the division equation, where the validation is the validations of the two values passed in.

  • Returns a Boolean value indicating whether two values are equal.

    Declaration

    Swift

    public func == <T, V1, V2>(_ lhs: Failable<T, V1>, _ rhs: Failable<T, V2>) -> Bool where T: FloatingPoint

    Parameters

    lhs

    The left value to check for equality.

    rhs

    The right value to check for euqality.

    Return Value

    The boolean indicating whether the values are equal or not.

  • Multiplies two values from Failable instances and produces their product, combining the validations.

    Declaration

    Swift

    public func * <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws -> Failable<T, AppendedValidations<T, V1, V2>> where T: Numeric

    Parameters

    lhs

    The left value to multiply.

    rhs

    The right value to multiply.

    Return Value

    The product of the value values from the two Failable instances. The validations for the new Failalbe value is a combination of the validations from both instances.

  • Multiplies two values from Failable instances and stores the result in the left-hand-side Failable instance.

    Declaration

    Swift

    public func *= <T, V1, V2>(lhs: inout Failable<T, V1>, rhs: Failable<T, V2>)throws where T: Numeric

    Parameters

    lhs

    The left value to multiply.

    rhs

    The right value to multiply.

  • Adds two values from Failable instances and produces their sum, combining the validations.

    Declaration

    Swift

    public func + <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws -> Failable<T, AppendedValidations<T, V1, V2>> where T: Numeric

    Parameters

    lhs

    The left value to add.

    rhs

    The right value to add.

    Return Value

    The sum of the value values from the two Failable instances. The validations for the new Failalbe value is a combination of the validations from both instances.

  • Adds two values from Failable instances and stores the result in the left-hand-side Failable instance.

    Declaration

    Swift

    public func += <T, V1, V2>(lhs: inout Failable<T, V1>, rhs: Failable<T, V2>)throws where T: Numeric

    Parameters

    lhs

    The left value to add.

    rhs

    The right value to add.

  • Subtracts one Failable value from another and produces their difference, combining the validations.

    Declaration

    Swift

    public func - <T, V1, V2>(lhs: Failable<T, V1>, rhs: Failable<T, V2>)throws -> Failable<T, AppendedValidations<T, V1, V2>> where T: Numeric

    Parameters

    lhs

    The value to subtract from.

    rhs

    The value to subtract.

    Return Value

    The product of the value values from the two Failable instances. The validations for the new Failalbe value is a combination of the validations from both instances.

  • Subtracts one Failable value from another and stores the result in the left-hand-side Failable instance.

    Declaration

    Swift

    public func -= <T, V1, V2>(lhs: inout Failable<T, V1>, rhs: Failable<T, V2>)throws where T: Numeric

    Parameters

    lhs

    The value to subtract from.

    rhs

    The value to subtract.

  • Multiplies a Failable value with another T value and produces their product.

    Declaration

    Swift

    public func * <T, V1>(lhs: Failable<T, V1>, rhs: T)throws -> Failable<T, V1> where T: Numeric

    Parameters

    lhs

    The left value to multiply.

    rhs

    The right value to multiply.

    Return Value

    The product of the Failable.value property and the rhs value.

  • Multiplies a Failable value with another T value and stores the result in the left-hand-side Failable instance.

    Declaration

    Swift

    public func *= <T, V1>(lhs: inout Failable<T, V1>, rhs: T)throws where T: Numeric

    Parameters

    lhs

    The left value to multiply.

    rhs

    The right value to multiply.

  • Adds a Failable value to another T value and produces their sum.

    Declaration

    Swift

    public func + <T, V1>(lhs: Failable<T, V1>, rhs: T)throws -> Failable<T, V1> where T: Numeric

    Parameters

    lhs

    The left value to add.

    rhs

    The right value to add.

    Return Value

    The sum of the Failable.value property and the rhs value.

  • Adds a Failable value to another T value and stores the result in the left-hand-side Failable instance.

    Declaration

    Swift

    public func += <T, V1>(lhs: inout Failable<T, V1>, rhs: T)throws where T: Numeric

    Parameters

    lhs

    The left value to add.

    rhs

    The right value to add.

  • Subtracts T value from a Failable value and produces their difference.

    Declaration

    Swift

    public func - <T, V1>(lhs: Failable<T, V1>, rhs: T)throws -> Failable<T, V1> where T: Numeric

    Parameters

    lhs

    The value to subtract from.

    rhs

    The value to subtract.

    Return Value

    The difference of the Failable.value property and the rhs value.

  • Subtracts a T value from a Failable value and stores the result in the left-hand-side Failable instance.

    Declaration

    Swift

    public func -= <T, V1>(lhs: inout Failable<T, V1>, rhs: T)throws where T: Numeric

    Parameters

    lhs

    The value to subtract from.

    rhs

    The value to subtract.

  • Sets the stored value of a Failable type.

    You have to use this operator instead of = so the validations always run on the new value before it is assigned.

    Complexity

    O(n^m), where n is the number of type compatible sub-validations for the Failable type’s sub-validations and m is the depth of the sub-validations.

    Declaration

    Swift

    public func <~ <T, Validations>(root: inout Failable<T, Validations>, value: T)throws

    Parameters

    root

    The Failable instance that holds the value to be mutated.

    value

    The new value for the root.value property.