Structureswift-package-manager 6.0.1Basics
ObservabilityMetadata
Provides type-safe access to the ObservabilityMetadata’s values. This API should ONLY be used inside of accessor implementations.
Observability.swift:416struct ObservabilityMetadata
End users should use “accessors” the key’s author MUST define rather than using this subscript, following this pattern:
extension ObservabilityMetadata {
var testID: String? {
get {
self[TestIDKey.self]
}
set {
self[TestIDKey.self] = newValue
}
}
}
enum TestIDKey: ObservabilityMetadataKey {
typealias Value = String
}
This is in order to enforce a consistent style across projects and also allow for fine grained control over who may set and who may get such property. Just access control to the Key type itself lacks such fidelity.
Note that specific baggage and context types MAY (and usually do), offer also a way to set baggage values, however in the most general case it is not required, as some frameworks may only be able to offer reading.
Citizens in Basics
Conformances
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Sendable
Types
struct AnyKey
A type-erased
ObservabilityMetadataKey
used when iterating through theObservabilityMetadata
using itsforEach
method.struct UnderlyingError
Show obsolete interfaces (1)
Hide obsolete interfaces
Typealiases
Type members
Instance members
var count: Int
The number of items in the baggage.
var debugDescription: String
var isEmpty: Bool
A Boolean value that indicates whether the baggage is empty.
var underlyingError: Error?
subscript<Key>(Key.Type
) -> Key.Value? func forEach((AnyKey, Sendable) throws -> Void
) rethrows Iterate through all items in this
ObservabilityMetadata
by invoking the given closure for each item.func merging(ObservabilityMetadata
) -> ObservabilityMetadata
Show obsolete interfaces (1)
Hide obsolete interfaces
Available in PackageModel
Type members
static func packageMetadata(identity: PackageIdentity, kind: PackageReference.Kind
) -> ObservabilityMetadata
Instance members
Available in PackageLoading
Type members
Instance members
Available in SPMBuildCore
Instance members
var fileLocation: FileLocation?
var pluginName: String?
Provides information about the plugin from which the diagnostics originated.