A value in a reportable-metadata dictionary.
Strings, numbers, and dates all initialize directly. The ReportableMetadata() macro constructs these automatically when you annotate your metadata type.
let values: [String: ReportableMetadataValue] = [
"username": ReportableMetadataValue("alice"),
"loginCount": ReportableMetadataValue(42),
"lastLogin": ReportableMetadataValue(Date()),
"score": ReportableMetadataValue(98.6)
]
Declaration
public enum ReportableMetadataValue : Sendable, Codable, Hashable {
case date(Date)
case string(String)
case integer(Int128)
case floatingPoint(Double)
public init(_ value: String)
public init(_ value: Date)
public init(_ value: Int)
public init(_ value: Int8)
public init(_ value: Int16)
public init(_ value: Int32)
public init(_ value: Int64)
public init(_ value: Bool)
public init(_ value: UInt)
public init(_ value: UInt8)
public init(_ value: UInt16)
public init(_ value: UInt32)
public init(_ value: UInt64)
public init(_ value: Float)
public init(_ value: Double)
public init(_ value: CGFloat)
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: ReportableMetadataValue, b: ReportableMetadataValue) -> Bool
/// Hashes the essential components of this value by feeding them into the
/// given hasher.
///
/// Implement this method to conform to the `Hashable` protocol. The
/// components used for hashing must be the same as the components compared
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
/// with each of these components.
///
/// - Important: In your implementation of `hash(into:)`,
Truncated.