Functions
The following functions are available globally.
-
Checks for inequality between two
Failable
values iw the same stored type but different validations.Declaration
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 theValidations
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 theValidations
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 theValidations
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 theValidations
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 theValidations
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 theValidations
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
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
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
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 twoFailable
instances where typeT
is the same and comforms toEquatable
, but theValidations
are different.Declaration
-
Checks for inequality of the
value
property from twoFailable
instances where typeT
is the same and comforms toEquatable
, but theValidations
are different.Declaration
-
See
Comparable....(_:_:)
. -
See
Comparable...<(_:_:)
.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 oneFailable
instance is great than another, where typeT
is the same and comforms toComparable
, but theValidations
are different.Declaration
-
Checks that the
value
property from oneFailable
instance is less than another, where typeT
is the same and comforms toComparable
, but theValidations
are different.Declaration
-
Checks that the
value
property from oneFailable
instance is great than or equal to another, where typeT
is the same and comforms toComparable
, but theValidations
are different.Declaration
-
Checks that the
value
property from oneFailable
instance is less than or equal to another, where typeT
is the same and comforms toComparable
, but theValidations
are different.Declaration
-
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.
-
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
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 twoFailable
instances. The validations for the newFailalbe
value is a combination of the validations from both instances. -
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 twoFailable
instances. The validations for the newFailalbe
value is a combination of the validations from both instances. -
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 twoFailable
instances. The validations for the newFailalbe
value is a combination of the validations from both instances. -
Multiplies a
Failable
value with anotherT
value and produces their product.Declaration
Parameters
lhs
The left value to multiply.
rhs
The right value to multiply.
Return Value
The product of the
Failable.value
property and therhs
value. -
Adds a
Failable
value to anotherT
value and produces their sum.Declaration
Parameters
lhs
The left value to add.
rhs
The right value to add.
Return Value
The sum of the
Failable.value
property and therhs
value. -
Subtracts
T
value from aFailable
value and produces their difference.Declaration
Parameters
lhs
The value to subtract from.
rhs
The value to subtract.
Return Value
The difference of the
Failable.value
property and therhs
value.
-
See
Optional.??(_:_:)
.Declaration
Swift
public func ?? <T, V>(optional: Failable<T?, V>, defaultValue: @autoclosure () throws -> T) rethrows -> T
-
See
Optional.??(_:_:)
.Declaration
Swift
public func ?? <T, V>(optional: Failable<T?, V>, defaultValue: @autoclosure () throws -> T?) rethrows -> T?
-
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.