Structure
GenericRequirement
public struct GenericRequirement: Hashable, Codable
A generic requirement.
A generic type or function declaration may specifying one or more requirements
in a generic where clause before the opening curly brace ({
) its body.
Each generic requirement establishes a relation between two type identifiers.
For example, the following declaration specifies two generic requirements:
func difference<C1: Collection, C2: Collection>(between lhs: C1, and rhs: C2) -> [C1.Element]
where C1.Element: Equatable, C1.Element == C2.Element
Relationships
Nested Types
GenericRequirement.Relation
A relation between the two types identified in the generic requirement.
Conforms To
Codable
CustomStringConvertible
Hashable
Properties
relation
let relation: Relation
The relation between the two identified types.
leftTypeIdentifier
let leftTypeIdentifier: String
The identifier for the left-hand side type.
rightTypeIdentifier
let rightTypeIdentifier: String
The identifier for the right-hand side type.
description
var description: String
Methods
genericRequirements(from:)
public static func genericRequirements(from node: GenericRequirementListSyntax?) -> [GenericRequirement]
Creates and returns generic requirements initialized from a generic requirement list syntax node.
Parameters
Name | Type | Description |
---|---|---|
from | GenericRequirementListSyntax? |
The generic requirement list syntax node, or |
Returns
An array of generic requirements, or nil
if the node is nil
.