TraitEncoder

final class TraitEncoder

Public interface for encoding Trait data.

  • Undocumented

    Declaration

    Swift

    enum PayloadType
    extension TraitEncoder.PayloadType : Equatable, Hashable
  • Undocumented

    Declaration

    Swift

    var encodingFormatResolvesToProtobuf: Bool { get }
  • Undocumented

    Declaration

    Swift

    @_spi(Unknown)
    func setPayload(_ payload: TraitPayload)
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func wrapPayload(namespace: [UInt32]) -> Self
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: T) throws -> Self where T : Scalar
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: [T]) throws -> Self where T : Scalar
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: T?) throws -> Self where T : Scalar
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: [T]?) throws -> Self where T : Scalar
  • Encodes a nullable scalar value at the given tag.

    If the value is nil, a Matter Null sentinel is encoded.

    Throws

    HomeError if encoding fails.

    Declaration

    Swift

    @discardableResult
    func encodeNullable<T>(tag: TagID, value: T?) throws -> Self where T : Scalar

    Parameters

    tag

    The tag ID where the value should be encoded.

    value

    The scalar value to encode, or nil.

    Return Value

    The encoder instance for chaining.

  • Encodes a nullable array of scalar values at the given tag.

    If the value is nil, a Matter Null sentinel is encoded.

    Throws

    HomeError if encoding fails.

    Declaration

    Swift

    @discardableResult
    func encodeNullable<T>(tag: TagID, value: [T]?) throws -> Self where T : Scalar

    Parameters

    tag

    The tag ID where the value should be encoded.

    value

    The array of scalar values to encode, or nil.

    Return Value

    The encoder instance for chaining.

  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: T) throws -> Self where T : Bitmap
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: [T]) throws -> Self where T : Bitmap
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: T?) throws -> Self where T : Bitmap
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: [T]?) throws -> Self where T : Bitmap
  • Encodes a nullable bitmap value at the given tag.

    If the value is nil, a Matter Null sentinel is encoded.

    Throws

    HomeError if encoding fails.

    Declaration

    Swift

    @discardableResult
    func encodeNullable<T>(tag: TagID, value: T?) throws -> Self where T : Bitmap

    Parameters

    tag

    The tag ID where the value should be encoded.

    value

    The bitmap value to encode, or nil.

    Return Value

    The encoder instance for chaining.

  • Encodes a nullable array of bitmap values at the given tag.

    If the value is nil, a Matter Null sentinel is encoded.

    Throws

    HomeError if encoding fails.

    Declaration

    Swift

    @discardableResult
    func encodeNullable<T>(tag: TagID, value: [T]?) throws -> Self where T : Bitmap

    Parameters

    tag

    The tag ID where the value should be encoded.

    value

    The array of bitmap values to encode, or nil.

    Return Value

    The encoder instance for chaining.

  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: T) throws -> Self where T : Enum
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: [T]) throws -> Self where T : Enum
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: T?) throws -> Self where T : Enum
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: [T]?) throws -> Self where T : Enum
  • Encodes a nullable enum value at the given tag.

    If the value is nil, a Matter Null sentinel is encoded.

    Throws

    HomeError if encoding fails.

    Declaration

    Swift

    @discardableResult
    func encodeNullable<T>(tag: TagID, value: T?) throws -> Self where T : Enum

    Parameters

    tag

    The tag ID where the value should be encoded.

    value

    The enum value to encode, or nil.

    Return Value

    The encoder instance for chaining.

  • Encodes a nullable array of enum values at the given tag.

    If the value is nil, a Matter Null sentinel is encoded.

    Throws

    HomeError if encoding fails.

    Declaration

    Swift

    @discardableResult
    func encodeNullable<T>(tag: TagID, value: [T]?) throws -> Self where T : Enum

    Parameters

    tag

    The tag ID where the value should be encoded.

    value

    The array of enum values to encode, or nil.

    Return Value

    The encoder instance for chaining.

  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: T) throws -> Self where T : StructDataRepresentable
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: [T]) throws -> Self where T : StructDataRepresentable
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: T?) throws -> Self where T : StructDataRepresentable
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<T>(tag: TagID, value: [T]?) throws -> Self where T : StructDataRepresentable
  • Encodes a nullable struct value at the given tag.

    If the value is nil, a Matter Null sentinel is encoded.

    Throws

    HomeError if encoding fails.

    Declaration

    Swift

    @discardableResult
    func encodeNullable<T>(tag: TagID, value: T?) throws -> Self where T : StructDataRepresentable

    Parameters

    tag

    The tag ID where the value should be encoded.

    value

    The struct value to encode, or nil.

    Return Value

    The encoder instance for chaining.

  • Encodes a nullable array of struct values at the given tag.

    If the value is nil, a Matter Null sentinel is encoded.

    Throws

    HomeError if encoding fails.

    Declaration

    Swift

    @discardableResult
    func encodeNullable<T>(tag: TagID, value: [T]?) throws -> Self where T : StructDataRepresentable

    Parameters

    tag

    The tag ID where the value should be encoded.

    value

    The array of struct values to encode, or nil.

    Return Value

    The encoder instance for chaining.

  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<K, V>(tag: TagID, value: [K : V]) throws -> Self where K : Scalar, V : StructDataRepresentable
  • Undocumented

    Declaration

    Swift

    @discardableResult
    func encode<K, V>(tag: TagID, value: [K : V]) throws -> Self where K : Scalar, V : Scalar
  • Encodes a null sentinel value at the given tag.

    Throws

    HomeError if encoding fails.

    Declaration

    Swift

    @discardableResult
    func encodeNull(tag: TagID) throws -> Self

    Parameters

    tag

    The tag ID where the null value should be encoded.

    Return Value

    The encoder instance for chaining.