# Cardinality

``public struct Cardinality : Equatable``

Represents the cardinality of a rule. It can be specified as a closed range, including those with no upper bound (`PartialRangeFrom`)

• ``` minimumMatches ```

The minimum number of matches, must be >= 0

#### Declaration

Swift

``public let minimumMatches: Int``
• ``` maximumMatches ```

The maximum number of matches. If nil, any number can be matched

#### Declaration

Swift

``public let maximumMatches: Int?``
• ``` init(_:) ```

Creates a new range from the supplied partial range meaning that the number of allowable matches is infinite

#### Declaration

Swift

``public init(_ range: PartialRangeFrom<Int>)``

#### Parameters

 ``` range ``` The partial closed range of allowed match counts
• ``` init(_:) ```

Creates a new range from the supplied closed range meaning that the number of allowable matches is infinite

#### Declaration

Swift

``public init(_ range: ClosedRange<Int>)``

#### Parameters

 ``` range ``` The closed range of allowed match counts
• ``` one ```

A pre-specified constant for one and exactly one matches

#### Declaration

Swift

``public static let one: Cardinality``
• ``` zeroOrOne ```

A pre-specified constant for optional matches (between 0 and 1 matches)

#### Declaration

Swift

``public static let zeroOrOne: Cardinality``
• ``` zeroOrMore ```

A pre-specified constant for optional but unbound matches (between 0 and infinity matches)

#### Declaration

Swift

``public static let zeroOrMore: Cardinality``
• ``` oneOrMore ```

A pre-specified constant for required but unbound matches (between 1 and infinity matches)

#### Declaration

Swift

``public static let oneOrMore: Cardinality``
• ``` ==(_:_:) ```

The equality function

#### Declaration

Swift

``public static func == (lhs: Cardinality, rhs: Cardinality) -> Bool``