Skip to content

AnyExistentialContainer

Azoy edited this page May 6, 2021 · 2 revisions

AnyExistentialContainer

An any existential container holds the necessary information for any value with type Any. I.e. the type erased type.

public struct AnyExistentialContainer 

ABI Stability: Stable since the following

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

Initializers

init(type:)

Initializes an existential container.

public init(type: Any.Type) 

Parameters

  • type: The type to create an existential container for.

init(metadata:)

Initializes an existential container.

public init(metadata: Metadata) 

Parameters

  • metadata: The metadata for the type to create an existential container for.

Properties

data

The storage needed to house the value of said type. This can be stored inline with all the data necessary to represent said type in 3 words, or could be stored indirectly through some pointer hoops. It's best to access the value through projectValue.

public var data: (Int, Int, Int) = (0, 0, 0)

type

The type being stored.

public var type: Any.Type

metadata

The metadata for the type being stored.

public var metadata: Metadata 

Methods

projectValue()

Accesses the value of type being stored in this container.

public mutating func projectValue() -> UnsafeRawPointer 

Returns

The opaque pointer to value of type.

Types
Protocols
Global Variables
Global Functions
Clone this wiki locally