SwiftSemantics Documentation Beta

Structure Structure

public struct Structure: Declaration, Hashable, Codable

A structure declaration.

%3 Structure Structure Hashable Hashable Structure->Hashable Declaration Declaration Structure->Declaration ExpressibleBySyntax ExpressibleBySyntax Structure->ExpressibleBySyntax Codable Codable Structure->Codable CustomStringConvertible CustomStringConvertible Structure->CustomStringConvertible

Conforms To

Declaration

A Swift declaration.

ExpressibleBySyntax

A type that can be initialized with a Swift syntax node.

Codable
CustomStringConvertible
Hashable

Initializers

init(_:​)

public init(_ node: StructDeclSyntax)

Creates an instance initialized with the given syntax node.

Properties

attributes

let attributes: [Attribute]

The declaration attributes.

modifiers

let modifiers: [Modifier]

The declaration modifiers.

keyword

let keyword: String

The declaration keyword ("struct").

name

let name: String

The structure name.

inheritance

let inheritance: [String]

A list of adopted protocols.

For example, given the following declarations, the inheritance of structure S is ["P", "Q"]:

protocol P {}
protocol Q {}
struct S {}

generic​Parameters

let genericParameters: [GenericParameter]

The generic parameters for the declaration.

For example, the following declaration of structure S has a single generic parameter whose name is "T" and type is "Equatable":

struct S<T: Equatable> {}

generic​Requirements

let genericRequirements: [GenericRequirement]

The generic parameter requirements for the declaration.

For example, the following declaration of structure S has a single requirement that its generic parameter identified as "T" conforms to the type identified as "Hahable":

struct S<T> where T: Hashable {}

description

var description: String