Skip to content

StructDescriptor

tevelee edited this page Jul 25, 2026 · 5 revisions

StructDescriptor

A struct descriptor that describes some structure context.

public struct StructDescriptor: TypeContextDescriptor, LayoutWrapper 

ABI Stability: Stable since the following

| macOS | iOS/tvOS | watchOS | Linux | Windows |
|-------|----------|---------|-------|---------|
| 10.14 | 12.2     | 5.2     | NA    | NA      |

Inheritance

TypeContextDescriptor, LayoutWrapper

Properties

ptr

Backing context descriptor pointer.

public let ptr: UnsafeRawPointer

numFields

The number of stored properties this struct defines.

public var numFields: Int 

fieldOffsetVectorOffset

The number of words from the metadata pointer to the vector of field offsets for this struct. E.g. If this is 2:​ let fieldOffsetVector = metadataPtr + MemoryLayout.size * 2 // fieldOffsetVector is a buffer pointer to Int32's that tell the // stored offset for a specific field at index i.

public var fieldOffsetVectorOffset: Int 

genericValueMetadataPattern

The typed generic value-metadata pattern for this struct, if it is generic.

public var genericValueMetadataPattern: GenericValueMetadataPattern? 

foreignMetadataInitialization

The foreign metadata initialization info for this struct metadata, if it has any.

public var foreignMetadataInitialization: ForeignMetadataInitialization? 

singletonMetadataInitialization

The singleton metadata initialization info for this struct metadata, if it has any.

public var singletonMetadataInitialization: SingletonMetadataInitialization? 

canonicalMetadataPrespecializations

Canonical metadata specializations emitted for this generic type.

public var canonicalMetadataPrespecializations: [Metadata] 

canonicalMetadataPrespecializationCachingOnceToken

The runtime-owned once-token used to cache this generic type's canonical metadata prespecializations. This storage is exposed for inspection only and must not be mutated.

public var canonicalMetadataPrespecializationCachingOnceToken: UnsafeRawPointer? 

invertedProtocols

Capabilities this type's primary definition explicitly inverts.

public var invertedProtocols: InvertibleProtocolSet? 

singletonMetadata

The directly stored singleton metadata, when the compiler emitted one.

public var singletonMetadata: Metadata? 
Types
Protocols
Global Typealiases
Global Variables
Global Functions

Clone this wiki locally